免费预览已结束,剩余1页可下载查看
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
一、实验目的实验六 图像压缩 (同预习)1、 理解有损压缩和无损压缩的概念;2、 理解图像压缩的主要原则和目的;3、 利用 MATLAB 程序进行图像压缩。二、实验内容1、Huffman 编码使用 mat2huff,huff2mat 实现 Huffman 编解码,并应用 imratio 计算编码后信号的压缩率。2、编写无损预测编解码(lossless predictive coding)程序,使 p313 Figure 8.7 (c) 图具有更低的熵(5.4436)。显示预测误差(prediction error)图。用解码程序解 码,并验证解码是否正确(compare)。3、参考p319-323,实现1616分块离散余弦(DCT)编码,用zigzag方式保留每一 块的前10个和前21个系数,再进行进行DCT解码。编写程序并分别显示解码 后的两个图。实验程序:实验1:i=imread(Fig0804(a)(Tracy).tif);i1=mat2huff(i);cr1=imratio(i,i1);%cr1,压缩率i2=huff2mat(i1);rmse1=compare(i,i2);figure,imshow(i);figure,imshow(i2);实验2:子程序1:function y = mat2lpc2(x, f)%本程序改自课本上那个程序,可实现更高压缩率!error(nargchk(1, 2, nargin); % Check input argumentsif nargin 2 % Set default filter if omitted f = 1; endx = double(x); % Ensure double for computationsm, n = size(x); % Get dimensions of input matrixp = zeros(m, n); % Init linear prediction to 0xs = x; zc = zeros(1,n); % Prepare for input shift and padfor j = 1:length(f) % For each filter coefficient . xs = zc; xs(1:end - 1,:); % Shift and zero pad xga改加一行 p = p + f(j) * xs; % Form partial prediction sumsendy = x - round(p); % Compute the prediction error子程序2:function x = lpc2mat2(y, f)% 本程序改自课本上那个程序,可以解压error(nargchk(1, 2, nargin); % Check input argumentsif nargin 2 % Set default filter if omitted f = 1; endy=y;f = f(end:-1:1); % Reverse the filter coefficientsm, n = size(y); % Get dimensions of output matrixorder = length(f); % Get order of linear predictorf = repmat(f, m, 1); % Duplicate filter for vectorizingx = zeros(m, n + order); % Pad for 1st order column decodes% Decode the output one column at a time. Compute a prediction based% on the order previous elements and add it to the prediction% error. The result is appended to the output matrix being built.for j = 1:n jj = j + order; x(:, jj) = y(:, j) + round(sum(f(:, order:-1:1) .* . x(:, (jj - 1):-1:(jj - order), 2);endx = x(:, order + 1:end); % Remove left paddingx=x;总程序:f=imread(Fig0807(c)(Aligned).tif);e=mat2lpc2(f);figure,imshow(mat2gray(e);h=entropy(e);c=lpc2mat2(e);figure,imshow(c,);rmse=compare(f,c);实验三:i=imread(Fig0804(a)(Tracy).tif);i=im2double(i);mask1=1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ;mask2=1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ;T=dctmtx(16);B=blkproc(i,16 16,P1*x*P2,T,T);i1=b
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年二级建造师矿业工程实务考试模拟试题试卷
- 2025年二手车电商交易平台建设项目可行性研究报告及总结分析
- 2025年安全饮水工程建设项目可行性研究报告及总结分析
- 2025年跨境旅游项目可行性研究报告及总结分析
- 2026年高校教师资格证题库500道附参考答案【满分必刷】
- 理财经理岗位职责-5
- 2025年医疗器械创新产品开发项目可行性研究报告及总结分析
- 2025年全国性电子商务交易平台建设项目可行性研究报告及总结分析
- 2025年云计算技术在教育中的应用可行性研究报告及总结分析
- 2025年度二手车质押典当评估与鉴定服务合同
- 第六单元 资本主义制度的初步确立 复习课件 2024-2025学年统编版九年级历史上册
- DB11T 678-2023 畜禽场鼠害控制与效果评价
- 2024年中国骨关节炎诊疗指南解读课件
- 动物繁殖学:妊娠
- 排球《正面上手发球》教案
- JJG 621-2012 液压千斤顶行业标准
- 质量管理课程-Weibull分布
- 普华永道品牌管理课件
- 2024年促进信息技术领域的新突破
- (完整版)完整三角函数公式表
- 幼儿阿拉伯数字描红(0-100)打印版
评论
0/150
提交评论