Graph from 0º to 360º

5 ビュー (過去 30 日間)
Patricio Morales
Patricio Morales 2022 年 4 月 1 日
コメント済み: Image Analyst 2022 年 4 月 1 日
Greetings community. I need to graph this function but my problem is that I use the function ''regionprops, Orientation'' which works between -90º and 90º. I need this graph to be between 0º and 360º. I get the points from a sequence of images in which I analyze the ''Centroid'' of a figure. I attach parts of the code
%This is the line with which I plot the orientation (which corresponds to the matrix Mtaco(:,5))
plot(Mtaco(:,1), Mtaco(:,5),'o'), grid on, title('Orientacion');
I attach an image of the graphed function, I need that on the ordinate axis they are from 0º to 360º
Thank you very much for your attention and for your help.
  2 件のコメント
Walter Roberson
Walter Roberson 2022 年 4 月 1 日
With the Orientation and Extrema information you can figure out where the ends of the longest axes are. Knowing that information, is there something about the objects that could be used to decide which side of the axes is the one you want the angle for?
Patricio Morales
Patricio Morales 2022 年 4 月 1 日
I was actually trying to work with extreme, one additional question. Is it possible to save points in Extreme? For example, in my object the 8 Extrema points are detected but since it is an object that is rotating, the Extrema points vary depending on the movement. Is it possible to leave it intact to the first zone where these were assigned without suffering a variation?

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

回答 (3 件)

Mahmoud Ashraf
Mahmoud Ashraf 2022 年 4 月 1 日
l think you need to change the limit of axes
you can do it by
axis([0 800 -360 360])

Voss
Voss 2022 年 4 月 1 日
plot(Mtaco(:,1), mod(Mtaco(:,5),360),'o'), grid on, title('Orientacion');

Image Analyst
Image Analyst 2022 年 4 月 1 日
So if a blob was aligned along the 45 degree angle, would you want the orientation to be 45 or 225? If it was at 90 degrees, would you want it to be at 90 degrees or 270 degrees? Explain how you would get angles more than 180 degrees and why they could not be the same angle as that angle minus 180 degrees.
How did you fill up Mtaco? I guess you put the orientation angles into column 5.
Why don't you just add 180 to any values less than 0?
Mtaco(:, 5) = Mtaco(:, 5) + 180;
Now your range is 0 to 180. Going more than 180 doesn't make sense.
  2 件のコメント
Walter Roberson
Walter Roberson 2022 年 4 月 1 日
-90 to +90, add 180, gives you +90 to +270.
Image Analyst
Image Analyst 2022 年 4 月 1 日
To add them to ONLY values like than 0, you need to get a mask of just those values less than 0.
rowsWithNegValues = Mtaco(:, 5); % Rows with negative values in column 5.
Mtaco(rowsWithNegValues, 5) = Mtaco(rowsWithNegValues, 5) + 180; % Reassign only negative numbers.

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

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by