女人为什么会得痔疮:图像的SVD分解 - 读书.生活.新知 - 歪酷博客 Ycool Blog
来源:百度文库 编辑:偶看新闻 时间:2024/04/29 01:16:41
feelfree @ 2007-04-01 20:47
% doSvd: Apply Singular Value Decomposition for an matrix data as an
% feature extraction method.
% [S] = doSvd(I, R) returns the approximated vector of
% singular values S (of USV) of the matrix I. The # of coefficients is
% reduced into R percent (such as 5).
%
% See also svd
% http://www.mathworks.com/access/helpdesk/help/techdoc/ref/svd.html
%
% Author : Naotoshi Seo
% First Edition : April, 2005
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [S] = doSvd(I, R)
% Testing
% I = imread('lena.png');
I = double(I);
if nargin < 2
R = 100;
end
S = svd(I);
DIM = floor(length(S)*(R*0.01));
S = S(1:DIM);
end
% doSvd: Apply Singular Value Decomposition for an matrix data as an
% feature extraction method.
% [S] = doSvd(I, R) returns the approximated vector of
% singular values S (of USV) of the matrix I. The # of coefficients is
% reduced into R percent (such as 5).
%
% See also svd
% http://www.mathworks.com/access/helpdesk/help/techdoc/ref/svd.html
%
% Author : Naotoshi Seo
% First Edition : April, 2005
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [S] = doSvd(I, R)
% Testing
% I = imread('lena.png');
I = double(I);
if nargin < 2
R = 100;
end
S = svd(I);
DIM = floor(length(S)*(R*0.01));
S = S(1:DIM);
end
function doSvdTest(percent) I = imread('lena.png'); [m n c] = size(I); I = double(I); R = I(:, :, 1); G = I(:, :, 2); B = I(:, :, 3); [RU, RS, RV] = svd(R); % TIPS: svd(R) returns diag(RS) because it is the most important [GU, GS, GV] = svd(G); [BU, BS, BV] = svd(B); RdS = diag(RS); GdS = diag(GS); BdS = diag(BS); D = length(RdS); DIM = floor(D*(percent*0.01)); RdS(DIM+1:end) = 0; % reduce dimensions GdS(DIM+1:end) = 0; BdS(DIM+1:end) = 0; RSR = sparse(1:D, 1:D, RdS, m, n); % reconstruct into matrix GSR = sparse(1:D, 1:D, GdS, m, n); BSR = sparse(1:D, 1:D, BdS, m, n); RR = RU * RSR * RV'; % recover GR = GU * GSR * GV'; BR = BU * BSR * BV'; IR = cat(3, RR, GR, BR); IR = uint8(IR); imshow(IR); imwrite(IR, sprintf('lenasvd%02d.png', percent), 'PNG'); end
ps: 这是一个日本人写的。很好!其实感觉日本人很务实的,他们不像美国人那样在对理论很执着,他们提出的很多算法,
工程性很强,比如著名的OTSU阈值分割算法。
读书、生活、新知是什么意思?
小学英语四年级下册生活 读书 新知 三联书店出版
三联,你觉得魅力何在?你了解三联"生活,读书,新知"吗?
“新知生活,独到见解”是哪个楼盘的广告语
新知台有个女主播长的和郭羡妮很像
读书后的生活是怎样的????
香港新知台;华娱台的网址?
好喜欢莫文蔚的妇女新知这首歌
香港有线新知台的一个节目
如何将SWF分解的动画转存成其他图像方式(如:GIF)
求SVD算法源代码.
贫困地区孩子们的读书生活是怎样的?
人的出生是为了什么?是生活?读书。。。。。?
思考乐的新知卡还能用吗
请问《青年参考》科学新知版的投稿信箱?谢谢!
减肥新知
宇宙新知
现在的人的生活都是什么样的啊,除了工作和读书~~
蛔虫的生活方式是什么?酵母菌靠分解葡萄糖生活这种生活方式属不属于"腐生",为什么?
什么数学方程式的图像可以从生活中找到实例 除了马鞍面
我想知道现在除了读书能生活的好点,还有干点别的什么能好点么
哪名言网 (分类的) 立志 读书 生活 生命……%
我读书少识字不多但又想记录下生活上喜欢的事情
分化分解的意思