Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7787155
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T20:34:20+00:00 2026-06-01T20:34:20+00:00

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

  • 0

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

enter image description here

I did like this:

bw = imread('box.jpg');
bw=im2bw(bw);
imshow(bw)
L = bwlabel(bw);
s = regionprops(L, 'Area', 'BoundingBox');
s(1);
area_values = [s.Area];
idx = find((100 <= area_values) & (area_values <= 1000)); % list of all the objects   

%whose area is between 100 and 1000

bw2 = ismember(L, idx); %construct a binary image containing all the objects whose 

%area is between 100 and 1000 by passing L and idx to ismember. 

imshow(bw2)

The output bw2, so far is:
enter image description here

Can someone one tell me how to draw a bounding box around this blob(white)?

Update
Wajih’s answer actually accurately solved the issue.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T20:34:22+00:00Added an answer on June 1, 2026 at 8:34 pm

    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
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to draw contours around blobs in a binary image, however, sometimes, openCV
I am trying to draw a background image in my UIView. This is in
Im trying to draw line by stroking an image to have brush like effect
Im trying to draw a line. I wrote a code like below. UIColor *currentColor
I'm trying to draw custom UI (a path in this case) on top of
I'm trying to draw a semi-transparent rectangle on top of an image to act
I'm just trying to draw a line with JavaScript. I would like it to
Given a coordinate (lat, long), I am trying to calculate a square bounding box
I am trying to draw a single line with the code below and it
I'm trying to draw an Image with Java, I've the next code: public void

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.