Restrict regionprops to only fit ellipses within binary objects?

조회 수: 3 (최근 30일)
Andrew Poissant
Andrew Poissant 2018년 7월 23일
댓글: Guillaume 2018년 7월 25일
I am using regionprops to extract image properties of a binary image. I have a lot of uniquely shaped regions, which is why regionprops is struggling to fit ellipses to the white regions. How do I restrict regionprops to only fit ellipses within the white regions (1s) and not include any of the blue region (0s)? I have attached a picture of the results I get from regionprops for my binary image.
  댓글 수: 8
Andrew Poissant
Andrew Poissant 2018년 7월 25일
From what I have seen, regionprops is including some background pixels in its sizing of the foreground objects, which is not what I want.
Guillaume
Guillaume 2018년 7월 25일
The 'Area' property returned by regionprop never includes background pixels. It is just the count of foreground pixels. Similarly, the 'Centroid' is the exact centroid of the foreground pixels according to the mathematical definition of the centroid. For a non-convex shape, the centroid may fall outside the shape.
The documentation of regionprops explains clearly how each property is calculated and if in doubt you can always look at the implementation since it's just a standard m file.

댓글을 달려면 로그인하십시오.

답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by