How to extract features from candidates?

조회 수: 4 (최근 30일)
Krishna Chaitanya
Krishna Chaitanya 2020년 1월 17일
region.PNG
I have a binary image which consists of candidates(White regions).I need to extract following features for each of these candidates.
1.The area (a) of the candidate.
2.The perimeter (p) of the candidate.
3. major axis length (l) and minor axis length (w) of the candidate.
4.The compactness
where is the distance from the centroid of the object to its boundary pixel and d is the mean of all the distances from the centroid to all the edge pixels. Here n is the number of edge pixels

채택된 답변

Constantino Carlos Reyes-Aldasoro
First you need to label your objects with bwlabel, e.g.
labelled_image = bwlabel (original_image);
that will return your same image but each non-zero connected region will have a unique label (1,2,3,...) that will allow the function regionprops to extract the features you require:
features = regionprops(labelled_image,'Area','Perimeter', 'MajorAxisLength','MinorAxisLength') ;
Check the description of the functions to see if you can get compactness directly, otherwise you may have to calculate that from another value.
Hope that helps

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by