Graph from 0º to 360º
5 views (last 30 days)
Show older comments
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 Comments
Walter Roberson
on 1 Apr 2022
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?
Answers (3)
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])
0 Comments
Voss
on 1 Apr 2022
plot(Mtaco(:,1), mod(Mtaco(:,5),360),'o'), grid on, title('Orientacion');
0 Comments
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.
2 Comments
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.
See Also
Categories
Find more on 2-D and 3-D Plots in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!