⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 imgselct.m

📁 PLS_Toolbox是用于故障检测与诊断方面的matlab工具箱
💻 M
字号:
function [xinds,yinds] = imgselct%IMGSELCT Select an area on an image and return the pixel indices%  When invoked, IMGSELCT allows the user to draw a polygon%  on an image using the mouse. To close the polygon a%  "return" is used. The x indices (xinds) and y indices%  (yinds) are returned.%%I/O: [xinds,yinds] = imgselct;%%See also: IMGPCA, IMGSIMCA,  ISIMCAPR%Copyright Eigenvector Research, Inc. 1999-2000%bmw 4/99, 11/2000flag = 1;k = 0;ish = ishold;hold onwhile flag == 1  [x,y] = ginput(1);  if ~isempty(x)    k = k+1;    plot(x,y,'or','linewidth',2)    if k == 1      X = x;      Y = y;    else      X = [X; x];      Y = [Y; y];      plot(X(k-1:k),Y(k-1:k),'-r','linewidth',2)    end  else    flag = 0;  endendX = [X; X(1)];Y = [Y; Y(1)];plot(X(k:k+1),Y(k:k+1),'-r','linewidth',2)maxx = floor(max(X));minx = ceil(min(X));maxy = floor(max(Y));miny = ceil(min(Y));[xmat,ymat] = meshgrid(minx:maxx,miny:maxy);xmat = xmat(:);ymat = ymat(:);[xmat ymat];in = inpolygon(xmat,ymat,X,Y);xinds = xmat(in);yinds = ymat(in);plot(xinds,yinds,'.b')if ish == 0  hold offend      

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -