J = adapthisteq(uint8(I_gray8));
figure;
imshow(uint8(J)),title('均衡化图');
R = a(:,:,1);
G = a(:,:,2);
B = a(:,:,3);
Rx4 = a(:,:,1)*4;
Gx4 = a(:,:,2)*4;
Bx4 = a(:,:,3)*4; %Rx4只是做了一个简单的线性的提亮,可以不用参考。
Rave = mean(mean(R));
Gave = mean(mean(G));
Bave = mean(mean(B));
Kave = (Rave + Gave + Bave) / 3;
R1 = (Kave/Rave)*R;
G1 = (Kave/Gave)*G;
B1 = (Kave/Bave)*B;
R2 = (Kave/Rave)*Rx4;
G2 = (Kave/Gave)*Gx4;
B2 = (Kave/Bave)*Bx4;
RGB_white = cat(3, R1, G1, B1);
RGB_whitex4 = cat(3, R2, G2, B2);
RGB_white_out = uint8(RGB_white);
RGB_white_outx4 = uint8(RGB_whitex4);
figure,
imshow(RGB_white_out);
title('白平衡图');
AHE 和白平衡 matlab程序
最新推荐文章于 2024-06-23 09:58:52 发布