I would like to draw a line, between point1 and point2, also by an angle (for example 15 degrees to the axis x) on an image or matrix. I do not just want to display the line on the image (as with plot). I want to actually change the pixel values so that I can save the image and reload it with the line still there.
Thank You
If you have the image processing toolbox, you can draw a line between any two points (either interactivly, or by specifying) using the function imline() . You can then save the line using createMask() . This will give you a binary image with only the line. You can then easily subtract, add or change the pixels in the orignal image and save it.
I = im2double(imread('pout.tif')); %Read Image
imshow(I,[])
h = imline(gca,[10 100], [80 100]); %Create line
Line = createMask(h); %Extract binary line
I = I + Line; %Add line to orignal image
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.