代码拉取完成,页面将自动刷新
function img = rendervol(imgpath, volpath, texture)
% Renders a volume which has been generated by the VRN lua script.
vol = readvol(volpath, [192 192 200]);
im = imread(imgpath);
Q = isosurface(vol);
Q.vertices(:,3) = Q.vertices(:,3) * 0.5;
Q.EdgeColor = 'none';
Q.FaceColor = [120 154 194]/255;
if texture
red = double(im(:,:,1));
green = double(im(:,:,2));
blue = double(im(:,:,3));
[vcx,vcy] = meshgrid(1:192,1:192);
vc = [vcx(:) vcy(:) red(:) green(:) blue(:)];
cols = knnsearch(vc(:,1:2), Q.vertices(:,1:2));
Q.FaceVertexCData = uint8(vc(cols,3:5));
Q.FaceColor = 'interp';
end
figure
imshow(im, 'Border', 'tight');
hold on
patch(Q);
hold on
h = camlight;
lightangle(h, -10, 80)
lighting gouraud
material dull
view(0,90)
cap = getframe;
img = cap.cdata;
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。