Hello everybody!
I am facing a problem, on which I would like to get some input on from some of the experts in this forum
I have a binary image (basically a mask) so a pixel is either black or white (
Example). Now i want to get the coordinates of all the white pixel, to use them as positions for some sprites. The only thing I can think of is something like this (pseudocode):
for(x = 0; x <= width; x++)
for(y = 0; y <= height; y++)
if(image[x][y] == white)
whitepixels.push_back(pair(x,y));
But this seems very chuncky and inefficient to me, because the binary image is fairly big and it's updated every frame. So my question is, is there a more efficient or optimized way to do this? I basically want to use the white parts of the binary image to draw stuff there.
Thanks in advance, Foaly