MATLAB: Can PCA be applied directly on an image

image processingMATLABpca

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

Best Answer

Apply it to im2double() of the image.