Clear Filters
Clear Filters

add a field to structure

3 views (last 30 days)
Peyman Obeidy
Peyman Obeidy on 12 Oct 2017
Commented: Peyman Obeidy on 12 Oct 2017
Sat1=regionprops(MaskIm, {'Area', 'Eccentricity', 'EulerNumber', 'MajorAxisLength', 'MinorAxisLength', 'Orientation', 'Perimeter'});
How to divide MajorAxisLength with MinorAxisLength and then add it to Sat1 structure under 'AspectRatio' name?

Accepted Answer

KSSV
KSSV on 12 Oct 2017
MaskIm = imread('text.png');
Sat1=regionprops(MaskIm, {'Area', 'Eccentricity', 'EulerNumber', 'MajorAxisLength', 'MinorAxisLength', 'Orientation', 'Perimeter'});
AR = [Sat1.MajorAxisLength]./[Sat1.MinorAxisLength] ;
[Sat1.AspectRatio] = deal(AR) ;
  6 Comments
Peyman Obeidy
Peyman Obeidy on 12 Oct 2017
Thank you. This is working but then I am not able to filter the region using 'bwpropfilt' anymore.
%
% AR =( [MaskIminFinal_log_properties.MajorAxisLength]./[MaskIminFinal_log_properties.MinorAxisLength])' ;
for i = 1:length(AR)
MaskIminFinal_log_properties(i).AspectRatio = AR(i) ;
end
MaskIminFinal_log_New = bwpropfilt(MaskIminFinal_log, 'AspectRatio', [1, 3]);
Peyman Obeidy
Peyman Obeidy on 12 Oct 2017
I am trying to filter out noise (scanning pattern) on my negative control image (attached).

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!