shaileshmulange / javacv

Automatically exported from code.google.com/p/javacv
GNU General Public License v2.0
0 stars 0 forks source link

cvSetImageROI + cvCopy produce ROI with incorrect Colour mode #303

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

IplImage frame, image;
CvRect face = CvRect(...);

cvSetImageROI(frame, face);
image = cvCreateImage(cvGetSize(frame), frame.depth(), frame.nChannels());
cvCopy(frame, image);
cvResetImageROI(frame); 

What is the expected output? What do you see instead?

It is expected that image now contains basically a cropped image, with same 
colour mode, etc.

What is produced is the correctly sized image, but with a different colour mode.

What version of the product are you using? On what operating system?

java-0.1-bin.zip
OpenCV 2.4.0

Mac OSX Lion

Please provide any additional information below.

While debugging I grabbed the pixel of the top left of the CvRect, to examine 
it, and received the following:

frame BGRA = {99,78,83,255}
image BGRA = {78,83,0,255}

these results were consistent no matter how long I ran it for. It looks like 
the G channel has become the B channel, the R has become the G, and the B has 
disappeared, making the new R 0.

Original issue reported on code.google.com by thomasdu...@gmail.com on 20 Jul 2012 at 1:06