How to draw a line on an image in matlab?

后端 未结 6 1402
無奈伤痛
無奈伤痛 2020-12-02 23:48

I have two points lets say:

  • P(x,y) [point lies at the top of image]
  • P\'(x\',y\') [point lies at bottom of image]

Now i want to draw a l

6条回答
  •  时光取名叫无心
    2020-12-03 00:06

    If you have the Computer Vision toolbox. You can simply use shapeInserter.

    Check out http://www.mathworks.com/help/vision/ref/vision.shapeinserter-class.html

    To specify lines, you have to use the line below. Otherwise, you may get a rectangle

    Example:

    %draw a line from point (100,100) to (200,200) on an image saved as nextFrame
    
    line = int32([100 100  200 200]);
    shapeInserter = vision.ShapeInserter('Shape', 'Lines');
    nextFrame = step(shapeInserter, nextFrame, line);
    

    Take a look at the properties to see what you can edit.

提交回复
热议问题