Hi,

I try to develop some code in opencv in the pix_opencv's style. To  
start, I tried to convert rgba to gray using opencv ( cvCvtColor(orig,  
gray, CV_BGRA2GRAY); )

but I can't get a gray picture of the same size at the output. If I  
just copy the gray image, I get just 4 small gray copy of the original  
on one line on the top of the image.

If I try to convert from grey to rgba before to output the data, I get  
a monochrome but yellow picture.

I wonder if there's a relation with the fact that I am working on a  
mac, is it possible ? because of a difference coding of rgba on mac  
and others?

do someone know how I can solve this?

here is the code of the one which give me a yellow monochromatic  
picture:

///////////////// processImage /////////////////////////
void pix_opencv_mytest :: processRGBAImage(imageStruct &image) {
   if ((this->comp_xsize!=image.xsize)||(this->comp_ysize! 
=image.ysize)||(!orig)) {
        this->comp_xsize = image.xsize;         this->comp_ysize = image.ysize;

        cvReleaseImage(&orig);                  cvReleaseImage(&gray);          
 
cvReleaseImage(&bob);                   

                //create the orig image with new size
         orig = cvCreateImage(cvSize(image.xsize,image.ysize),  
IPL_DEPTH_8U, 4);
        gray = cvCreateImage(cvSize(orig->width,orig->height),  
IPL_DEPTH_8U, 1);
                        
     }
     // Here we make a copy of the pixel data from image to orig- 
 >imageData, orig is a IplImage struct
            memcpy( orig->imageData, image.data, image.xsize*image.ysize*4 );
                cvCvtColor(orig, gray, CV_BGRA2GRAY);  // Convert to grayscale  
        
        
        cvCvtColor(gray, orig, CV_GRAY2BGRA);
     //copy back the processed frame to image
     memcpy( image.data, orig->imageData, image.xsize*image.ysize*4 );

}


thanks,
loic

_______________________________________________
Pd-dev mailing list
[email protected]
http://lists.puredata.info/listinfo/pd-dev

Reply via email to