Explain code just starting with matlab ?
이전 댓글 표시
Can any one explain this part of code in details please !
if true
for i=1:length(b)
inds=round(1:factor:size(b{i},1));
b{i}=b{i}(inds,:);
end
end
and below the hole part of code :
%construct voronoi
if ~boundary
b=bwboundaries(BW);
else
b={BW};
end
if factor>1
for i=1:length(b)
inds=round(1:factor:size(b{i},1));
b{i}=b{i}(inds,:);
end
end
i=1;
inds=[];
while i<=length(b)
if size(b{i},1)<4
b(i)=[];
continue;
end
inds(i)=length(b{i}); %#ok<AGROW>
i=i+1;
end
inds=[0 cumsum(inds)];
p=cell2mat(b);
[v e]=costumVoronoi(p);
댓글 수: 3
I don't know anything about voronoi-diagrammes, but I suppose your programme is some tool for generating them? It would certainly be helpful if you posted the exact nature of b (I suppose it is a cellarray?), factor, BW and the functions bwboundaries and costumVoronoi.
My guess for the first part: Factor is some number, not necessarily an integer. You generate an indexvector inds with the entries 1 round(1+factor) etc. Then you replace the matrix in b{i} with a matrix which has only the rows 1 round(1+factor) etc (the numbers from inds).
mika
2014년 6월 25일
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Voronoi Diagram에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!