the detection of part of shape in fill function matlab 3d modeling
1 view (last 30 days)
Show older comments
hi, in r2014a,I build a 3d modeling from 2d array when i build it with this code, the detection of part of shape in fill function matlab
has wrong
zada = imfill(phi,'holes');
if(k==35)||(k==7)||(k==1)||(k==2) originalImage = bwareaopen(im2bw(zada),110); elseif (k==2)||(k==1) originalImage=bwareaopen(im2bw(zada),30); else originalImage = bwareaopen(im2bw(zada),30); end imshow(originalImage); % se = strel('disk',10);
if(k==8)||(k==9)||(k==10)||(k==6)||(k==7)||(k==5) se = strel('disk',10); else se = strel('line',4,95); %# structuring element end closeBW = imclose(originalImage,se);
closeBW=imfill(mat2gray(closeBW),'holes'); figure(222222222) imshow(closeBW); numberOfPixels1 = sum(closeBW(:)) numberOfPixels2 = bwarea(closeBW) structBoundaries = bwboundaries(closeBW); xy=structBoundaries{1}; % Get n by 2 array of x,y coordinates.
blackMaskedImage = asl1;
blackMaskedImage(~closeBW) = 0;
curve3_smooth=mat2gray(blackMaskedImage);
figure(23333)
imshow(curve3_smooth)
% fact(:,:,k)=blackMaskedImage;
%%%%%%%%%%%%%%
% closeBW=curve3_smooth;
fact(:,:,k)=mat2gray(closeBW);
figure(3333331)
imshow(fact(:,:,k));
end
D=fact;
D=imfill(mat2gray(D),'holes');
D = squeeze(double(D));
D = smooth3(D);
D(isnan(D)) = 0;
%
% [x,y,z,D] = subvolume(D,[nan,nan,nan,nan,nan,nan]);
D=imfill(D,'holes');
thresh = max(D(:)) /2;
FV = isosurface(D,thresh);
% FV = isosurface(D,5);
reduce=0.25;
if (reduce ~= 1.0) %next: simplify mesh
FV = reducepatch(FV,reduce);
end;
ec = 'none';
p1 = patch(FV,...
'FaceColor',[1 0 1],'EdgeColor','non','CDataMapping','scaled');
p2 = patch(isocaps(D,5),...
'FaceColor','interp','EdgeColor','non','CDataMapping','scaled');
view(3)
axis off
daspect([1,1,.4])
colormap(gray(100))
camlight
lighting gouraud
rotate3d on
0 Comments
Answers (0)
See Also
Categories
Find more on Lighting, Transparency, and Shading in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!