Re: Contour segmentation from raster maps

34 views
Skip to first unread message

Anthony Oliver

unread,
Feb 25, 2013, 2:26:27 PM2/25/13
to python...@googlegroups.com
I hacked this up pretty quick with SimpleCV.  It may not be exactly what you may need to do some parameter tweaking but can probably get you want you want.



Code:
from SimpleCV import Image
contour_img = i.colorDistance((178.0, 162.0, 128.0)).stretch(0,30).erode().invert()
contours = contour_img.findBlobs()
contours.show()



On Friday, February 22, 2013 5:17:34 PM UTC-5, zetah ven wrote:
Hi,

this doesn't seem like very active group, but writing anyway ( couldn't find other ;), and hopefully to get some pointers as I didn't get from Stack Exchange.
I'm comfortable in Python, and also love Gimp, so any pointer is welcome

I have topo map scan, like this excerpt (24bit unprocessed): http://i.imgur.com/b2vS5nO.jpg

I want to separate topological contours (brown lines in linked image). I tried everything that come to my mind, like custom thresholding, thinning, but as black lines and other objects are drawn over these brown contours I always get discontinued contours, which are later rather useless as I can't correct them one by one.

I thought that after thinning I'll get intersections in 1-2px, so that I can do binary dilation after separating just brown contours, but to my disappointment I can't reach it. I reduced image to 6 color palette and here is thinning result:
http://i.imgur.com/YgwSn6t.png It's better than nothing, but removing all colors but brown, still results in many disconnected contours.

I then started googling, and found some papers, like: "Image Segmentation Based on Variation Calculus", "
Image Segmentation Using Active Contours", and the like, which show just bare mathematical formalae that can't be easily implemented even through Python.

Thanks

Reply all
Reply to author
Forward
0 new messages