gpt4 book ai didi

matlab - 在 MATLAB 中绘制形状上下文对数极坐标箱

转载 作者:太空宇宙 更新时间:2023-11-03 19:34:32 25 4
gpt4 key购买 nike

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

其中一个点的外观示例如下:Overlaid shape context logpolar bins

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

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

最佳答案

你可以使用这个函数:

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 :

figure screenshot

关于matlab - 在 MATLAB 中绘制形状上下文对数极坐标箱,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5258740/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com