在MATLAB中使用ROI [英] Using ROI in MATLAB

查看:622
本文介绍了在MATLAB中使用ROI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在MATLAB中有一个最终项目,我需要帮助.

I have a final project in MATLAB and I need help.

我建立一个GUI并使用imshow功能显示图像,现在我想要 从图像中选择区域并获得选定区域的像素.

I build a GUI and display an image using imshow function, now i want to select area from the image and get the pixls of the Selected area.

我知道ROI方法,但是我不知道如何使用它,所以我很高兴 有人可以向我解释. 谢谢.

i know the ROI method but i don't know how to use it, so i be very happy if someone could explain it to me. thanks.

推荐答案

如果您拥有图像处理工具箱,则选择ROI非常简单.有很多方法可以做到这一点,但是我建议使用roipoly函数.只需写:

Selecting a ROI is pretty easy if you have the image processing toolbox. There are many ways to do it, but I recommend using the roipoly function. Simply write:

BW = roipoly(I);

我是你的形象.然后,您将被提升为您的投资回报率选择点.输出的BW将是二进制图像,其ROI内部为1,外部为0.

where I is your image. You will then be promoted to select points for your ROI. The output BW will be a binary image with value 1 inside the ROI and 0 outside.

有关更多信息,请参见:

For more information look at:

http://www.mathworks.com/help/toolbox/images/ref/roipoly.html

您可以使用imrect函数创建矩形ROI.请注意,此功能适用于当前轴,因此您需要在imrect之前使用imshow.该函数的输出是一个roi句柄,因此您需要使用函数createMask来获取二进制图像.

You can use the function imrect to create rectangular ROIs. Note that this function works on the current axes, so you need to use imshow before imrect. The output of the function is a roi handle, so you need to use the function createMask to get a binary image out.

imshow(I); 
h = imrect;
BW = createMask(h);

http://www.mathworks.com/help/toolbox/images/ref/imrect.html

这篇关于在MATLAB中使用ROI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆