声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 1907|回复: 6

[图像处理] 讨论:三维图像生成

[复制链接]
发表于 2007-5-21 19:28 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
需要生成三维图像,有这样一个程序:

clc
for i=1:2
n=strcat(num2str(i-1),'.tif');
[x,m]=imread(n);
D(:,:,i)=x;
end;
[x y z D]=reducevolume(D,[3 3 1]);
D=smooth3(D,'gaussian');
fv=isosurface(x,y,z,D,'noshare');
p1=patch(fv,'FaceColor','green','EdgeColor','none');
isonormals(x,y,z,D,p1);
fvc=isocaps(x,y,z,D,'noshare');
p=patch(fvc,'FaceColor','green','EdgeColor','none');
view(3); axis tight; daspect([1,1,0.4])
colormap(gray(100))
camlight left; camlight; lighting gouraud

大家看看到底哪有错!
回复
分享到:

使用道具 举报

发表于 2007-5-21 19:33 | 显示全部楼层
原帖由 03081214 于 2007-5-21 19:28 发表
需要生成三维图像,有这样一个程序:

clc
for i=1:2
n=strcat(num2str(i-1),'.tif');
[x,m]=imread(n);
D(:,:,i)=x;
end;
[x y z D]=reducevolume(D,[3 3 1]);
D=smooth3(D,'gaussian');
fv=isosurf ...


请先阅读 置顶贴:聚宝盆 把你的问题叙述清楚
 楼主| 发表于 2007-5-21 19:43 | 显示全部楼层

回复 #2 eight 的帖子

??? Subscripted assignment dimension mismatch.

Error in ==> three at 5
D(:,:,i)=x;
发表于 2007-5-21 19:45 | 显示全部楼层
原帖由 03081214 于 2007-5-21 19:43 发表
??? Subscripted assignment dimension mismatch.

Error in ==> three at 5
D(:,:,i)=x;


使用变量前,请先预分配空间,然后注意赋值号左右的矩阵大小问题。请多看看置顶贴:聚宝盆中提到的精华贴

[ 本帖最后由 eight 于 2007-5-21 19:46 编辑 ]
 楼主| 发表于 2007-5-21 20:43 | 显示全部楼层

看了那个帖子以后的启发,望指正,慢慢来,呵呵

--------------------------------------------------------------------------------
有这样一个程序:
clc
for i=1:2
n=strcat(num2str(i-1),'1111.tif');
[x,m]=imread(n);
D(:,:,i)=x;
end;
[x y z D]=reducevolume(D,[3 3 1]);
D=smooth3(D,'gaussian');
fv=isosurface(x,y,z,D,'noshare');
p1=patch(fv,'FaceColor','green','EdgeColor','none');
isonormals(x,y,z,D,p1);
fvc=isocaps(x,y,z,D,'noshare');
p=patch(fvc,'FaceColor','green','EdgeColor','none');
view(3); axis tight; daspect([1,1,0.4])
colormap(gray(100))
camlight left; camlight; lighting gouraud

出现了:
??? Subscripted assignment dimension mismatch.

Error in ==> three at 5
D(:,:,i)=x;

这一行是把X放到D的第i层,但是实现不了,请问怎么错了?
 楼主| 发表于 2007-5-22 14:08 | 显示全部楼层

这个页面里提到的链接呢?

我看了eight去年八月份的一份帖子,可是里面的链接怎么好像不是说的这个内容!
这是那个帖子所在页面:http://forum.vibunion.com/forum/ ... hlight=%C8%FD%CE%AC
发表于 2007-5-22 15:24 | 显示全部楼层
原帖由 03081214 于 2007-5-22 14:08 发表
我看了eight去年八月份的一份帖子,可是里面的链接怎么好像不是说的这个内容!
这是那个帖子所在页面:http://www.chinavib.com/forum/viewthread.php?tid=23729&;highlight=%C8%FD%CE%AC。



自己调试一下吧,估计是你的图片是RGB格式的,所以得到的矩阵 x 是三维的,这类问题稍微动手就可以马上解决的
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-9-24 11:34 , Processed in 0.060887 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表