在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
clear all; close all; clc; img1=imread('Corner.png'); img2=imread('Corner1.png'); img3=imread('Corner2.png'); img1=imresize(img1,[35 90]); %Matlab的svd不支持太大的数据,我把数据变小了. img2=imresize(img2,[35 90]); img3=imresize(img3,[35 90]); [height width]=size(img2); a=reshape(double(img1),1,35*90); b=reshape(double(img2),1,35*90); c=reshape(double(img3),1,35*90); ma=mean(a); mb=mean(b); mc=mean(c); a=a-ma; b=b-mb; c=c-mc; x=[a' b' c']; x=double(x); %y=x'*x/(height*width); %[v d]=eig(y); [u s w]=svd(x); %w相当于排序后的d,用svd就不用求x'*x了 ed=x*w;%v; img4=zeros(height,width); img4=reshape(ed(:,1),height,width); img5=zeros(height,width); img5=reshape(ed(:,2),height,width); img6=zeros(height,width); img6=reshape(ed(:,3),height,width); imshow(mat2gray(img4)); figure,imshow(mat2gray(img5)); figure,imshow(mat2gray(img6)); 参考: 1.http://iiec.cqu.edu.cn/wiki/index.php/SVD%E4%B8%8EPCA%E7%9A%84%E7%93%9C%E8%91%9B |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论