Find screen space coordinate where color is detected

How could I get the X and Y coordinates of all pixels of a specified color, either on screen or from a texture?

I see that Rama’s Victory Plugin has a node called Get Pixels Array from T2D which is almost perfect, except I have no way of getting the coordinates of each pixel.

Thank you
image

I don’t have this plugin, but check If Rama outputs sorted array. It is very likely that array is arranged in some way, for example from left to right, from top to bottom. If so you should quite easily get desired coords with simple calculations based on texture width and height.

Thank you so much for the reply! I primarily work in Blueprints and am not great with C++, so I’m not really sure where I could start with identifying that stuff. I’m hoping to find a Blueprint solution or something pre-written

You can try it in BP.
Let’s say I have this tiny texture of size 4x4. This is a texture pixels coordinates (x,y)

0,0 | 0,1 | 0,2 | 0,3
1,0 | 1,1 | 1,2 | 1,3
2,0 | 2,1 | 2,2 | 2,3
3,0 | 3,1 | 3,2 | 3,3

As you can see the last coord of X axis is TextureWidth-1 and last coord of Y-Axis is TextureHeight-1

Now, assuming the PixelArray in Rama’s node is sorted if you get the index 0 of the array it’s coordinates would be (0,0), index 1 is (0,1) index 5 is (1,0) and so on.

This is made on assumption of a perticular order in Rama’s array, so first of all you should either test it yourself if it’s true, or just ask Rama about order of pixels in this array.

BTW, why do you need that?

That is a brilliant idea, and I think you’re right. It appears that the first index in the array is the top left corner of the image, while the last index in the array is the bottom right corner of the array. I should be able to do a calculation for this.

I’m building a system to train a machine learning model. I have used custom depth to render just the outline around an object, now I need to calculate the X and Y screen space coordinates of each pixel of the outline.