MATLAB Answers

0

I have an image and want to make a rectangle around black part which is in the middle of image.

Asked by abhishek on 23 Jun 2014
Latest activity Edited by abhishek on 26 Jun 2014
I have an image and want to make a rectangle around black part which is in the middle of image.

  0 Comments

Sign in to comment.

2 Answers

Answer by Dishant Arora on 23 Jun 2014

Go for connected component labelling and check out for bounding boxes parameter, plot it. For more information check out this demo by image analyst Image Segmentation Tutorial ("BlobsDemo")

  1 Comment

sir i tried that code but its not working as i want. I tried bounding box, regionprops etc. but failed. so plz can you simply make some code for this situation.

Sign in to comment.


Answer by Image Analyst
on 23 Jun 2014

What are you starting with? A gray scale image, or that binary image? If you have that binary image, you might want to call imclose() to connect some regions together, then call bwareaopen() to get rid of small noise regions, Then call regionprops and get the centroids and bounding boxes. Find the centroid closest to the center of the image and extract only that one with ismember.

  9 Comments

Now sir i have to find out the distance between centroid point and the detected obstacle. Just like in this image there is a blue circle which is Centroid point and want to fetch pixel distance between centeroid point to both obstacle. And in last angle from center.
Can't you just use the Pythagorean theorem? Or hypot()?
hello sir. how can i find out the black pixel locations in an image and distance between center to that point.

Sign in to comment.