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?

 採用された回答

KSSV
KSSV 2017 年 10 月 12 日

0 投票

MaskIm = imread('text.png');
Sat1=regionprops(MaskIm, {'Area', 'Eccentricity', 'EulerNumber', 'MajorAxisLength', 'MinorAxisLength', 'Orientation', 'Perimeter'});
AR = [Sat1.MajorAxisLength]./[Sat1.MinorAxisLength] ;
[Sat1.AspectRatio] = deal(AR) ;

6 件のコメント

Peyman Obeidy
Peyman Obeidy 2017 年 10 月 12 日
Thank you for this. It is adding a double array into each row. Please see the attached photo.
KSSV
KSSV 2017 年 10 月 12 日
MaskIm = imread('text.png');
Sat1=regionprops(MaskIm, {'Area', 'Eccentricity', 'EulerNumber', 'MajorAxisLength', 'MinorAxisLength', 'Orientation', 'Perimeter'});
AR = [Sat1.MajorAxisLength]./[Sat1.MinorAxisLength] ;
for i = 1:length(AR)
Sat1(i).AspectRatio = AR(i) ;
end
Peyman Obeidy
Peyman Obeidy 2017 年 10 月 12 日
Great. Many thanks for your time.
Cheers
KSSV
KSSV 2017 年 10 月 12 日
YOu can avoid loop too, check the following:
MaskIm = imread('text.png');
Sat1=regionprops(MaskIm, {'Area', 'Eccentricity', 'EulerNumber', 'MajorAxisLength', 'MinorAxisLength', 'Orientation', 'Perimeter'});
AR = [Sat1.MajorAxisLength]./[Sat1.MinorAxisLength] ;
AR=num2cell(AR);
[Sat1(:).AspectRatio] = deal(AR{:}) ;
Peyman Obeidy
Peyman Obeidy 2017 年 10 月 12 日
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 2017 年 10 月 12 日
I am trying to filter out noise (scanning pattern) on my negative control image (attached).

サインインしてコメントする。

その他の回答 (0 件)

質問済み:

2017 年 10 月 12 日

コメント済み:

2017 年 10 月 12 日

Community Treasure Hunt

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

Start Hunting!

Translated by