Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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. That is, the intense red ones only.

prediction_image

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)

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. top-left corner. That is, the intense red ones only.

prediction_image

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)