# opencl and sobel

This topic is 1872 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

hello.
I have this problem with sobel filter:
when the sobel filter finds an edge of a line, it finds the initial up edge and the end edge , then,a line in the sobel filter have two edge?.
Is possible to eliminate this behaviour and show only the start edge?
i'm trying to filter some letters in a texture but the words after the sobel filter are enlarged and confused.

for understand better the sobel filter:
The matrix system is a method for gain-time for find the edges?
isn't possible to test pixel for pixel the difference of color of neighbors pixels and see if it's in a range and if it is select the pixel?
it's only a compute method?
thanks.

##### Share on other sites
[quote name='giugio' timestamp='1354633499' post='5007092']
for understand better the sobel filter:
[/quote]
The double line is an effct of the sobel filter. The filter works on a pixel, therefor when sobel detects an edge at a pixel, it will detect it too on the other side too:

[CODE]
xxoo
xxoo
xxoo

[/CODE]
apply sobel on all x

[quote]
xXoo
xXoo
xXoo

[/quote]

apply soble on all o

[quote]
xXOo
xXOo
xXOo

[/quote]

There are several solutions:
1. Use the stencil buffer to detect the edge only on parts of the screen, e.g. the x surface only.
2. Use double resolution and scale it down afterwards (or use multisampling).
3. Use an other AA technique to make it less obviously. Edited by Ashaman73

##### Share on other sites
[quote name='Ashaman73' timestamp='1354690184' post='5007320']
The double line is an effct of the sobel filter. The filter works on a pixel, therefor when sobel detects an edge at a pixel, it will detect it too on the other side too:

There are several solutions:
1. Use the stencil buffer to detect the edge only on parts of the screen, e.g. the x surface only.
2. Use double resolution and scale it down afterwards (or use multisampling).
3. Use an other AA technique to make it less obviously.
[/quote]

very thanks Ashaman73,
I see your solutions but i'm a little newbe, can you explain me better a solution? the more simplest or post a link or a book and I study alone.

by.

##### Share on other sites
It depends on the requirements. What is your goal ? Have you examples of how it should look like ? Not every solution is suitable for all scenarios. E.g. rendering to an higher resolution and sampling it down (super sampling) will have a very good quality, but on the other hand makes the rendering of your scene ~4 times slower, which is often not feasible.

Edit:
A fast way to evaluate the AA option is to play around with the AA settings of your video card. Edited by Ashaman73

##### Share on other sites
my goal is to find edge on images(.jpg or tiff ecc..) taken from the scan of html tables with a border of a pixel.
I use opencl and 4 time slower is not a problem.
What is super sampler ?

##### Share on other sites
[quote name='giugio' timestamp='1354714545' post='5007387']
my goal is to find edge on images(.jpg or tiff ecc..)
[/quote]
uggh... well I thought, that you were talking about rendering outlines or something like this. In your case, image analysing, the solutions I sugguested will not work. If performance isn't an issue, have you played around with edge filters of image processing tools like photoshop or gimp ?

##### Share on other sites
[quote name='Ashaman73' timestamp='1354719159' post='5007409']
[quote name='giugio' timestamp='1354714545' post='5007387']
my goal is to find edge on images(.jpg or tiff ecc..)
[/quote]
uggh... well I thought, that you were talking about rendering outlines or something like this. In your case, image analysing, the solutions I sugguested will not work. If performance isn't an issue, have you played around with edge filters of image processing tools like photoshop or gimp ?
[/quote]

the performance are not an issue because i use opencl , but my goal is to create template tables and finding with the project after select a new table image, what is the most similar model from the analized(i use c++ and mysql for the models).
Then the performance are a little issue with opencl.
now for starting i would create o adapt a single edge sobel detector.
i found this on canny:
http://dasl.mem.drexel.edu/alumni/bGreen/www.pages.drexel.edu/_weg22/can_tut.html
the third image is a single edge canny.
thanks again