Catching OpenCV errors

Hi all,

I am currently developing an application that uses opencv for facedetection. But in some cases new jpg files aren’t completly copied or corrupted on reading. I then
get an “opencv error” and then it quits. Is there any way to catch these errors?

It fails in: cvInitMatHeader with “incorrect size of input array”

any ideas?

that sounds like opencv is complaining that the image width/height/number of channels/bitdepth is different. check that the size of the image you’re loading with myImage.width and myImage.height, the bitdepth with myImage.depth, and the number of channels using myImage.type for each image, then just don’t pass on the broken ones to openCv.