How To Draw Line On Picture In Matlab
Draw Line on Epitome in Matlab
- Depict Line on an Prototype Using the
plot()
Office in MATLAB - Draw Line on an Image Using the
insertshape()
Function in MATLAB
This tutorial will talk over how to draw lines and other shapes on an image using the plot()
and insertshape()
function in MATLAB.
Draw Line on an Image Using the plot()
Part in MATLAB
If you desire to describe a line or other variables like the sine moving ridge on an image, you can use the plot()
function to practice that. For example, let'south draw a line on an image. Come across the code beneath.
load clown prototype(X) hold on plot([180 50], [60 250],'Colour','r','LineWidth',5)
Output:
In the above lawmaking, we have used an already stored clown epitome and plotted a line on the clown image using the hold on
command. You can change the color of the line using the Color
property and the line width using the LineWidth
belongings. You can also change the starting and ending signal of the line.
Draw Line on an Image Using the insertshape()
Part in MATLAB
If you want to draw shapes: line, circle, rectangle, and polygon on an image, you can apply the insertshape()
part to do that. The basic syntax of the insertshape()
part is given below.
Output = insertShape(Image, shape, shape_position)
In the above lawmaking, Image
is the image object on which yous want to depict, shape
is the shape you want to depict on the image, shape_position
is the position on the image at which you desire to depict the shape. For example, let's draw a circle on an image. See the lawmaking below.
X = imread('peppers.png'); output = insertShape(10,'circle',[100 100 100],'LineWidth',5); imshow(output)
Output:
In the above code, we have used an already stored peppers epitome, and a circle is drawn on the paradigm using the insertshape()
function. In the case of a circle, the position consists of iii values; the start value is the x-axis position, the 2nd value is the y-axis position, and the tertiary value is the radius of the circle. In the case of a rectangle, the position consists of four values, the commencement value is the x-axis position, the second value is the y-axis position, the 3rd value is the width, and the fourth value is the height of the rectangle. You can also change the color of the shape using the Color
property, the line width using the LineWidth
property, and likewise the opacity in instance of filled shapes using the Opacity
property. Cheque this link for more details about the insertshape()
function.
Write for u.s.a.
DelftStack articles are written past software geeks like you. If you also would like to contribute to DelftStack by writing paid articles, you tin check the write for us page.
Related Article - MATLAB Epitome
Source: https://www.delftstack.com/howto/matlab/matlab-draw-line-on-image/
Posted by: torresglin1958.blogspot.com
0 Response to "How To Draw Line On Picture In Matlab"
Post a Comment