Save plot to image variable
Show older comments
Hi,
I have several lines (definded by startpoint x1, y1 and endpoint x2, y2). Now I want to print them directly onto an image without showing it as plot on the screen first. I want to write them directly over an existing image.
Background: I have the borders of an object through a hough-transformation and now I want to write those lines over the image for further processing (detecting the single objects in the image). Every answer so far was about plotting them and then using getframe and frame2img, but I want to avoid this out of performance and quality issues (images are larger than my screen, so the figure will get scaled -> information loss).
Thanks a lot in advance!
2 Comments
Stephen23
on 6 Jun 2018
An image displayed on a screen is just an array/matrix anyway, so if you already have a raster image and you know the locations that you want to change, then you don't need to plot the data, you can simply change the required locations in the array/matrix directly.
In your case you have the start and end points of line segments, so you can calculate the intermediate points corresponding to that line. You will need to consider some kind of threshold or aliasing to decide if the line changes the values or not.
Marc Franzen
on 7 Jun 2018
Accepted Answer
More Answers (0)
Categories
Find more on Convert Image Type in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!