how to calculate the major and minor axis of an ellipse in contour plot

6 ビュー (過去 30 日間)
dEEPAK MAT
dEEPAK MAT 2013 年 11 月 14 日
コメント済み: Image Analyst 2021 年 1 月 12 日
I have a contour plot which is more of a ellipse.I would like to know its major and minor axis...a and b respectively.How do i go about.I am naive user please guide me.

採用された回答

Image Analyst
Image Analyst 2013 年 11 月 14 日
You need the Image Processing Toolbox. Type ver to see if you have it.
It looks like an indexed image with a jet colormap being applied. Get one "ring" by thresholding
binaryImage = grayImage == theValue; % Different rings will have different intensity values.
% Now get the ellipse parameters with regionprops.
measurements = regionprops(binaryImage, 'MajorAxisLength', 'MinorAxisLength', 'Orientation');
majorAxisLength = measurements.MajorAxisLength;
minorAxisLength = measurements.MinorAxisLength;
% Repeat for other rings.

その他の回答 (2 件)

Mohammad Bhat
Mohammad Bhat 2018 年 2 月 11 日
How can I pass ellipse as an object to regionprops
  3 件のコメント
Rahul  Verma
Rahul Verma 2020 年 1 月 6 日
I am having a similar contour image which I converted to grayscale as attached...
a=imread('test1.png');
grayImage = rgb2gray(a);
grayscale.pngbinaryImage = grayImage == 0.40;
measurements = regionprops(binaryImage, 'MajorAxisLength', 'MinorAxisLength', 'Orientation');
However, on calling regionprops, I get an empty matrix
0×1 empty struct array with fields:
MajorAxisLength
MinorAxisLength
Orientation
As a result, I cannot get the major and minor axis lengths...
Any suggestions :)test1.png
Image Analyst
Image Analyst 2020 年 1 月 6 日
You probably don't have anything that is EXACTLY 0.4. Try
binaryImage = grayImage >= 0.40;
Do it again for a different value and AND the images if you just want the ring.
binaryImage = grayImage >= 0.40 & grayImage <= someOtherValue;

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


Bhavesh Garg
Bhavesh Garg 2021 年 1 月 12 日
VHVHV
  1 件のコメント
Image Analyst
Image Analyst 2021 年 1 月 12 日
How is this an "Answer" to dEEPAK's question? What does it mean?

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by