I am trying to get the RGB value of each pixel in WinRT app. I can access an array of bytes containing PixelData
but I don\'t know how to work with that so how
Since you have a RGB image, tempBuffer[k + 0]
is the red channel, tempBuffer[k + 1]
is the green channel, and tempBuffer[k + 2]
is the blue channel, i.e. tempBuffer
is a 1D array. If you were looping over all the pixels, the pseudo code for this would be:
for i = 0 to height - 1
for j = 0 to width - 1
k = (i * width + j) * 3
r, g, b = tempBuffer[k + 0], tempBuffer[k + 1], tempBuffer[k + 2]