% Main function of the final project
close all;
clear all;
% Read the original images to the matrix orig_image;
clear orig_image;
clear temp_image;
temp_image = imread('image1.bmp');
orig_image(:,:,:) = double(temp_image(:,:,:));
% Image compression
starttime = cputime;
clear comp_image;
[comp_image_Y1,comp_image_U1,comp_image_V1] = Compress(orig_image(:,:,:,1));
comp_size = comp_image_Y1.realsize+comp_image_U1.realsize+comp_image_V1.realsize;
%comp_image = zeros(comp_image_Y1.realsize,comp_image_U1.realsize,comp_image_V1.realsize);
% Image decompression
% You are required to implement this part
clear reco_image;
s_image1 = Decompress(comp_image_Y1,comp_image_U1,comp_image_V1);
%figure,imshow(s_image),title('jjiayatuxl');
reco_image(:,:,:) = double(s_image1(:,:,:));
runtime = cputime - starttime;
% Check the size of the recovered image
clear sizevector1;
clear sizevector2;
[m1,m2,m3] = size(orig_image);
sizevector1 = size(orig_image);
sizevector2 = size(reco_image);
if sizevector1==sizevector2
% Calculate the compression ratio
comp_ratio = m1*m2*m3/comp_size;
% Calculate the distortion of the recovered images using Mean Square Error
reco_image = double(reco_image);
MSE = CalMSE(orig_image, round(reco_image));
% Display the original image and recovered image
figure(1);
subplot(2,2,1);
clear disp_image;
disp_image = orig_image(:,:,:);
imdisplay(disp_image);
title('Original Image 1');
subplot(2,2,2);
clear disp_image;
disp_image = reco_image(:,:,:);
imdisplay(disp_image);
title('Recovered Image 1');
% Output the performance
ratiomesg = sprintf('The compression ratio is = %6.2f\n', comp_ratio);
disp(ratiomesg );
distortionmesg = sprintf('The MSE is = %6.2f\n', MSE);
disp(distortionmesg );
timemesg = sprintf('The running time is = %6.2f\n', runtime);
disp(timemesg );
else
disp('The size of the recovered image is not correct');
end
JPEG.rar_image_image compression_jpeg_majorxt5_recall4m5
版权申诉
97 浏览量
2022-09-21
01:26:39
上传
评论
收藏 5.57MB RAR 举报
Kinonoyomeo
- 粉丝: 74
- 资源: 1万+
最新资源
- 基于MIC+NE555光敏电阻的声光控电路Multisim仿真原理图
- python tkinter-08-盒子模型.ev4.rar
- Doozy UI Manager 2023
- 基于matlab实现夜间车牌识别程序(1).rar
- 基于matlab实现无线传感器网络无需测距定位算法matlab源代码 包括apit,dv-hop,amorphous在内的共7个
- 基于python的yolov5实现的旋转目标检测
- 基于matlab实现无线传感器网络 CAB定位仿真程序 这是无线传感器节点定位CAB算法的仿真程序,由matlab完成.rar
- 基于matlab实现图像处理,本程序使用背景差分法对来往车辆进行检测和跟踪.rar
- 基于matlab实现视频监控中车型识别代码,自己写的,希望和大家多多交流.rar
- springcodespringcodespringcodespringcode
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈