资源简介
用MATLAB实现JPEG图像压缩算法,包括DCT变换,霍夫曼变换
代码片段和文件信息
function jpeg
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%% THIS WORK IS SUBMITTED BY:
%%
%% OHAD GAL
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
close all;
% ==================
% section 1.2 + 1.3
% ==================
% the following use of the function:
%
% plot_bases( base_sizeresolutionplot_type )
%
% will plot the 64 wanted bases. I will use “zero-padding“ for increased resolution
% NOTE THAT THESE ARE THE SAME baseS !
% for reference I plot the following 3 graphs:
% a) 3D plot with basic resolution (64 plots of 8x8 pixels) using “surf“ function
% b) 3D plot with x20 resolution (64 plots of 160x160 pixels) using “mesh“ function
% c) 2D plot with x10 resolution (64 plots of 80x80 pixels) using “mesh“ function
% d) 2D plot with x10 resolution (64 plots of 80x80 pixels) using “imshow“ function
%
% NOTE: matrix size of pictures (b)(c) and (d) can support higher frequency = higher bases
% but I am not asked to draw these (higher bases) in this section !
% the zero padding is used ONLY for resolution increase !
%
% get all base pictures (3D surface figure)
plot_bases( 81‘surf3d‘ );
% get all base pictures (3D surface figure) x20 resolution
plot_bases( 820‘mesh3d‘ );
% get all base pictures (2D mesh figure) x10 resolution
plot_bases( 810‘mesh2d‘ );
% get all base pictures (2D mesh figure) x10 resolution
plot_bases( 810‘gray2d‘ );
% ==================
% section 1.4 + 1.5
% ==================
% for each picture {‘0‘..‘9‘} perform a 2 dimensional dct on 8x8 blocks.
% save the dct inside a cell of the size: 10 cells of 128x128 matrix
% show for each picture it‘s dct 8x8 block transform.
for idx = 0:9
% load a picture
switch idx
case {01} input_image_128x128 = im2double( imread( sprintf( ‘%d.tif‘idx )‘tiff‘ ) );
otherwise input_image_128x128 = im2double( imread( sprintf( ‘%d.tif‘idx)‘jpeg‘ ) );
end
% perform DCT in 2 dimension over blocks of 8x8 in the given picture
dct_8x8_image_of_128x128{idx+1} = image_8x8_block_dct( input_image_128x128 );
if (mod(idx2)==0)
figure;
end
subplot(22mod(idx2)*2+1);
imshow(input_image_128x128);
title( sprintf(‘image #%d‘idx) );
subplot(22mod(idx2)*2+2);
imshow(dct_8x8_image_of_128x128{idx+1});
title( sprintf(‘8x8 DCT of image #%d‘idx) );
end
% ==================
% section 1.6
% ==================
% do statistics on the cell array of the dct transforms
% create a matrix of 8x8 that will describe the value of each “dct-base“
% over the transform of
相关资源
- 三相短路电流计算
- 标准合作型协同进化遗传算法matlab源
- 相移光栅matlab仿真程序,双相移点
- logistic映射代码MATLAB
- Matlab实现循环神经网络RNN
- matlab 心脏血管中心线提取
- matlab程序-产生FPGA仿真源数据
- Jakes模型matlab仿真验证过
- 单点定位matlab计算程序
- matlab编写的LBFGS优化算法
- 适合新手学习的简单遗传算法,matl
- FASTICA盲源信号分离代码Matlab(复信号
- 流形学习算法(matlab)
- matlab 分别用sobel prewitt roberts laplacia
- 文献和程序,光伏发电PV,MATLAB程序
- matlab图像分解四叉树分解显示
- 基于Matlab的二阶系统的模糊自适应P
- boost DC-DC变换器matlab仿真模型
- 基于MATLABGUI的语音信号特征提取系统
- matlab图像锐化源代码
- matlab迭代法自动阈值分割算法
- Matlab仿真_高勇.caj
- DBF的matlab仿真程序
- 生成地质体三维建模理论模型MATLAB
- 求取两个向量间欧氏距离MATLAB程序
- MATLAB实现股票价格预测 源程序代码
- 数字图像处理作业冈萨雷斯版源码M
- 用Matlab实现图像栅格化
- hough 检测直线、圆形matlab代码
- MATLAB计算长除法源码
评论
共有 条评论