3

I am using PointGrey GIGe Camera and their FlyCapture SDK to read the camera frames. Then I use OpenCV to track objects seen by the camera. However, my application crashes (no error) whenever the camshift() OpenCV function is called. I tried to read the images from a video file recorded using the same camera, and it works fine. So my suspicion is that there is something fishy going on in the conversion of camera frames from FlyCapture format to OpenCV image format. Here is how I do the conversion:

IplImage* img;
fc2Image convertedImage;

// here I load a frame into convertedImage (converted from RAW8 to RGB)
...

// here I convert to opencv IplImage
memcpy(img->imageData, convertedImage.pData, convertedImage.dataSize);

Whenever I feed the img variable to my code, the camshift() call crashes my program. Anybody experienced this before? Many thanks!

pkout
  • 6,430
  • 2
  • 45
  • 55
  • Did you call cvCreateImage to create the image header and allocate memory for the image data? Can you try to show the CONVERTED image and check your conversion worked fine or not? – james Feb 16 '12 at 15:58
  • Does you data in convertedImage are aligned ? – Adrien BARRAL Feb 16 '12 at 15:59
  • Yes, I should have mentioned it - I did call cvCreateImage to allocate my img variable. I am even able to show the image on the screen using cvShowImage(). Only camshift() crashes. It doesn't crash when I feed it from a video file taken by the same camera. – pkout Feb 16 '12 at 16:11
  • Abarral, what do you mean by "aligned"? This sounds promising. – pkout Feb 16 '12 at 16:11

0 Answers0