matlab像素提取方法.docVIP

  • 60
  • 0
  • 约1.18万字
  • 约 18页
  • 2016-11-28 发布于河南
  • 举报
matlab像素提取方法

matlab像素提取方法 im = imread(***.jpg); [imcroped rect] = imcrop(im); %拖动鼠标选取你要处理的范围,双击完成 %范围图像存放在imcroped中,坐标存放在rect中 imtmp = improcess(imcroped); % 你的处理 %把处理后效果的覆盖原图 im(rect(2):rect(2)+rect(4),rect(1):rect(1)+rect(3)) = imtmp; [x,y]=ginput(2);鼠标点击那两个交点,然后[x,y] [x,y] = ginput; disp({横坐标是:,num2str(x),纵坐标是:,num2str(y)}); 用ginput函数获得鼠标点击后的坐标 ginput Graphical input from mouse or cursor Descriptionginput enables you to select points from the figure using the mouse for cursor positioning. The figure must have focus before ginput receives input. [x,y] = ginput(n) enables you to select n points from the current axes and returns the x- and y-coordinates in the column vectors x and y, respectively. Press the Return key to terminate the input before entering n points. [x,y] = ginput gathers an unlimited number of points until you press the Return key. Note Clicking an axes makes that axes the current axes. Although you may set the current axes before calling ginput, whichever axes the user clicks becomes the current axes and ginput returns points relative to that axes. For example, if a user selects points from multiple axes, the results returned are relative to the different axes coordinate systems. [x,y,button] = ginput(...) returns the x-coordinates, the y-coordinates, and the button or key designation. button is a vector of integers indicating which mouse buttons you pressed (1 for left, 2 for middle, 3 for right), or ASCII numbers indicating which keys on the keyboard you pressed. ----------------------------------------------------------------------引自MATLAB help 网络工具很有用,先找后试,再问! --------------------------------------转自sina博客------------------------------------------------------------- 第一种途径:ginput()函数 ginput提供了一个十字光标使我们能更精确的选择我们所需要的位置,并返回坐标值。函数调用形式为: [x,y] = ginput(n) [x,y] = ginput [x,y,button] = ginput(...) 对于[x,y] = ginput(n),能使你从当前的坐标系中读取n个点,并返回这n个点的x,y坐标,均为nX1的向量。可以按回车提前结束读数。 [x,y] = ginput 可以无限的读取坐标直到按下回车键。 [x,y,

文档评论(0)

1亿VIP精品文档

相关文档