我是靠谱客的博主 单薄墨镜,这篇文章主要介绍matlab鼠标截取图像并显示,通过在matlab中拖动鼠标来绘制线条时保留新图像,现在分享给大家,希望可以做个参考。

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鼠标截取图像并显示内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(72)

评论列表共有 0 条评论

立即
投稿
返回
顶部