【问题标题】:Drawing shape context logpolar bins in MATLAB在 MATLAB 中绘制形状上下文对数极坐标箱
【发布时间】:2011-07-12 15:19:42
【问题描述】:

我使用形状上下文直方图作为特征描述符来编码剪影图像。为了协助调试,我想查看覆盖在轮廓图像上的形状上下文 logpolar 箱(从边缘图像中获取的样本点)。

其中一个点的外观示例如下:

我知道如何显示圆圈(径向分格),但我在生成角度分格(线)时遇到了困难。

给定一组角度,我如何绘制类似于示例图像中所示的线段?

【问题讨论】:

    标签: matlab machine-learning computer-vision pattern-recognition shape-context


    【解决方案1】:

    你可以使用这个功能:

    function scDrawPolar(samp,point,r_min,r_max,nbins_theta,nbins_r)
    %SCDRAWPOLAR draw a polar on the center point
    %   point           - the center point
    %   r_min           - min radius
    %   r_max           - max radius
    %   nbins_theta     - theta divide
    %   nbins_r         - r divide
    %   fig_handle      - draw the diagram on which figure
    gca;
    hold on;
    
    plot(samp(1,:)',samp(2,:)','r.');
    plot(point(1),point(2),'ko');
    
    r_bin_edges=logspace(log10(r_min),log10(r_max),nbins_r);
    
    % draw circles
    th = 0 : pi / 50 : 2 * pi;
    xunit = cos(th);
    yunit = sin(th);
    for i=1:length(r_bin_edges)
        line(xunit * r_bin_edges(i) + point(1), ...
                        yunit * r_bin_edges(i) + point(2), ...
            'LineStyle', ':', 'Color', 'k', 'LineWidth', 1);
    end
    
    % draw spokes
    th = (1:nbins_theta) * 2*pi / nbins_theta;
    cs = [cos(th);zeros(1,size(th,2))];
    sn = [sin(th);zeros(1,size(th,2))];
    line(r_max*cs + point(1), r_max*sn + point(2),'LineStyle', ':', ...
        'Color', 'k', 'LineWidth', 1);
    
    axis equal;
    axis off;
    hold off;
    end
    

    查看结果here:

    【讨论】:

      【解决方案2】:

      这样做:

      >> 图 >> 轴 >> 坚持 >> 半径 = 1; >> θ = 0:30:360; >> 对于角度 = theta line([0 半径 * cosd(角度)], [0 半径 * sind(角度)]); 结尾

      产生这个:

      【讨论】:

      • 感谢您的快速回答!这正是我所追求的:-)
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多