Bounding box using MATLAB for the image

后端 未结 4 783
南方客
南方客 2021-01-14 09:05

I am trying to draw a bounding box around the white blob in the image below:

\"enter

4条回答
  •  时光说笑
    2021-01-14 09:19

    Pseduo -

    • Pick largest y, largest x, smallest x, smallest y with in the blob. That is, points on the blob. These are your coordinates that you can use to build the bounding box.

    assuming top left of image as (0,0)

    (smallestX,smallestY)-----------------(largestX,smallestY)    
          |                                      |
          |                                      |          
          |                                      | 
          |                                      |
    (smallestX,largestY)------------------(largestX,largestY)    
    

    And for finding minimum/maximum values and indices.

    [r,c]=find(img==min(min(img)))
    [r,c]=find(img==max(max(img)))
    

    r,c represent row and column in the img matrix.

    • I have marked the points on your image that you can use to create the bounding box.
    • Zoomed Image to get a better view. Makred Zoomed

提交回复
热议问题