Active Contour algorithm applicated to Digital Elevation Model
1 次查看(过去 30 天)
显示 更早的评论
Hello, I am using Chenyang Xu and Jerry Prince active contour algorithm in order to obtain the geometry of bomb craters from a digital elevation model. I have extracted central points of each crater (circular structures - see image) and I want to draw the contour line of those craters from the central points.
I try to use this code (see below) but I want to draw the contour line from coordinates of my central points (Not from clicked coordinates. I already have extracted the coordinates of the central points). How can I do that?
Thanks
% My image is called "svf.pgm"
imwrite(svf,'../images/svf.pgm');
[I,map] = rawread('../images/svf.pgm');
I=imresize(I,1);
disp(' Compute edge map ...');
f = 1 - I/255;
f0 = gaussianBlur(f,1);
[px,py] = gradient(f0);
figure(1);
subplot(121); imdisp(-f); title('snake potential');
subplot(122); quiver(px,py);
axis('image', 'ij', 'off');
title('traditional force');
disp(' ');
disp(' Press any key to start the deformation');
pause;
figure(1); subplot(121);
colormap(gray(64));
image(((1-f)+1)*40); axis('square', 'off');
figure, imshow(I,map); [x,y] = getpts;
colormap(gray(64));
t = 0:0.5:1;
[x,y] = snakeinterp(x,y,2,0.5);
snakedisp(x,y,'r')
pause(1);
for i=1:20,
[x,y] = snakedeform2(x,y,0.05,0,1, 2, 0.15,px,py,5);
[x,y] = snakeinterp(x,y,2,0.5);
snakedisp(x,y,'r')
title(['Deformation in progress, iter = ' num2str(i*5)])
pause(0.1);
end
disp(' ');
disp(' Press any key to display the final result');
pause;
figure(1); subplot(121);
colormap(gray(64));
image(((1-f)+1)*40); axis('square', 'off');
snakedisp(x,y,'r');
title(['Final result, iter = ' num2str(i*5)]);
2 个评论
采纳的回答
Image Analyst
2015-10-12
Can't you just use contour() on your topographic image? You can mask out the non-crater background region if you want so that you see contours only within the craters.
3 个评论
Image Analyst
2015-10-12
Oh, okay. So when you use activecontour() and get your binary image, then just use regionprops() to get those measurements. See my Image Segmentation Tutorial: http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862 for how to get those measurements.
See my activecontour demo, attached, if you or anyone needs a demo of that.
更多回答(2 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Contour Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!