I want to reduce the dimension of image from (480,640,3) to (1,512) by PCA in sklearn. So I reshape the image to (1, 921600). After then, I perform pca to reduce the dimension. But it changes to (1,1) instead of (1,512)
>>> img.shape
(1, 921600)
>>> pca = PCA(n_components=512)
>>> pca.fit_transform(img).shape
(1, 1)
Could anyone tell me how to reduce the dimension of a single image? Thanks