interpolation of a binary map
조회 수: 5 (최근 30일)
이전 댓글 표시
Hi All,
After performing a level set contour detection on an image I create a binary Map (1 on a contour, 0 otherwise). For computation efficiency, I process a downsampled image (factor 4). After Upsampling my map I no longer have a closed contour. I would like to interpolate points, what function should I use.
Let's say that my map is X and [m,n]=size(X).
Thank you
댓글 수: 0
답변 (1개)
Sean de Wolski
2012년 9월 27일
편집: Sean de Wolski
2012년 9월 27일
You have yourself what is not necessarily an easy problem. If the contour was guaranteed to be convex it would be greatly simplified, but level-sets don't obey this.
Here is one possibility:
%%Sample image:
I = imread('cameraman.tif');
sz = size(I);
M = I<50; %map
E = bwperim(M); %edges
E = bwareaopen(E,100); %edges of big things (for example)
amp = 4; %amplification factor
bounds = bwboundaries(E); %get the boundaries
szAmp = sz*amp; %amplification size
E2 = false(szAmp); %preallocate
for ii = 1:numel(bounds)
E2 = E2 | poly2mask(bounds{ii}(:,2)*amp,bounds{ii}(:,1)*amp,szAmp(1),szAmp(2));
%Make mask out of each bounded polygon
end
E2 = bwperim(E2); %get the edge again
imtool(E2) %inspect it
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!