0

I tried to train eigenfaces using knn. It trained but when I test it with new an image it gives me the error in findnearest function

cv2.error: D:\Build\OpenCV\opencv-3.2.0\modules\ml\src\knearest.cpp:325: error: (-215) test_samples.type() == CV_32F && test_samples.cols == samples.cols in function cv::ml::BruteForceImpl::findNearest

That's my function:

ret,id,neighbours,dist=knn.findNearest(S,cv2.ml.COL_SAMPLE,7)
threxx
  • 1,213
  • 1
  • 31
  • 59
Krishna Kamal
  • 751
  • 2
  • 10
  • 21

1 Answers1

0

it is probably an error in the typing of the variable S. I went through an error equal to that and decided to put the test case inside an array and it works to me.