Strange error with my thesis project

asked 2013-06-17 11:56:42 -0500

residentelvio gravatar image

updated 2013-06-17 13:26:29 -0500

berak gravatar image

Hi people.

I m working for a image processing proyect at my thesis work. I' m finishing my work time because I won a scholarship to do it in foreign country and if I don t finish it I have to give the money back. My teacher in this country doesn' understand what is the error and his assistent neither. I need to accomplish it. I can pay something if someone is able to finish the work. The error is :

  OpenCV Error: Bad flag (parameter or structure field) (Unrecognized or
  unsupported array type) in cvGetMat, file
  /build/buildd/opencv-2.3.1/modules/core/src/array.cpp, line 2482 terminate
  called after throwing an instance of 'cv::Exception' what():
  /build/buildd/opencv-2.3.1/modules/core/src/array.cpp:2482: error: (-206)
  Unrecognized or unsupported array type in function cvGetMat

I tried to text every function of my work and in everyone I have a similar error but with differents functions. I know I cant post the code. For this I didn t it. The proyect is around 400 lines, parenthesis and spaces included.

Sorry for my english

edit retag flag offensive close merge delete

Comments

3

whoa, dramatic intro ..

"(Unrecognized or unsupported array type)"

no idea if it helps, but in almost all cases, i've seen this error, it was due to an empty matrix. so check, where you load images(wrong path), get pics from the cam(no capture), where Mats are returned ,etc.

starting a debugger, and see, where it cries out, whould be the most obvious approach, btw..

berak gravatar imageberak ( 2013-06-17 13:09:46 -0500 )edit

ok I downloaded gdb as debugger in ubuntu, do you know any good manual explaining how to use it. P.S. thanks to correct my english

residentelvio gravatar imageresidentelvio ( 2013-06-17 15:06:20 -0500 )edit
1

first of all, 400 lines is not such much, so, if gdb is on another star for you, first try to sprinkle your code liberally with print statements like : cerr << m.rows << " " m.cols << " " << m.type() << " " m.channels() before applying that.

actually, it's some 7 years, since i last touched gdb, but wht i remember is:

compile with -g flag (enable debugging)

run:

gdb -q my_prog [args for my prog] --directory=folders_where_src_is:more_src_folders

man gdb // should give some more info

berak gravatar imageberak ( 2013-06-17 15:44:05 -0500 )edit

Ok i put my initial code (without inserting include, struct, namespace, etc...

  int main(int argc, char** argv){

        Mat img = imread("andaina.bmp");
        printf("r =%d , c= %d,t=%d, ch=%d",img.rows,img.cols,img.type(),img.channels());

I run and i have: r =0 , c= 0,t=0, ch=1 OpenCV Error: Bad flag (parameter or structure field) (Unrecognized or unsupported array type) in cvGetMat, file /build/buildd/opencv-2.3.1/modules/core/src/array.cpp, line 2482 terminate called after throwing an instance of 'cv::Exception' what(): /build/buildd/opencv-2.3.1/modules/core/src/array.cpp:2482: error: (-206)
Unrecognized or unsupported array type in function cvGetMat

residentelvio gravatar imageresidentelvio ( 2013-06-18 10:18:10 -0500 )edit
1

ah, so it could not read/find your image, and returned an empty one.

Mat img = imread("/home/lala/andaina.bmp"); // try an absolute path fo a change
if ( img.empty() ) { printf("empty img\n"); return -1}
berak gravatar imageberak ( 2013-06-18 12:05:05 -0500 )edit

Hi you had the reason. It doesn t read the image. Now it works. I printed all elements. I have just a doubt: r=486, c=648, type=16,channels=3,type=16,depth=0 Rows,cols and channels is ok. I m doubt about depth (doesn t have to return something different?) and type

residentelvio gravatar imageresidentelvio ( 2013-06-18 16:36:31 -0500 )edit
1

Hey there,I guess the depth must be in the enumerated form from OpenCV. As you say it returns zero, it means its a CV_8U image (i.e Each channel in image is 8 bit. Thus it must be 8bit 3channel image in your case) Somebody please correct me if i am wrong.

Prasanna gravatar imagePrasanna ( 2013-06-19 03:36:25 -0500 )edit

Prasanna, no you're right . thanks for jumping in ;)

berak gravatar imageberak ( 2013-06-19 04:38:29 -0500 )edit

where can I see all the enumerated form of openCV? tthanks to help me guys!

residentelvio gravatar imageresidentelvio ( 2013-06-19 08:41:28 -0500 )edit
1

opencv\modules\core\include\opencv2\core\core_c.h or

opencv\modules\core\include\opencv2\core\core.hpp

berak gravatar imageberak ( 2013-06-19 09:15:14 -0500 )edit