How do i use pca on image?

6 vues (au cours des 30 derniers jours)
farahnaz
farahnaz le 22 Mar 2014
Commenté : Image Analyst le 22 Mar 2014
is this code correct? ...................................................
function [signals,PC,V] = pca() I=imread('G:\Users\farahnaz\Downloads\018.jpg'); b= im2double(I); imshow(b, []); [irow, icol] = size(b); data = reshape(b',irow*icol,1);
[M,N] = size(data);
mn = mean(data,2);
data = data - repmat(mn,1,N);
covariance = cov(data)';
[PC, V] = eig(covariance);
V = diag(V);
[junk, rindices] = sort(-1*V);
V = V(rindices); PC = PC(:,rindices);

Réponses (0)

Catégories

En savoir plus sur Dimensionality Reduction and Feature Extraction dans Help Center et File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by