matlabsvd提取特征值_在MATLAB中使用SVD压缩图像

本文档展示了如何在MATLAB中使用Singular Value Decomposition(SVD)来压缩图像并提取特征值。通过保留不同数量的奇异值,对图像进行重构,并分析随着奇异值数量增加,图像重构误差的变化。结果显示,大约200个奇异值可以实现几乎无损的图像压缩。
摘要由CSDN通过智能技术生成

尽管这个问题很旧,但它对我理解SVD有所帮助。我已经修改了您在问题中编写的代码,以使其正常工作。

我相信您可能已经解决了该问题,但是,仅供以后访问此页面的任何人参考,我将在此处包括完整的代码以及输出图像和图形。

下面是代码:

close all

clear all

clc

%reading and converting the image

inImage=imread('fruits.jpg');

inImage=rgb2gray(inImage);

inImageD=double(inImage);

% decomposing the image using singular value decomposition

[U,S,V]=svd(inImageD);

% Using different number of singular values (diagonal of S) to compress and

% reconstruct the image

dispEr = [];

numSVals = [];

for N=5:25:300

% store the singular values in a temporary var

C = S;

% discard the diagonal values not required for compression

C(N+1:end,:)=0;

C(:,N+1:end)=0;

% Construct an Image using the selected singu

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值