is there an alternate function for region props

4 views (last 30 days)
I am detecting an image containing shapes, I have done the fundamental stuff of converting the image to grayscale ... Black n white etc... Now I am extracting the extema property from the region props function to determine the corners of each binary image. Is there an alternate method or function that I can use instead of region props?

Answers (2)

Image Analyst
Image Analyst on 27 Sep 2014
Depends on what you want to measure. If you want area, you can use bwarea(), but that's also in the Image Processing Toolbox. bwperim() could get you the perimeter length, but again, it's in the IPT. If you don't want to use the IPT, and I'm assuming the reason you're asking is that you haven't purchased it, then you'll have to write your own.
  1 Comment
Image Analyst
Image Analyst on 27 Sep 2014
If you want to find the max Feret diameter, see the attached demo. The Major Axis length does not give the length of the two most distant points.

Sign in to comment.


Matt J
Matt J on 27 Sep 2014
Edited: Matt J on 27 Sep 2014
You could use bwboundaries to get the boundary points. Then use max and min to analyze the extreme points, e.g.,
B=bwboundaries(BW);
B1=B{1};
qmin=min(B1,[],1);
topleft=[qmin(1), min( B1(:,B1(:,1)==qmin(1)) )];
  3 Comments
Matt J
Matt J on 27 Sep 2014
Edited: Matt J on 29 Sep 2014
I should mention, I fully expect this to be a reinvention of what regionprops already does. You should say what shortcoming regionprops has, in your mind, so that people have better context for the advice they give.
Image Analyst
Image Analyst on 27 Sep 2014
And bwboundaries requires the Image Processing Toolbox, so you might as well use regionprops. What would you do with bwboundaries? You could get the bounding box like Matt showed. Or do you have other plans? What do you want to measure?

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!