# Matlab Mouse Select Roc area __matlab

Source: Internet
Author: User

 Use Roipoly to develop an interesting polygon area for an image. Returns a binary image that can be used as a template for template filtering operationsBW = Roipoly (I, C, R) returns the polygon region specified by the vector C and R, where the c,r corresponds to the horizontal ordinate information.The BW returned is a two-valued image bounded by a drawn polygon; see Matlab encyclopedia Http://wiki.ilovematlab.cn/index.php?doc-innerlink-roipolyHere is a use of roipoly to do an interactive mapping program, I hope you like.ClcClear[Filename,pathname,q]=uigetfile ({' *.* '; ') *.bmp '; ' *.jpg '; ' *.png '});If q>0Lujing=strcat (Pathname,filename);I = Imread (lujing);FigureImshow (I);EndP=size (i,3);If p==3R=i (:,:, 1);G=i (:,:, 2);B=i (:,:, 3);I1=rgb2gray (I);ElseI1=i;EndHold on[X,y,c]=ginput (1);M (1) =x;N (1) =y;Plot (x,y, ' R ');k=2;while (c==1)[X1,y1,c1]=ginput (1);If C1==1M (k) =x1;N (k) =y1;Plot (x,y, ' R ');Line ([M (K-1) m (k)],[n (k-1) n (k)]);k=k+1;C=C1;ElseBreakEndEndLine ([M (K-1) m (1)],[n (k-1) n (1)]);BW = Roipoly (i1,m,n);If p==3R1=double (R). *double (BW);G1=double (g). *double (BW);B1=double (b). *double (BW);I1=cat (3,R1,G1,B1);FigureImshow (Mat2gray (I1));ElseI2=double (I1). *double (BW);FigureImshow (Mat2gray (I2));End

Related Keywords:

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

## A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

• #### Sales Support

1 on 1 presale consultation

• #### After-Sales Support

24/7 Technical Support 6 Free Tickets per Quarter Faster Response

• Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.