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