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

3 次查看(过去 30 天)
I have an image and want to make a rectangle around black part which is in the middle of image.

回答(2 个)

Dishant Arora
Dishant Arora 2014-6-23
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 个评论
abhishek
abhishek 2014-6-23
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.

请先登录,再进行评论。


Image Analyst
Image Analyst 2014-6-23
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 个评论
abhishek
abhishek 2014-6-26
编辑:abhishek 2014-6-26
hello sir. how can i find out the black pixel locations in an image and distance between center to that point.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Image Processing Toolbox 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by