1

Using Histogram of Ordered Gradients (HoG) I have computed features of 15 sample images. The feature vectors generated by these samples are very large (i.e. take up a lot of memory).

To reduce these feature vectors, i am using Principal Component Analysis (PCA). Here is the OpenCV code I am using:

PCA pca(imageT, Mat(), CV_PCA_DATA_AS_ROW, 300);
pca.project(imageT, imageT1);

In imageT Matrix, no.of row =no. of sample no. of coloumns = no. of features Suppose for 15 images
no.of row of imageT is 15 and no. of coloumn is 57400

I want 300 features after applying PCA; it gives me less than 15 features. I need help.

See also

benten
  • 1,995
  • 2
  • 23
  • 38
Yasir Kamran
  • 11
  • 1
  • 3
  • Try using the percent of variance (e.g. 0.95) for the last argument (instead of 300). It could be that there is a lot of redundancy in your data and there are are not more than a handful of eigenvectors with non-zero eigenvalues. – chappjc Apr 15 '15 at 18:08
  • 2
    you can't get more eigenvectors than you have trainfeatures. if you want to shorten your feature vectors to 300, (that means: 300 eigenvectors, think of how the projection works), you need 300+ feature vecs. – berak Apr 15 '15 at 19:03
  • 1
    In you case maximum number of eigentvectors you can get is 15. This is because you have 15 images. If you more than 300 images than it will give you that many eigenvectors – Jai Dec 24 '17 at 17:09

1 Answers1

0

You need to use more images for training. PCA captures variances that are orthogonal to each other. More data gives it the ability to find more basis vectors.

Nav
  • 19,885
  • 27
  • 92
  • 135