开发者

Using ROI in MATLAB

开发者 https://www.devze.com 2023-02-08 04:02 出处:网络
I have a final proje开发者_JS百科ct in MATLAB and I need help. I build a GUI and display an image using imshow function, now i want

I have a final proje开发者_JS百科ct in MATLAB and I need help.

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.

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.


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);

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

EDIT:

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号