1、JPEG壓縮
imwrite(原始圖像,目標圖像,'quality',比率)
比率:[0, 100] 值越小,壓縮比率越大
%% JPEG壓縮 I = imread('cameraman.tif'); % imshow(I); imwrite(I,'test.jpg','quality',10); J = imread('test.jpg'); subplot(1,2,1),imshow(I); subplot(1,2,2),imshow(J);
2、類型轉換
(1)RGB轉灰度
灰度圖像 = rgb2gray(RGB圖像)
%% RGB轉灰度 I = imread('coloredChips.png'); subplot(1,2,1),imshow(I); J = rgb2gray(I); subplot(1,2,2),imshow(J);
(2)灰度圖像二值化
二值圖像 = imbinarize(灰度圖像)
%% 灰度圖像二值化 I = imread('cameraman.tif'); subplot(1,2,1),imshow(I); J = imbinarize(I); subplot(1,2,2),imshow(J);