【问题标题】:getting pixel position with zoom in matlab在matlab中通过放大获取像素位置
【发布时间】:2011-11-19 06:57:52
【问题描述】:

我的图像/图形上有一些 2D 点。

我用这个功能

im_data= rand(100,2);
scatter(im_data(:,1),im_data(:,2),'r*')
[x,y,button] = ginput()
im_data(x,y)=[];

我想通过简单地放大/放大来删除 [x,y] 以避免删除正确的点。 有什么帮助吗?

【问题讨论】:

    标签: matlab graphics plot


    【解决方案1】:

    您可以使用数据brushing 和数据linkinginteractively mark 点的组合并将它们从散点图中删除。

    例子:

    %# random data
    x = rand(100,1);
    y = rand(100,1);
    
    %# scatter plot
    hFig = figure;
    scatter(x, y, 50, 'r', 'filled')
    
    %# turn on brushing and linking
    hBrush = brush(hFig); set(hBrush, 'Enable','on', 'Color','g')
    linkdata(hFig, 'on')
    

    现在您可以使用画笔工具来选择数据点,方法是拖动选择矩形,单击鼠标右键,然后选择删除。由于我们将绘制的数据与实际变量联系起来,因此删除的点也会反映在xy变量中。

    请注意,您始终可以使用缩放工具放大特定区域,然后切换到画笔进行选择...

    如上图删除点后,我们可以查看变量:

    >> whos x y
      Name       Size            Bytes  Class     Attributes
    
      x         86x1               688  double              
      y         86x1               688  double       
    

    【讨论】:

    • 你能回答我另一个题为“IMCROP, zoom in, matlab”的问题吗? imcrop 也是同样的放大问题。
    猜你喜欢
    • 2018-04-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-12-18
    • 2012-11-26
    • 2014-07-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多