I have a 2D numpy array. Lets consider the following example
[[0,6,89,255,1,6,7]
[0,255,89,255,1,1,7]
[255,255,255,255,255,255,255]
[1,2,3,4,5,6,7]
[1,1,255,5,7,3,255]]
We need the coordinates of the box around a certain value. For example for value 255 the coordinates of the box around the value 255 will be upper left(0,0) and lower right (4,6).
How to do it efficiently in python.
Thanks a lot.