I create ac# function that moves BitmapFrame picture to byte[] (using copypixels). Then I paste this buffer into c++ dll where it is uint8*. There is a structure in cpp
typedef struct
{
float r;
float g;
float b;
} pixel;
Is it possible to organize a loop for this uint8* buffer to get pixel-by pixel (for example by xy - height and width of image(this data I have too))? something like
for(i=0; i< height;i++)
{
for(j=0; j <width;j++)
{
SomeWorkWithPixelsfromUint8(i,j) //???
}
}
Where SomeWorkWithPixelsfromUint8(i,j) could operate RGB structure
So simple uint8 -> getPixel(x,y) ????
Assuming that your picture data have a layout like this
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
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.