Bounding box using MATLAB for the image

后端 未结 4 848
南方客
南方客 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:22

    As the 20,000th viewer of this question, I'll answer what I think the asker is actually asking.

    To render a rectangle on the page, you just need to properly interpret the bounding box for the shape. You've already computed this in s(idx).BoundingBox

    Thus, add these two lines to your script:

    bb = s(idx).BoundingBox;
    rectangle('Position',[bb(1) bb(2) bb(3) bb(4)],'EdgeColor','green');
    

    and you'll get:

提交回复
热议问题