How do I create an image matrix with a line drawn in it in MATLAB?

后端 未结 4 1336
眼角桃花
眼角桃花 2020-12-06 18:20

I want to plot a line from one well-defined point to another and then turn it into an image matrix to use a Gaussian filter on it for smoothing. For this I use the functions

4条回答
  •  [愿得一人]
    2020-12-06 18:34

    If you have Computer Vision System toolbox there is a ShapeInserter object available. This can be used to draw lines, circles, rectangles and polygons on the image.

    mat = zeros(250,250,'uint8');
    shapeInserter = vision.ShapeInserter('Shape', 'Lines', 'BorderColor', 'White');
    y = step(shapeInserter, mat, int32([30 60 180 210]));
    imshow(y);
    

    http://www.mathworks.com/help/vision/ref/vision.shapeinserterclass.html

提交回复
热议问题