Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Facial recognition run error: Image step is wrong

I am a beginner in opencv and using opencv 2.4.13.6 for facial recognition. For this, i am following the official documentation of the opencv. The link to the tutorial is:

https://docs.opencv.org/2.4/modules/contrib/doc/facerec/tutorial/facerec_video_recognition.html

The tutorial uses the fisherface algorithm. So firstly, i collected some frontal face photos of a person then, used the create_csv.py code given in the tutorial to make the csv file from the command prompt. The output returned by the command prompt, i copied them and saved to a text file named 'Face'.

Then i copied the code from the tutorial.

Then, i built the solution(i am using visual studio 2017). after the solution was built, I opened the command prompt from the location where the exe file was created. and typed the following:

D:\Face Recognition\x64\Debug>Face_Recognition.exe C:\old_opencv\opencv\sources\data\haarcascades\haarcascade_frontalface_default.xml D:\Face.txt 0

but a pop window appeared which said '' DEBUG ERROR!! program D:\Face Recognition\x64\Debug\Face_Recognition.exe abort() has been called (Please retry to debug the application)." and the command prompt also said:

"OpenCV Error: Image step is wrong (The matrix is not continuous, thus its number of rows can not be changed) in cv::Mat::reshape, file C:\build\2_4_winpack-build-win64-vc14\opencv\modules\core\src\matrix.cpp, line 812"

image description

i searched for the solution on google and found out one solution. it said i needed to replace the line 30 of the code i.e.

images.push_back (imread(path,0));

with

Mat m = imread(path,1); Mat m2; cvtColor(m,m2,CV_BGR_GRAY); images.push_back(m2);

Thats why i replaced the line in visual studio but the visual studio says CV_BGR_GRAY: no such identifier and didnot build. i need help of what is going on and how do i fix it?

click to hide/show revision 2
None

updated 2018-03-02 04:50:11 -0600

berak gravatar image

Facial recognition run error: Image step is wrong

I am a beginner in opencv and using opencv 2.4.13.6 for facial recognition. For this, i am following the official documentation of the opencv. The link to the tutorial is:

https://docs.opencv.org/2.4/modules/contrib/doc/facerec/tutorial/facerec_video_recognition.html

The tutorial uses the fisherface algorithm. So firstly, i collected some frontal face photos of a person then, used the create_csv.py code given in the tutorial to make the csv file from the command prompt. The output returned by the command prompt, i copied them and saved to a text file named 'Face'.

Then i copied the code from the tutorial.

Then, i built the solution(i am using visual studio 2017). after the solution was built, I opened the command prompt from the location where the exe file was created. and typed the following:

D:\Face Recognition\x64\Debug>Face_Recognition.exe C:\old_opencv\opencv\sources\data\haarcascades\haarcascade_frontalface_default.xml D:\Face.txt 0

but a pop window appeared which said '' DEBUG ERROR!! program D:\Face Recognition\x64\Debug\Face_Recognition.exe abort() has been called (Please retry to debug the application)." and the command prompt also said:

"OpenCV Error: Image step is wrong (The matrix is not continuous, thus its number of rows can not be changed) in cv::Mat::reshape, file C:\build\2_4_winpack-build-win64-vc14\opencv\modules\core\src\matrix.cpp, line 812"

image description

i searched for the solution on google and found out one solution. it said i needed to replace the line 30 of the code i.e.

images.push_back (imread(path,0));

with

Mat m = imread(path,1); Mat m2; cvtColor(m,m2,CV_BGR_GRAY); images.push_back(m2);

Thats why i replaced the line in visual studio but the visual studio says CV_BGR_GRAY: no such identifier and didnot build. i need help of what is going on and how do i fix it?