Graph from 0º to 360º

조회 수: 19 (최근 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
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 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
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 CenterFile Exchange에서 Data Distribution Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by