9. matlab圖像處理基礎——JPEG壓縮+類型轉換


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);


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM