Edge detection in raster images ->polylines around dark areas

Edge detection in raster images ->polylines around dark areas

autoMick
Advisor Advisor
4,072 Views
7 Replies
Message 1 of 8

Edge detection in raster images ->polylines around dark areas

autoMick
Advisor
Advisor

Hi, 

I have a project where I want to semi-automatically create polygons which outline dark areas on an underlying aerial photo. The dark areas are estuarine seagrass beds and we have lots of ground to cover. I've attached a few snips to play with.

The ideal situation is that I would be able to set some threshold contrast levels, then click anywhere within the dark patch and then map3d would detect the edge of the dark area and create a polyline that best fits the edge within given node density settings.

So in the pic below:

I would click where the red X is and the bed would be outlined just like the others. I don't expect miracles, just a technique that would work 80% of the time to take the edge off the number of manual polylines to be created.

Is it possible?

Thanks

- Mick

Capture.PNG

Civil3d user in Australia since 2012.
0 Likes
Accepted solutions (2)
4,073 Views
7 Replies
Replies (7)
Message 2 of 8

Pointdump
Consultant
Consultant

G'day Mick,

 

In Map 3D, I dunno. But in QGIS, there's the cool "Polygonize" function:

 

Polygonize.png

 

 

 

Dave

Dave Stoll
Las Vegas, Nevada

EESignature

64GB DDR4 2400MHz ECC SoDIMM / 1TB SSD
NVIDIA Quadro P5000 16GB
Windows 10 Pro 64 / Civil 3D 2025
Message 3 of 8

autoMick
Advisor
Advisor

Thanks for the suggestion Dave, I'll have a look at that. I'm starting to think though that the contrast variation around the image is going to be an issue. I remember years ago I used to use a program called NIH Image in a completely different situation (analysis of fish earbones!). NIH Image had a feature where you could select the colour spectrum and adjust a slider to create a binary boundary, which then could be identified/analysed. Ideally something like this would be good in the GIS space.

Cheers

- Mick

Civil3d user in Australia since 2012.
0 Likes
Message 4 of 8

Pointdump
Consultant
Consultant

Mick,

 

I got to thinking, how about Raster Design? I've heard about it but never used it. I've seen YouTubes that show how to pull linework from a raster, like creating linework from a photo of a floorplan.

 

Fish earbones, eh? I guess somebody has to figure out if fish can hear what we're saying. I'll watch my language next time I'm snorkling.

 

Dave

Dave Stoll
Las Vegas, Nevada

EESignature

64GB DDR4 2400MHz ECC SoDIMM / 1TB SSD
NVIDIA Quadro P5000 16GB
Windows 10 Pro 64 / Civil 3D 2025
0 Likes
Message 5 of 8

autoMick
Advisor
Advisor

Pointdump wrote: I'll watch my language next time I'm snorkling.

It's OK Dave, you can say what you like. Because:

1. fish are pretty thick skinned;

2. when you speak while snorkelling, it's pretty hard to make out what you're saying; and

3. all the words come out the top of the snorkel anyway.

 

On topic - I did look at Raster Design and tried playing around with the various filters (create a bitonal image/smooth then try and use the various vectorize followers) - there was some promise (see pic below based on one of my posted images) but nothing that actually got a result. Parts of the image clean up nicely, other parts are unusable. Apart from that I couldn't find a tool that take me in the direction I wanted.

thanks for the suggestion though

- Mick

 

Capture.PNG

Civil3d user in Australia since 2012.
0 Likes
Message 6 of 8

lim.wendy
Alumni
Alumni
Accepted solution

Hi Mick,

 

AutoCAD Raster Design may be able to do it as mentioned by Pointdump but may need a lot of manual work. Smiley Frustrated
I found that Inkscape maybe able to do the job you mentioned. 

Here's a video I recorded on the workflow. 


See also: Inkscape tutorial: Tracing bitmaps
If there is anything else we can help you with, please let me know. Happy Friday!


 Smiley Happy



Wendy Lim

Data Nerd | Community Advocate | AEC Industry


facebook twitter twitter blogs pm


Join the new online Rail Community


Rails Summit




Message 7 of 8

autoMick
Advisor
Advisor
Accepted solution

Thanks Wendy.

Nice job ! - I think that will work for me. I like how inkscape can let you filter colours or greyscale as well as modify the number of passes, etc. As it happens, different filters work better depending on the image.

The result is a heap of splines (see pics below - which were my test images), so my next steps were to delete the extraneous ones, then JOIN the ones representing each individual seagrass bed, then SPLINEDIT to convert to polylines (using lowest precision), then I found WEEDFEATURES was also needed just to get the number of vertices to a reasonable level.

For the simple outlines it is still quicker to manually create the polyline, but for the complex areas the result is better than I was anticipating.

Cheers

- Mick

 

Capture.PNGCapture2.PNG

Civil3d user in Australia since 2012.
Message 8 of 8

autoMick
Advisor
Advisor

Another thing I stumbled across was that it wasn't actually necessary to convert the splines or weedfeatures. I found that if I mapexported the splines as lines to a shapefile, and then reimported them, I had simplified polylines ready to go.

Cheers

- Mick

Civil3d user in Australia since 2012.