Hey!
Suppose, the image dimensions are [w h] and the image center is at (p,q) [with general considerations}.
"How do I plot lines in an image according to the angles..."
Using a little bit of trigonometry and MATLAB's column-major notations, the X-coordinate of the third vertex of the shape made by the coordinate axes and the blue line that makes an angle of alpha with the Y-axis would be:
The Y-coordinate would be 1.
Using these coordinates, use the line function to draw the line on the image as follows: im = imread('img.png');
imshow(im);
hold on;
line([x, p], [y, q]);
For the next line i.e. with angle beta, replace "alpha" in the aforementioned equation with "alpha + beta" angles. You'll probably have to write a code to do this process repeatedly if you want a programmatic solution to this problem.
"extract region between these lines for analysis..."
Region created by vertices (p,q), (p,1) & (x,y) [which we just calculated] can be inputs to this. Examples on this Documentation page describe how to do this non-interactively using images.roi.Polygon.
Similarly, for the line that makes an angle beta, you'd have to add an additional vertex - the edge/corner of the image i.e. [w 1].
Hope this helps!
0 Comments
Sign in to comment.