Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/image-processing/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 从uint8 c+;获取RGB像素值+;_C++_Image Processing - Fatal编程技术网

C++ 从uint8 c+;获取RGB像素值+;

C++ 从uint8 c+;获取RGB像素值+;,c++,image-processing,C++,Image Processing,我创建了一个c#函数,该函数将BitmapFrame图片移动到字节[](使用copypixels)。然后我把这个缓冲区粘贴到C++ DLL,在这里是UIT8*。cpp中有一个结构 typedef struct { float r; float g; float b; } pixel; 是否可以为这个uint8*缓冲区组织一个循环,以逐像素(例如,通过x y-图像的高度和宽度(我也有这个数据))获取? 差不多 for(i=0; i< height;i++) {

我创建了一个c#函数,该函数将BitmapFrame图片移动到字节[](使用copypixels)。然后我把这个缓冲区粘贴到C++ DLL,在这里是UIT8*。cpp中有一个结构

typedef struct  
{
    float r;
    float g;
    float b;
} pixel;
是否可以为这个uint8*缓冲区组织一个循环,以逐像素(例如,通过x y-图像的高度和宽度(我也有这个数据))获取? 差不多

for(i=0; i< height;i++)
{
for(j=0; j <width;j++)
{
   SomeWorkWithPixelsfromUint8(i,j) //???
}
}
for(i=0;i对于(j=0;j getPixel(x,y)??

假设图片数据具有如下布局

  • 像素是每个扫描线的扫描线,从左到右
  • 一个像素压缩为RGB,或最终压缩为RGBA
  • 每像素使用像素大小字节(如果使用alpha通道,可能为3,可能为4)

uint8_t*picData=。。。;
uint8_t*像素=微微数据;
对于(int i=0;i


假设您的图片数据具有如下布局

  • 像素是每个扫描线的扫描线,从左到右
  • 一个像素压缩为RGB,或最终压缩为RGBA
  • 每像素使用像素大小字节(如果使用alpha通道,可能为3,可能为4)

uint8_t*picData=。。。;
uint8_t*像素=微微数据;
对于(int i=0;i


你在用什么图书馆?没有图书馆。我试着自己写=)如果你问C++的DLL——这也是我的代码。我正在尝试连接这三个-Trimes—RGB +像素(有RGB)。+像素缓冲区表示整个像素的单个
uint8
,或者红色、绿色和蓝色分量都是
uint8
?您如何包装rgb值?Blagovest Buyukliev-不,这适用于所有像素和图片Daniel a的跨步。白色-像素操作(int x、int y、uint8 inputBuffer){uint8 buffer=inputBuffer;点p;p.x=x;p.y=y;Rect rec;rec.xBottomLeft=0.f;rec.yBottomLeft=0.f;rec.width=buffer->width;rec.height=buffer->height;}你在用什么图书馆?没有图书馆。我试着写我自己的=)如果你问C++的DLL——这也是我的代码。我正在尝试连接这三个-Trimes—RGB +像素(有RGB)。+像素缓冲区表示整个像素的单个
uint8
,或者红色、绿色和蓝色分量都是
uint8
?您如何包装rgb值?Blagovest Buyukliev-不,这适用于所有像素和图片Daniel a的跨步。白色-像素操作(int x、int y、uint8 inputBuffer){uint8 buffer=inputBuffer;点p;p.x=x;p.y=y;Rect rec;rec.xBottomLeft=0.f;rec.yBottomLeft=0.f;rec.width=buffer->width;rec.height=buffer->height;}
uint8_t* picData = ...;

uint8_t* pixel = picData;
for(int i = 0; i < height; ++i) {
  for(int j = 0; j < width; ++j, pixel += pixelSize) {
       float r = pixel[0];
       float g = pixel[1];
       float b = pixel[2];
       // Do something with r, g, b
  }
}