0
votes

sorry for my english..

i'm new to opencv, and i want to try samples square.cpp,i used codeblocks on ubuntu.

but i got error when i compiled and run it, it said that (on Xterm):

opencv error : bad argument (bad image header) in cvCloneImage file build/buildd/opencv-2.1.0/src/cxcore/cxarray.cpp, line 3122

so, my question is, how to fix it?

thanks.

1
Does it happen with newer versions too? 2.1.0 is a little old. 2.4.1 is the latest.Mohammad
okay, i'll try it, thanks for your response.Faqih

1 Answers

0
votes

It may contain some code which is using some input images. The important thing is that those input images might not be null.

This error comes in cxarray.cpp where we have the code like if (!CV_IS_IMAGE_HDR(src)). Now if you check for the definition of this

#define CV_IS_IMAGE_HDR 

You will get it as:

((img) != NULL && ((const IplImage*)(img))->nSize == sizeof(IplImage)) 

The first thing it checks is for null image. So in your case you might not have the input image with you. Select a input image you have and then try again. It will work, as it have worked for me.