Can PCA be applied directly on an image?

4 views (last 30 days)
Can PCA be applied directly on an image, in contrast to a matrix(in which rows correspond to observations & columns to variables)?
When i try to apply PCA using SVD/Covariance directly on an image i get the following error:
"Error using minus
Integers can only be combined with integers of same class or scalar doubles.
Error in pca2 at 14
data=data-repmat(mn,1,N);"
Thanking you in advance
  2 Comments
Algorithms Analyst
Algorithms Analyst on 13 Nov 2013
Check ur image type should be double date try.
sidra
sidra on 14 Nov 2013
Algorithms Analyst ,the image type is double.

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 14 Nov 2013
Apply it to im2double() of the image.

More Answers (1)

sidra
sidra on 18 Nov 2013
Walter, it works fine for a single image but when i try the same on array of images i get the error :
"Array dimensions must match for binary array op.
error in pca2 at 14
data=data-repmat(mn,1,N);
error in db.pca at 18
pc=pca2(imagearray);"

Categories

Find more on Dimensionality Reduction and Feature Extraction in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!