Graph from 0º to 360º

14 views (last 30 days)
Patricio Morales
Patricio Morales on 1 Apr 2022
Commented: Image Analyst on 1 Apr 2022
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.
Patricio Morales
Patricio Morales on 1 Apr 2022
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?

Sign in to comment.

Answers (3)

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

Voss on 1 Apr 2022
plot(Mtaco(:,1), mod(Mtaco(:,5),360),'o'), grid on, title('Orientacion');

Image Analyst
Image Analyst on 1 Apr 2022
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.
Image Analyst
Image Analyst on 1 Apr 2022
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.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by