我是靠谱客的博主 单薄墨镜,最近开发中收集的这篇文章主要介绍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鼠标截取图像并显示,通过在matlab中拖动鼠标来绘制线条时保留新图像所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

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

评论列表共有 0 条评论

立即
投稿
返回
顶部