matlab 点投影到平面,使用matlab将球体投影到平面上

我可能完全误解了你的问题,在这种情况下我道歉;但我认为以下三种方法中的一种实际上可能就是你所需要的.请注意,方法3给出的图像看起来很像您提供的示例…但我使用了一个非常不同的路径(根本不使用sphere命令,而是通过工作计算“体素内部”和“外部体素”)直接与他们离中心的距离).我倒第二个图像与第三个图像相比,因为它看起来更好 – 用零填充球体使它看起来几乎像一个黑色磁盘.

%% method 1: find the coordinates, and histogram them

[x y z]=sphere(200);

xv = linspace(-1,1,40);

[xh xc]=histc(x(:), xv);

[yh yc]=histc(y(:), xv);

% sum the occurrences of coordinates using sparse:

sm = sparse(xc, yc, ones(size(xc)));

sf = full(sm);

figure;

subplot(1,3,1);

imagesc(sf); axis image; axis off

caxis([0 sf(19,19)]) % add some clipping

title 'projection of point density'

%% method 2: fill a sphere and add its volume elements:

xv = linspace(-1,1,100);

[xx yy zz]=meshgrid(xv,xv,xv);

rr = sqrt(xx.^2 + yy.^2 + zz.^2);

vol = zeros(numel(xv)*[1 1 1]);

vol(rr<1)=1;

proj = sum(vol,3);

subplot(1,3,2)

imagesc(proj); axis image; axis off; colormap gray

title 'projection of volume'

%% method 3: visualize just a thin shell:

vol2 = ones(numel(xv)*[1 1 1]);

vol2(rr<1) = 0;

vol2(rr<0.95)=1;

projShell = sum(vol2,3);

subplot(1,3,3);

imagesc(projShell); axis image; axis off; colormap gray

title 'projection of a shell'

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值