I am trying to generate a bounding box for object detection in an image. I read the image and generate a binary 2d numpy array such as:
array([[0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0],
[0, 0, 1, 1, 0, 0],
[0, 0, 1, 1, 0, 0],
[0, 0, 1, 1, 0, 0],
[0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0]])
The 1 represent pixels that are to be within the bounding box in the image. How can I get the x,y coordinates of the top left point, and then the length of x,y?