longldt / javacv

Automatically exported from code.google.com/p/javacv
GNU General Public License v2.0
0 stars 0 forks source link

Getting problem in recognizing face using Facerecognizer Class in Javacc #368

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

I am using FaceRecognizer by creating its instance by following line of code:-
FaceRecognizer faceRecognizer = createFisherFaceRecognizer();

Now I get the following exception at this piece of code 

Code : 
faceRecognizer.predict(MY_IPL_IMAGE);

Exception :
OpenCV Error: Image step is wrong (The matrix is not continuous, thus its 
number of rows can not be changed) in unknown function, file 
..\..\..\src\opencv\modules\core\src\matrix.cpp, line 802
Exception in thread "pool-1-thread-4" java.lang.RuntimeException: 
..\..\..\src\opencv\modules\core\src\matrix.cpp:802: error: (-13) The matrix is 
not continuous, thus its number of rows can not be changed.

However, If I use LBPH for facerecognizer, it works without any error and 
recognizes the face :-
FaceRecognizer faceRecognizer = createLBPHFaceRecognizer(); 

I am using JavaCv 0.6 and OpenCV 2.4.6 for code.

Original issue reported on code.google.com by naval.ga...@paxcel.net on 2 Oct 2013 at 11:26

GoogleCodeExporter commented 8 years ago
Could you please post the content of the String object returned by 
MY_IPL_IMAGE.toString()? Thanks

Original comment by samuel.a...@gmail.com on 2 Oct 2013 at 11:48

GoogleCodeExporter commented 8 years ago
Hi Samuel,

Here is the toString of the IplImage object I am passing to the method

IplImage[width=125,height=150,depth=8,nChannels=1]

And attached is the one of images which I am using for training the recognizer.

Original comment by naval.ga...@paxcel.net on 2 Oct 2013 at 11:53

Attachments:

GoogleCodeExporter commented 8 years ago
Looks alright, but not many software work with image widths that are not 
multiples of 8 or 16, so you should try 128x150 images...

Original comment by samuel.a...@gmail.com on 2 Oct 2013 at 12:50

GoogleCodeExporter commented 8 years ago
Hi Samuel,

Got it working...Thanks alot.

However, I have noticed that the prediction is 70% accurate in either of 
EigenFace, FisherFace or LBPH.

Some time the result predicts me as one of the girl whose image I am using for 
training, Can I do something else to solidify the result of the class?

Original comment by naval.ga...@paxcel.net on 2 Oct 2013 at 2:48

GoogleCodeExporter commented 8 years ago
70% sounds good..

In any case, please report upstream at 
http://code.opencv.org/projects/opencv/issues the issue concerning the image 
width and post a link here, thanks!

Original comment by samuel.a...@gmail.com on 3 Oct 2013 at 2:17

GoogleCodeExporter commented 8 years ago
As suggested, i have raised the issue to opencv and the bug is reported under

http://code.opencv.org/issues/3299

Original comment by naval.ga...@paxcel.net on 3 Oct 2013 at 11:53

GoogleCodeExporter commented 8 years ago
Great! Thanks!

Original comment by samuel.a...@gmail.com on 3 Oct 2013 at 12:01

GoogleCodeExporter commented 8 years ago
Since this is an issue with OpenCV, there is nothing to be done in JavaCV, 
which will work fine when the upstream is fixed, so I'll switch the status to 
"Done" if this is alright with you. In any case, thanks for reporting!

Original comment by samuel.a...@gmail.com on 19 Jan 2014 at 7:12

GoogleCodeExporter commented 8 years ago
I changed the dimensions to 128x150. Yet I am getting the same error.
OpenCV Error: Image step is wrong (The matrix is not continuous, thus its 
number of rows can not be changed) in reshape, file 
/build/buildd/opencv-2.4.9+dfsg/modules/core/src/matrix.cpp, line 802
terminate called after throwing an instance of 'cv::Exception'
  what():  /build/buildd/opencv-2.4.9+dfsg/modules/core/src/matrix.cpp:802: error: (-13) The matrix is not continuous, thus its number of rows can not be changed in function reshape

Aborted (core dumped)

Original comment by jain.bha...@gmail.com on 27 Jan 2015 at 4:32

GoogleCodeExporter commented 8 years ago
Hi Jain,

Could you please compare the content of the String object returned by 
MY_IPL_IMAGE.toString() with the the content of my object?

Original comment by naval.ga...@paxcel.net on 28 Jan 2015 at 5:22