clear all, close all; path=‘C:\Users\Administrator\Desktop\‘;
file=strcat(path,‘t1.jpg‘);
I1=imread(file); imshow(I1);
%将I1以0.1(或0.3)的压缩比储存 imwrite(I1,strcat(path,‘t2.jpg‘),‘Quality‘,10)); imwrite(I1,strcat(path,‘t3.jpg‘),‘Quality‘,30)); %绘制I1 R G B 三个通道的直方图 figure(‘color‘,‘white‘); imagesc(I1(: ,: ,1); colormap([(0, 1/255, 1)‘,zeros(256,1),zeros(256,1)]); axis=off; figure(‘color‘,‘white‘); imagesc(I1(: ,: ,2); colormap([zeros(256,1),(0, 1/255, 1)‘,zeros(256,1)]); axis=off; figure(‘color‘,‘white‘); imagesc(I1(: ,: ,3); colormap([zeros(256,1),zeros(256,1),(0, 1/255, 1)‘]); axis=off;
%绘制不同通道的直方图 figure(‘color‘,‘white‘); for i=1:3 subplot(:,:,i);imhis(I1(:,:,i)); title(strcat(‘r g b channel‘,num2str(i)); end
原文:https://www.cnblogs.com/kcy11993/p/13034782.html