Save plot to image variable
显示 更早的评论
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 个评论
Stephen23
2018-6-6
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
2018-6-7
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Convert Image Type 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!