|
楼主 |
发表于 2020-4-22 21:33
|
显示全部楼层
close all;
filepath='D:\19_无人机照片\';
file =dir(strcat(filepath,'*.jpg'));
[k ~]=size(file);
for j=1:k
imgname=file(j).name;
RGB1 = imread(strcat(filepath,imgname));
R=RGB1(:,:,1);
G=RGB1(:,:,2);
B=RGB1(:,:,3);
maxR=im2double(max(max(R)));
maxG=im2double(max(max(G)));
maxB=im2double(max(max(B)));
k=(maxR+maxG+maxB)/3;
if k<0.9
RGB2 = imadjust(RGB1,[0 0 0; k k k],[0 0 0;1 1 1],0.7);
else
RGB2=RGB1;
end
% %全屏显示图像
% hfig1 = figure(1);
% hfig2 = figure(2);
% figure(1); imshow(RGB1);title('原图');
% set(hfig1, 'unit', 'normalized', 'position', [0,0,1,1]);
out_path1 = strcat('./result',num2str(0.7),'/');
if ~isdir(out_path1)
mkdir(out_path1);
end
imwrite(RGB2,strcat(out_path1,imgname));
end
beep;
————————————————
版权声明:本文为CSDN博主「whuer_dyl」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/yingtaotaotao/java/article/details/88675929 |
|