interpolation of a binary map
7 views (last 30 days)
Show older comments
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 Comments
Answers (1)
Sean de Wolski
on 27 Sep 2012
Edited: Sean de Wolski
on 27 Sep 2012
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 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!