Canny edge and now? Edge extraction - anyone?!
-
- Addict
- Posts: 2345
- Joined: Mon Jun 02, 2003 9:16 am
- Location: Germany
- Contact:
Canny edge and now? Edge extraction - anyone?!
Hello,
I need to find an algorithm for exact edge extraction from a canny edge result. I tried the hough transformation and the probabilistic hough transformation, but no one of them is generating good results. They either produce too much lines for one place or weird non existing lines in the middle of noisy areas and both are not reproducing all edges.
Can anyone tell me a better vectorizing algorithm for lines? I only know a good one for areas.
I need to find an algorithm for exact edge extraction from a canny edge result. I tried the hough transformation and the probabilistic hough transformation, but no one of them is generating good results. They either produce too much lines for one place or weird non existing lines in the middle of noisy areas and both are not reproducing all edges.
Can anyone tell me a better vectorizing algorithm for lines? I only know a good one for areas.
bye,
Daniel
Daniel
- codewalker
- Enthusiast
- Posts: 331
- Joined: Mon Mar 27, 2006 2:08 pm
- Location: Spain
Re: Canny edge and now? Edge extraction - anyone?!
dude, you're blowing my mind 

There is a difference between knowing the code and writing the code.
May the code be strong in your projects.
May the code be strong in your projects.
Re: Canny edge and now? Edge extraction - anyone?!
i already worked on the same problem and couldn't find a satisfying algorithm. I didn't try it yet, but you could use the "harris corner detector" to get the most important corners in your picture. If an edge is matching at least two corners, its a good edge. At this way you can maybe get rid of "bad" edges.
You could also try to use another convolution (I used sober instead of candy).
You could also try to use another convolution (I used sober instead of candy).
pb 5.11
-
- Addict
- Posts: 1676
- Joined: Sun Dec 12, 2010 12:36 am
- Location: Somewhere in the midwest
- Contact:
Re: Canny edge and now? Edge extraction - anyone?!
QFTcodewalker wrote:dude, you're blowing my mind

-
- Addict
- Posts: 2345
- Joined: Mon Jun 02, 2003 9:16 am
- Location: Germany
- Contact:
Re: Canny edge and now? Edge extraction - anyone?!
First of all: thanks for your answer gnasen.

Does harris corner detector really get all corners? I think I'll loose more edges with it if I combine the standard hough with finding line segments through harris corner detection, because some corners won't match the exact corners or are lost completely.gnasen wrote:i already worked on the same problem and couldn't find a satisfying algorithm. I didn't try it yet, but you could use the "harris corner detector" to get the most important corners in your picture. If an edge is matching at least two corners, its a good edge. At this way you can maybe get rid of "bad" edges.
With sober you mean sobel? I don't know every of those algorithms, that's why I'm asking.gnasen wrote:You could also try to use another convolution (I used sober instead of candy).
codewalker wrote:dude, you're blowing my mind
Zach wrote:QFT


bye,
Daniel
Daniel
Re: Canny edge and now? Edge extraction - anyone?!
you have a variable called "corner response" k, which can be used to make the detector more strict or tolerant. I can send you a script with the background information if I can find it.DarkDragon wrote: Does harris corner detector really get all corners? I think I'll loose more edges with it if I combine the standard hough with finding line segments through harris corner detection, because some corners won't match the exact corners or are lost completely.
An idea would be to step through the "sharpness" of the detector and count how much edges would fall away with every step if you compare the edges with the corners. You could plot this as a step function f(k) = count_reject(k) / total_edges and maybe look for a max/min/inflection. Then take the result at step min/max/inflection. Just as an first idea.
yes sobel, sorry for the typoDarkDragon wrote: With sober you mean sobel? I don't know every of those algorithms, that's why I'm asking.

pb 5.11
-
- Addict
- Posts: 2345
- Joined: Mon Jun 02, 2003 9:16 am
- Location: Germany
- Contact:
Re: Canny edge and now? Edge extraction - anyone?!
I have another idea and it seems to work somehow good already:
With this you can get a perfect vectorization from your edges, but it seems to be a lot overkilled! And its buggy right now .. as some parts of the polygons aren't rejected.
- Vectorize the edges as areas.
- To get poly-lines from the edges split the closed polygons, with the condition that every deleted segment from the polygon is either looking to the left or straight upwards.
With this you can get a perfect vectorization from your edges, but it seems to be a lot overkilled! And its buggy right now .. as some parts of the polygons aren't rejected.
bye,
Daniel
Daniel
Re: Canny edge and now? Edge extraction - anyone?!
without seeing what your input is it's really hard to say what would be the best method
houghs are really only of use when your looking for specific lines of interest
A canny is like a gausian blur with a sobel , did you try a laplacian? they often have better results for noise
houghs are really only of use when your looking for specific lines of interest
A canny is like a gausian blur with a sobel , did you try a laplacian? they often have better results for noise
Windows 11, Manjaro, Raspberry Pi OS


Re: Canny edge and now? Edge extraction - anyone?!
Honestly, I dont get it. I think a little outline/picture would help muchDarkDragon wrote:I have another idea and it seems to work somehow good already:Now you've got all segments from the polygon left, which look to the right or straight downwards. As they formed the edge of the edge you have to shift this a litte bit towards the edge (it matters in which order the polygons are defined, clockwise or anticlockwise)
- Vectorize the edges as areas.
- To get poly-lines from the edges split the closed polygons, with the condition that every deleted segment from the polygon is either looking to the left or straight upwards.

pb 5.11
-
- Addict
- Posts: 2345
- Joined: Mon Jun 02, 2003 9:16 am
- Location: Germany
- Contact:
Re: Canny edge and now? Edge extraction - anyone?!
Thanks for your answers.
http://www.bradan.eu/files/vectorizationOfEdges.png
This works quite well, but in some situations it still has problems. And after this you can shift the lines towards the real edge with a simple shift by the edge normal and the dilatation radius.
If you want my full name for this new invented algorithm using marching squares, let me know or look at my homepage
.
My input consists of any photos chosen by the user. Then I modify it with an bilateral filter, convert it to grayscale and use the opencv canny edge variant (which is not a true canny edge, as there would be no sobel in it).idle wrote:without seeing what your input is it's really hard to say what would be the best method
Yes, I first thought that would be enough, but it isn't. Well I was able to filter the output of the probabilistic hough transformation, so that small parallel lines which have a small distance get connected to a bit longer lines.idle wrote:houghs are really only of use when your looking for specific lines of interest
I didn't try yet, thanks for the hint. But the extraction of those lines is more a problem than canny edge itself. I would like to have an algorithm which lets me specify the segment minimum length and then it tries to fit the whole edge image with lines that are longer. Not only the best edges, also all other edges.idle wrote:A canny is like a gausian blur with a sobel , did you try a laplacian? they often have better results for noise
This sketch explains it, but I've changed the condition, as holes in polygons may produce the same edges again if you're not having all polygons described in the same way (clockwise or anticlockwise):gnasen wrote:Honestly, I dont get it. I think a little outline/picture would help much
http://www.bradan.eu/files/vectorizationOfEdges.png
This works quite well, but in some situations it still has problems. And after this you can shift the lines towards the real edge with a simple shift by the edge normal and the dilatation radius.
If you want my full name for this new invented algorithm using marching squares, let me know or look at my homepage

bye,
Daniel
Daniel
Re: Canny edge and now? Edge extraction - anyone?!
I still don't fully understand what you're aiming to achieve.
Do you have an example images of your input and the desired output?
It sounds like it'll be a difficult problem if it's intended to work on arbitrary input
and there are so many ways to skin the cat.
Do you have an example images of your input and the desired output?
It sounds like it'll be a difficult problem if it's intended to work on arbitrary input
and there are so many ways to skin the cat.
Windows 11, Manjaro, Raspberry Pi OS


-
- Addict
- Posts: 2345
- Joined: Mon Jun 02, 2003 9:16 am
- Location: Germany
- Contact:
Re: Canny edge and now? Edge extraction - anyone?!
With this as input image I will get this from canny edge and then I want exactly those edges as vectorized polyline, or if not possible as longest lines approximation. For the longest lines is p. hough transformation enough, but for the smaller ones it creates lines which only hit the real edge by 2 pixels or such. And it cuts long lines in some cases. Have a look at this. The first car's side window is full of edges which are very small, but not really belonging to a real edge. P. Hough transformation is good for long lines, but I also need the small lines! My goal would be something like this if every connected color represents one vectorized line: http://en.wikipedia.org/wiki/File:Valve ... ur_(4).PNG and this was the input image: http://en.wikipedia.org/wiki/File:Valve ... ny_(6).PNGidle wrote:I still don't fully understand what you're aiming to achieve.
Do you have an example images of your input and the desired output?
It doesn't need to be very fast. It is allowed to calculate a minute or two on a usual pc.idle wrote:It sounds like it'll be a difficult problem if it's intended to work on arbitrary input
and there are so many ways to skin the cat.
bye,
Daniel
Daniel
Re: Canny edge and now? Edge extraction - anyone?!
If you've got time to process the image then I'd probably go in to frequency space to process the image
and use a high pass filter like a butterworth to bring out the edges. Then use morphological operations
dilate and Errodes on the inversed FFT image.
You could possibly also use a hough in frequency space to find the best candidate angles
in the image or maybe even filter the FFT with the hough, never tried it so don't know if it'd work.
Don't know if openCV exports an FFT and filter functions but it will have one
and use a high pass filter like a butterworth to bring out the edges. Then use morphological operations
dilate and Errodes on the inversed FFT image.
You could possibly also use a hough in frequency space to find the best candidate angles
in the image or maybe even filter the FFT with the hough, never tried it so don't know if it'd work.
Don't know if openCV exports an FFT and filter functions but it will have one
Windows 11, Manjaro, Raspberry Pi OS


Re: Canny edge and now? Edge extraction - anyone?!
Now, seriously, anybody ever wondered why they consider programmers 'geeks'? I mean, the last time a girl talked to me that way, I pulled up my trousers and left...idle wrote:... I'd probably go in to frequency space to process the image and use a high pass filter like a butterworth to bring out the edges. Then use morphological operations dilate and Errodes on the inversed FFT image. You could possibly also use a hough in frequency space to find the best candidate angles in the image or maybe even filter the FFT with the hough, never tried it so don't know if it'd work. Don't know if openCV exports an FFT and filter functions but it will have one
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
( The path to enlightenment and the PureBasic Survival Guide right here... )
Re: Canny edge and now? Edge extraction - anyone?!
good pointblueznl wrote:Now, seriously, anybody ever wondered why they consider programmers 'geeks'? I mean, the last time a girl talked to me that way, I pulled up my trousers and left...

pb 5.11