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

  • SEARCH
  • Home
  • 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 6774585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:48:17+00:00 2026-05-26T15:48:17+00:00

I have some particles that I’ve identified in a larger image, and need to

  • 0

I have some particles that I’ve identified in a larger image, and need to parse into smaller images for each particle. I’ve used the regionprops ‘BoundingBox’ function, but haven’t been successful yet. How can I now make a rectangular subimage of image I using BoundingBox? I can use BoundingBox to draw a rectangle on the original image, but the parameters returned by BoundingBox seem not to be of pixel dimension (x,y, width, height), (x1, y1, x2, y2), etc, which I would expect a bounding box to return. I’ve written some sample code using coins.png to make it easier for anyone to understand. Can you help me with this? Thanks!

figure(1);
I = imread('coins.png');
bw = im2bw(I, graythresh(I));
bw2 = imfill(bw,'holes');
imshow(bw2);


figure(2);
L = bwlabel(bw2);
imshow(label2rgb(L, @jet, [.7 .7 .7]))

figure(3);
imshow(I);
s = regionprops(L, 'BoundingBox');
rectangle('Position', s(1).BoundingBox);
  • 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-05-26T15:48:18+00:00Added an answer on May 26, 2026 at 3:48 pm

    The parameters returned by regionprops are [y,x,width,height] in matrix coordinates (see also “unexpected Matlab”.

    Thus, to extract the rectangle, you write:

    subImage = I(round(s(1).BoundingBox(2):s(1).BoundingBox(2)+s(1).BoundingBox(4)),...
           round(s(1).BoundingBox(1):s(1).BoundingBox(1)+s(1).BoundingBox(3)));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have some third parties that are sending us traffic and have asked us
I am new to ASP.net MVC architecture. I have read in some articles that
Lets suppose that I have some pages some.web/articles/details/5 some.web/users/info/bob some.web/foo/bar/7 that can call a
I just got Delphi 2009 and have previously read some articles about modifications that
Does anyone have some guidelines or links to articles when designing a website that
After reading some articles about XSS I have incorporated HTMLPurifier into my zend framework
I have some code that runs fairly well, but I would like to make
I have read some articles that state that IEnumerable used to mimic stored procedures
I have a user model that can follow some tags User has_many :tag_followings has_many
I am writing a simple application in Java that does some particle simulation on

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.