The matrix is not continuous... got an error when executing face recognition from video

asked 2013-07-25 04:20:30 -0600

Babbling gravatar image

Hi, I am new to OpenCV and I am following the tutorial (http://docs.opencv.org/modules/contrib/doc/facerec/tutorial/facerec_video_recognition.html?) to make a face recognition from the webcamera.

After I used the following command, I got the error

"./Facerec_Video '/root/Documents/Facial_Recgonition/opencv/libfacerec/samples/New/haarcascade_frontalface_default.xml' '/root/Documents/Facial_Recgonition/opencv/libfacerec/samples/New/data.csv' /dev/video0"

Facerec_Video is the executable file and the following three arguments are Haarcascade file, CSV file, and my webcamera.

OpenCV Error: Image step is wrong (The matrix is not continuous, thus its number of rows can not be changed) in reshape, file /build/opencv/src/opencv-2.4.6.1/modules/core/src/matrix.cpp, line 802 terminate called after throwing an instance of 'cv::Exception' what(): /build/opencv/src/opencv-2.4.6.1/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)

I used the AT&T database and the CSV file and source code copied from the tutorial. Can anyone give me some clues? Thank you.

edit retag flag offensive close merge delete

Comments

could you debug it a bit / throw in some print statements, to find out , where it happens ? (my guess would be the predict() method)

did you modify the code in one way or another ?

berak gravatar imageberak ( 2013-07-25 08:55:24 -0600 )edit

In JavaCv 4.5, there is a bug in the CvMat.isContinuous function that applies a mask to the results of calling type() which itself applies a mask to raw_type losing the bit that indicates the matrix is continuous.

i.e. public boolean isContinuous() { return opencv_core.CV_IS_MAT_CONT(type()); }

Perhaps the same problem exists in the C++ source

Dave Employed gravatar imageDave Employed ( 2013-12-03 16:46:19 -0600 )edit

Same problem and I have tried some solutions in the forum. The error is in model.train() line of the tutorial. I have tried with parameters in createFisherRecognizer, also converting images to pgm and nothin changes.

marilia15 gravatar imagemarilia15 ( 2015-10-14 14:25:04 -0600 )edit

please check, if you got some non-image file in there. (if so, just remove it)

again - imread() will just return silently with an empty (non-valid, not-continous Mat) in this case.

berak gravatar imageberak ( 2015-10-14 14:32:54 -0600 )edit