Jump to content

  • Log In with Google      Sign In   
  • Create Account

Sobel edge detector


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
9 replies to this topic

#1 udvat   Members   -  Reputation: 111

Like
0Likes
Like

Posted 18 February 2013 - 09:35 PM

Hi,
 
I need to find edges in an image in an arbitrary direction. I found sobel or other edge detectors
work for horizontal and vertical directions only. Is it possible to extend these to work for any
arbitrary direction?
 
Thanks in advance.


Edited by Michael Tanczos, 18 February 2013 - 10:20 PM.


Sponsor:

#2 L. Spiro   Crossbones+   -  Reputation: 13599

Like
0Likes
Like

Posted 18 February 2013 - 11:45 PM

Because it works with both horizontal and vertical directions, it is possible to make diagonals and any other direction.

Sobel2.jpg
 
 
L. Spiro


Edited by L. Spiro, 19 February 2013 - 06:09 AM.

It is amazing how often people try to be unique, and yet they are always trying to make others be like them. - L. Spiro 2011
I spent most of my life learning the courage it takes to go out and get what I want. Now that I have it, I am not sure exactly what it is that I want. - L. Spiro 2013
I went to my local Subway once to find some guy yelling at the staff. When someone finally came to take my order and asked, “May I help you?”, I replied, “Yeah, I’ll have one asshole to go.”
L. Spiro Engine: http://lspiroengine.com
L. Spiro Engine Forums: http://lspiroengine.com/forums

#3 udvat   Members   -  Reputation: 111

Like
0Likes
Like

Posted 20 February 2013 - 12:17 AM

Thanks for your reply. I know how to make it work for horizontal, vertical and diagonal edges. Could you please add some more details for

an edge which is not either of these types?



#4 DDoS   Members   -  Reputation: 312

Like
0Likes
Like

Posted 20 February 2013 - 08:27 AM

Thanks for your reply. I know how to make it work for horizontal, vertical and diagonal edges. Could you please add some more details for

an edge which is not either of these types?

you have to combine vertical and horizontal detectors:

http://en.wikipedia.org/wiki/Sobel_operator

 

use Gx and Gy as described to compute vertical and horizontal gradients

then combine those to the gradient G= sqrt(Gx² + Gy²) or a approximated gradient G= |Gx|+|Gy| (much faster)



#5 L. Spiro   Crossbones+   -  Reputation: 13599

Like
0Likes
Like

Posted 20 February 2013 - 07:13 PM

Thanks for your reply. I know how to make it work for horizontal, vertical and diagonal edges. Could you please add some more details for

an edge which is not either of these types?

The Sobel filter already handles all directions.  There is nothing extra you have to do.  The image I posted was made using a standard non-modified Sobel filter, which is in its full form in the link above.

 

 

L. Spiro


Edited by L. Spiro, 20 February 2013 - 07:16 PM.

It is amazing how often people try to be unique, and yet they are always trying to make others be like them. - L. Spiro 2011
I spent most of my life learning the courage it takes to go out and get what I want. Now that I have it, I am not sure exactly what it is that I want. - L. Spiro 2013
I went to my local Subway once to find some guy yelling at the staff. When someone finally came to take my order and asked, “May I help you?”, I replied, “Yeah, I’ll have one asshole to go.”
L. Spiro Engine: http://lspiroengine.com
L. Spiro Engine Forums: http://lspiroengine.com/forums

#6 udvat   Members   -  Reputation: 111

Like
0Likes
Like

Posted 20 February 2013 - 07:14 PM

use Gx and Gy as described to compute vertical and horizontal gradients

then combine those to the gradient G= sqrt(Gx² + Gy²) or a approximated gradient G= |Gx|+|Gy| (much faster)

 

I do not agree. It will give me edges in horizontal and vertical directions. It's not for any arbitrary direction.



#7 L. Spiro   Crossbones+   -  Reputation: 13599

Like
0Likes
Like

Posted 20 February 2013 - 07:21 PM

use Gx and Gy as described to compute vertical and horizontal gradients

then combine those to the gradient G= sqrt(Gx² + Gy²) or a approximated gradient G= |Gx|+|Gy| (much faster)

 

I do not agree. It will give me edges in horizontal and vertical directions. It's not for any arbitrary direction.

You didn’t even read the link he gave.

A Sobel operator has 2 kernels, one for each direction, and then they are combined to create a new direction from both of those directions (basically).

Look at almost every single image in that link.

 

300px-Valve_sobel_%283%29.PNG

 

200px-Bikesgraysobel.jpg

 

Plus the image I provided at first.

 

 

It is obvious that a Sobel filter works with all directions.  What do you think a diagonal line is?  It’s a little bit of horizontal mixed with a little bit of vertical.

I don’t know what else you want us to say.

 

 

L. Spiro


Edited by L. Spiro, 20 February 2013 - 07:22 PM.

It is amazing how often people try to be unique, and yet they are always trying to make others be like them. - L. Spiro 2011
I spent most of my life learning the courage it takes to go out and get what I want. Now that I have it, I am not sure exactly what it is that I want. - L. Spiro 2013
I went to my local Subway once to find some guy yelling at the staff. When someone finally came to take my order and asked, “May I help you?”, I replied, “Yeah, I’ll have one asshole to go.”
L. Spiro Engine: http://lspiroengine.com
L. Spiro Engine Forums: http://lspiroengine.com/forums

#8 udvat   Members   -  Reputation: 111

Like
0Likes
Like

Posted 20 February 2013 - 07:25 PM

Hi L Spiro,

 

My intention is not to detect edges in all directions. Say, for a given direction u,

I want to detect edges that are alligned with this direction only. This u can be

anything.



#9 L. Spiro   Crossbones+   -  Reputation: 13599

Like
2Likes
Like

Posted 20 February 2013 - 07:29 PM

You completely did not say that at the beginning.

 

In any case, use a Sobel filter to get the Gx and Gy values.

The direction you want to find should be stored as a CVector2( X, Y ).

Create a new CVector2( Gx, Gy ) and normalize it.

 

The magnitude in the direction CVector2( X, Y ) is:

CVector2( X, Y ) DOT CVector2( Gx, Gy ).

 

 

Done and done.

 

 

L. Spiro


Edited by L. Spiro, 20 February 2013 - 11:01 PM.

It is amazing how often people try to be unique, and yet they are always trying to make others be like them. - L. Spiro 2011
I spent most of my life learning the courage it takes to go out and get what I want. Now that I have it, I am not sure exactly what it is that I want. - L. Spiro 2013
I went to my local Subway once to find some guy yelling at the staff. When someone finally came to take my order and asked, “May I help you?”, I replied, “Yeah, I’ll have one asshole to go.”
L. Spiro Engine: http://lspiroengine.com
L. Spiro Engine Forums: http://lspiroengine.com/forums

#10 udvat   Members   -  Reputation: 111

Like
0Likes
Like

Posted 20 February 2013 - 11:06 PM

Thank you. This is what I was looking for.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS