【问题标题】:Get the pixels of the image with emgu cv使用 emgu cv 获取图像的像素
【发布时间】:2013-09-14 15:09:34
【问题描述】:

为了获取 OpenCV 中的像素,我使用以下代码:

for( int y=0; y<image->height; y++ ) {
            uchar* ptr = (uchar*) (image->imageData + y * image->widthStep);
            for( int x=0; x<image->width; x++ ) {
                 byteArray[y*image->widthStep+3*x] =  ptr[3*x];     
                  byteArray[y*image->widthStep+3*x+1] =  ptr[3*x+1];   
                   byteArray[y*image->widthStep+3*x+2] =  ptr[3*x+2]; 

            }
    }

但我不能在 EmguCV 中使用这样的代码:

for( int y=0; y<rgb32Image->MIplImage.height; y++ ) {
 unsigned char* ptr = (unsigned char*) (rgb32Image->MIplImage.imageData + y*rgb32Image->MIplImage.widthStep); 
 //error C2678: binary '+' : no operator found which takes a left-hand operand of type 'System::IntPtr' (or there is no acceptable conversion)

             for( int x=0; x<rgb32Image->MIplImage.widthStep; x++ ) {
                b[y*rgb32Image->MIplImage.widthStep+3*x] = ptr[3*x];     
                b[y*rgb32Image->MIplImage.widthStep+3*x+1] = ptr[3*x+1];  
                b[y*rgb32Image->MIplImage.widthStep+3*x+2] = ptr[3*x+2]; 

                }

        }

我应该使用什么来代替 MIplImage.imageData 在 Emgu CV 中获取图像的像素?

谢谢!

【问题讨论】:

    标签: c++ visual-c++ opencv emgucv


    【解决方案1】:

    您使用的是什么版本的 Emgu?我通常使用 Emgu 的 Image 类

    你可以从 图片.Bytes

    这里的文档: http://www.emgu.com/wiki/files/2.0.0.0/html/24efb2ef-4b77-68e5-c8cf-1395430b3666.htm

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-07-03
      • 2017-12-24
      • 1970-01-01
      • 1970-01-01
      • 2011-08-09
      • 2012-04-02
      • 2017-12-10
      • 2015-03-08
      相关资源
      最近更新 更多