I am new in matlab GUI. I want to drawing lines by dragging the mouse. I found this issue but I want save new image with drawn lines. If i run this line, it will show me the same image.
imshow(im);
How can I get new image with drawn lines and for example show it?
解决方案
You can also grab the image data directly in the Command Prompt. Once you draw all of your lines on your figure window, you can use getframe, which takes a snapshot of the current frame in focus. In this case, this should be your image with the drawn lines. When you call getframe, this will give you a structure with an element called cdata. This will give you an RGB array of what was seen in the figure (without the menu bars... just the figure data itself).
Example:
im = imread('cameraman.tif');
imshow(im);
h = getframe;
out = h.cdata;
figure;
imshow(out); %// Should give you the same image as the figure
最后
以上就是单薄墨镜最近收集整理的关于matlab鼠标截取图像并显示,通过在matlab中拖动鼠标来绘制线条时保留新图像的全部内容,更多相关matlab鼠标截取图像并显示内容请搜索靠谱客的其他文章。
发表评论 取消回复