Thursday, February 21, 2008

Bug in OpenCV

I wanted to capture an image from the web cam and convert that to gray scale in my application. I use openCV to do that. But when I directly convert the captured image to gray scale it returned a horizontally flip gray image of the original. but if I load an image using cvLoadImage() and then convert it to gray scale there was no problem. No flipping is involved. I think this was a bug in openCV. Correct me if I am wrong.

here is the code that cause the flipping,

CvCapture* capture = cvCaptureFromCAM( CV_CAP_ANY );
IplImage* frame = cvQueryFrame( capture );

IplImage* gray = cvCreateImage( cvGetSize(frame), 8, 1 );
cvCvtColor( frame, gray, CV_BGR2GRAY );

No comments: