Getting the coordinates of intense non-black pixels
I have the below image as an output of my prediction function (of a DCNN model) and now I'd like to get the pixel coordinates of the detected entities (most red pixels). Is there a quick way to achieve that? It's a bit tricky because I would like to get the salient red pixels, not the ones that are "kinda red" on top-left corner. That is, the intense red ones only.
I have the image in the following Python format:
array([[[3, 0, 0],
[0, 0, 0],
[0, 0, 0],
...,
[0, 0, 0],
[0, 0, 0],
[0, 0, 0]],
[[1, 0, 0],
[0, 0, 0],
[0, 0, 0],
...,
[0, 0, 0],
[0, 0, 0],
[0, 0, 0]],
[[1, 0, 0],
[0, 0, 0],
[0, 0, 0],
...,
[0, 0, 0],
[0, 0, 0],
[0, 0, 0]],
...,
[[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
...,
[0, 0, 0],
[0, 0, 0],
[0, 0, 0]],
[[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
...,
[0, 0, 0],
[0, 0, 0],
[0, 0, 0]],
[[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
...,
[1, 0, 0],
[1, 0, 0],
[3, 0, 0]]], dtype=uint8)
How about thresholding that image and cutting off all pixels below, say, 250? You will have only the real red ones left.