Talk:Sobel operator

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Costella Kernel[edit]

Personally, I would prefer to see this referenced from a journal paper or something rather than a website, and if it is to be included then there should be some explanation of how it works. —Preceding unsigned comment added by 137.219.45.107 (talk) 05:57, 28 March 2011 (UTC)[reply]

It appears to be original research, and thus should not be in Wikipedia. Wiki sez:

Wikipedia articles must not contain original research. The term "original research" (OR) is used on Wikipedia to refer to material—such as facts, allegations, ideas, and stories—for which no reliable published source exists.[1] That includes any analysis or synthesis of published material that serves to advance a position not advanced by the sources. Which is what the Costella Kernel appears to be. 67.215.48.194 (talk) 14:38, 20 July 2011 (UTC)[reply]

The "Costella operator" idea and an accompanying citation of a self-published paper have been added to Roberts Cross and Prewitt operator by the same user, User:DrJohnPCostella, apparently the author of the self-published paper. This seems to violate WP:ORIGINAL, WP:SELFPUBLISH, and WP:SELFCITING. I am removing these references on all those pages and linking to this discussion on the relevant talk pages. — Control.valve (talk) 18:35, 12 September 2011 (UTC)[reply]

"Solving"[edit]

I'm a university AI student who's done a module in Computational Vision, and still I don't understand the first line: "a discrete differentiation operator solving for the 1st derivatives". What does the "solving" mean?

Well, I think the "solving" is in the algebraic sense, as in "Solve the following equation for x" which basically means "Find the value of x", but I agree that that was a horrible way to start the article, useful only to seasoned mathematicians. I've tried to add a more "general audience" explanation of what the operator actually does. - IMSoP 22:30, 16 December 2005 (UTC)[reply]

Technical Details - Matrix maths wrong way round[edit]

Surely the matix maths in the Technical Details section is the wrong way round. The result shown would make Gx and Gy = 0. It should be a 3x1 column * 1x3 row = 3x3 matix.

Technical Details - Convolution operator get confuse with the times operator[edit]

First we get a squared matrix with a 3x1 matrix multiplied by a 1x3 row (so the times operator )

Then we convolve the squared matrix with the input image to get another image, in this case the Gy derivative (and the convolution operator is used):

And, because they are separable in both and directions, we can write it as:

Comment--A person with some math & computer science background will see that the operator used for multiplication of the two vectors of length n is that of outer product not inner product nor matrix nor vector arithmetic. Both an inner and matrix arithmetic product would effectively reduce the dimensionality to a single scalar for a couple of these, but instead an outer product that increases the dimensionality from two n-length vectors to a n by n square matrix is used, where n=3.
Whereas the language explaining the application of the filter was nicely simplified, the formation of the filters still requires this additional characterization that outer products are being used to do it. Could someone make this addition to the article? Oldspammer (talk) 19:27, 16 February 2012 (UTC)[reply]

Question: Am I reading carelessly or does the convolution K just appear out of the blue? "Applying convolution K to pixel group P ..." Is it called something else earlier in the description?NiVeMa (talk) 13:27, 1 September 2016 (UTC)[reply]

Simple Description[edit]

"giving the direction of the largest possible increase from light to dark"

I think "light to dark" is backwards, since usually dark is 0 and light is 1. And in fact, isn't it redundant since you say the largest possible "increase" ?

Ian Stewart

Convolution Mask Notation[edit]

This is just a notational comment because I was slightly confused when reading the section defining the convolution matrices for the x and y partial derivatives. When you write:

It is technically correct, because convolution is defined as

i.e. the convolution kernel (f in this case) is flipped around before being applied to g. The above convolution masks give the technically correct definition the partial derivatives since the masks will be flipped around before applied to the image. However, in my experience in the image processing world, you never see convolution matrices (masks) written this way. They are always reversed with the convolution defined differently than above, which is why I was initially confused by this section. They would then be

Is this anyone else's experience too or am I the only one? It's just that when I looked at the convolution matrices I thought "that's not right, they seem to be backwards of the approximation of the partial derivatives." --Paul Laroque (talk) 19:10, 11 April 2009 (UTC)[reply]

By the way, it is defined this way in Edge detection#Other first-order methods if you take right and up to be positive orientations. Maybe one should be changed? --Paul Laroque (talk) 19:21, 11 April 2009 (UTC)[reply]

First, your "flipped around" means more exactly that the filter is flipped/mirrored in both x and y directions, i.e., rotated 180 degrees (in the case of 2D filtering). There may be some examples where authors don't care to deal with this issue, either because their implementation of convolution between a signal and a filter implicitly takes care of the flipping, or because the particular application is invariant to this transformation of the filter, but in order to minimize confusion the filter should be presented in a correct way. To add to the confusion, there is no well-established interpretation of what is meant by x and y coordinates in image processing. Mathematicians tend to think that the x-axis is pointing right and the y-axis is pointing up, whereas most image coordinates systems have x (first coordinate) pointing down and y (second coordinate) pointing right (with the origin typically at the top-left corner, but this is not important for convolution). The article uses the first coordinate system. --KYN (talk) 11:00, 12 April 2009 (UTC)[reply]


I understand the conventions used in the article. I am just trying to point out that I have rarely seen the Sobel operator written this way. Even in the page linking to this one, Edge detection#Other first-order methods, it is not defined this way. The first few hits from a google search of "sobel filter" give these:

which all give the convolution mask reversed. I think this is common because you're not really meant to think of the sobel operator as a filter in the sense that you don't care what it does in the frequency domain, you care that it approximates a partial derivative (smoothed in the orthogonal direction). I just wanted to point out that I was confused when I first saw the convolution masks in this article and I had to scan down the article to find the definition of convolution to see that they actually made sense. And I have significant experience in image processing, so I'm sure others will be confused as well. For example, if someone were to use Gimp to implement these after reading the article, they would have to know that they should be reversed before typing them into Gimp. --Paul Laroque (talk) 13:32, 12 April 2009 (UTC)[reply]

What you are pointing our seems to be a general problem of how the convolution operation is described in various software, rather than someting related to the Sobel operator in specific. If you look at cross correlation, you will find that this is the operation that appears to called "convolution" in certain contexts. --KYN (talk) 10:03, 13 April 2009 (UTC)[reply]
+1 Paul. This is more than a notational comment, it's a matter of consistency. First, the article shows the matrices in the order Gy, then Gx; it would seem logical to present them in the same order as everybody else: Gx, then Gy. But more importantly, the article cites this page: http://homepages.inf.ed.ac.uk/rbf/HIPR2/sobel.htm while in fact this page defines the Gy matrices differently than what is shown in the article! Which one should it be? Well I believe I've found a way to settle it once and for all: Irwin Sobel's paper itself, which is the original source, and so arguably the most authoritative source, uses the same order as the sobel.htm page cited, in other words:
See http://www.researchgate.net/publication/239398674_An_Isotropic_3_3_Image_Gradient_Operator
I suggest we change the article to use this order, and make it explicit that this is the original definition. What do you say?
Mwipliez (talk) 13:18, 25 January 2015 (UTC)[reply]
PS: apologies if formatting is incorrect, but I don't know what the standard is for comments

Scharr not the ultimate solution[edit]

At the bottom of the page, it states that the Sobel operator does not have perfect rotational symmetry. I read this as not being perfectly isotropic. I agree with that. Scharr's attempt to improve this, (I don't know from what time frame), is . In literature, I even found another operator actually called the Isotropic Operator, which equals the kernels but also gives disappointing non-isotropic results.

Well, In April of 2008, I did a research for the most isotropic operator, as part of the course Image Processing at Utrecht University. Here I considered the generalized operator where I limited the search space to one degree of freedom where . Though I have no formal proof, I did found that the operator with gives equal rotational symmetry for all multiples of 45 degree (which is an improvement on both Sobel or Isotropic operators which are rotationally symmetric for all multiples of 90 degrees). The results look far more pleasing to the eye as the Sobel or Isotropic filters, and the rotational symmetry is nearly indistinguishable from prefect isotropy. --Zom-B (talk) 22:49, 7 May 2009 (UTC)[reply]


Djexplo (University of Twente): I have tested, your kernel values in combination with a Coherence filter from "A Scheme for Coherence-Enhancing Diffusion Filtering with Optimized Rotation Invariance" by Joachim Weickert and Hanno Scharr. As a test image I used a 2D image with circles I = sin(r^2). Then I performed Coherence filtering on the test image. The absolute error between the test image and the result of your kernel is smaller than with the kernel of Hanno Scharr. But if you plot the pixel errors as an image, the errors with your kernel values are more rectangular, than with the kernel of Scharr.

Can you please explain to me what the meaning of rotational symmetry is in this context? —Kri (talk) 17:42, 14 July 2011 (UTC)[reply]

Scharr not the ultimate solution 2[edit]

Djexplo (University of Twente): I have tested some first and second order derivatives kernels of size 3x3 and 5x5, including Sobel and Scharr. Scharr outperforms Sobel in rotational invariance, but Scharr is only one solution for a fixed image scale (Corresponds to a truncated Gaussian derivative kernel with a certain sigma). If you still want better rotational performance you can better switch to 5x5 derivative schemes, see my short paper: http://www.k-zone.nl/Kroon_DerivativePaper.pdf —Preceding undated comment added 15:07, 23 December 2009 (UTC).

arctan versus atan2[edit]

It's not correct to say that the gradient's direction can be computed as arctan(Gy/Gx). arctan returns an angle between -pi/2 and pi/2, not between -pi and pi as needed in most cases. (Obviously, this happens because information on the correct quadrant is only present in the signs of Gy and Gx, and that is lost in the division). Commonly, a two-argument function atan2(Gy, Gx) is used instead, which uses sign information and thus returns an angle between -pi and pi, as desired. 134.36.37.145 (talk) 15:54, 15 February 2011 (UTC)[reply]

Technical detail: A statement from the article need explanation[edit]

The following statement appears in the article "It turns out that the derivatives at any particular point are functions of the intensity values at virtually all image points." Since the derivative, by its nature, is a local property, some more explanation would be nice (perhaps an explanation of the assumptions mentioned earlier in the paragraph). — Preceding unsigned comment added by Emchristiansen (talkcontribs) 08:38, 16 April 2011 (UTC)[reply]

What does "rotational symmetry" mean?[edit]

Can someone please explain to me what rotational symmetry means? It says in the article that the Sobel operator "does not have perfect rotational symmetry", but it doesn't say what that actually means. If you answer, please also notify me at my talk page. —Kri (talk) 12:46, 14 July 2011 (UTC)[reply]

Rotational symmetry for edge-detectors means that they react the same to an edge regardless of its angle. "React the same" means slightly different things depending on the form of the output of your edge detector, but for example if you compute gradient vectors, the computed magnitude should be the same whether the edge is at 0°, 20°, 45°, or 90°. This is not always the case for edge detectors. A good test image for rotational symmetry of an edge-detector is a circular disk of uniform-intensity bright pixels on a uniform-intensity dark background. The detected edge should be a uniform-intensity (or width, or something equivalent, again depending on the output format of your detector) bright circle. Thresholding the magnitude of the gradient computed by the Sobel operator, for example, will produce a more uniform edge response close to the top, bottom, left, and right sides of the circle compared to the portions between them. — Control.valve (talk) 15:42, 14 September 2011 (UTC)[reply]

Dive topic into two pages[edit]

I think this page should be divided into two pages since it explains both the Sobel operator in general and also how to compute image derivatives in different ways. The latter is not covered by any wiki page as far as I can find. — Preceding unsigned comment added by The Code Blitzer (talkcontribs) 15:56, 21 June 2014 (UTC)[reply]

Maximum value[edit]

If this operator is used to generate a new image, given that pixel values in images are usually limited in range (e.g. 0 to 255), it would be important to know the maximum value this operator yields in order to scale down the result by this factor.

So, is the maximum value of this operator known? I found out through an example and some (non-extensive) mathematical analysis that it is somewhere between (4.47) and (5.29) times the pixel range, but I couldn't determine the exact value nor find information about it online.

--Cousteau (talk) 09:52, 1 August 2016 (UTC)[reply]

Separability and factorisation[edit]

Sobel kernels can be decomposed as the products of an averaging and a differentiation kernel [...] Furthermore, the two discrete filters described above are both separable:
and the two derivatives Gx and Gy can therefore be computed as
[...] This factors similarly:


The article emphasises two properties: a) that the 9-element kernel is the matrix product of two 3-element kernels; and b) that each 3-element kernel is the convolution of two 2-element kernels. What is the relevance/significance of property (b)? Cesiumfrog (talk) 23:39, 4 September 2016 (UTC)[reply]

Hast citation[edit]

The Hast article (citation [9]) does not seem to be notable, it is from 2014 and only has 3 citations according to the linked page. — Preceding unsigned comment added by 213.16.80.50 (talk) 15:14, 17 March 2017 (UTC)[reply]

I'm assuming that you are using the real world meaning of "notable" (not the 2nd Wiki meaning which is not applicable here). There is no rule that references have to be notable. The main most closely related rule is that if the content which cited it is challenged or is likely to be challenged, it must be referenced by a source which meets wp:rs criteria. Beyond that, unless the reference has other more serious problems, it's mainly a matter of editorial discretion. North8000 (talk) 16:53, 17 March 2017 (UTC)[reply]

What does "numerically consistent" mean?[edit]

The article states that Farid & Simoncelli's filters are not constrained to be numerically consistent, while Scharr's filters are. I was not able to find out what that means. Maybe this needs to be clarified in the article to highlight the difference between the two. — Preceding unsigned comment added by 176.199.143.179 (talk) 20:45, 25 March 2019 (UTC)[reply]

Sign and Direction[edit]

I believe some define the Sobel operator differently in the matter of the sign. Namely some define the operator as Gx=-Gx and Gy=-Gy. The effect is that the direction of the gradient now points in the opposite direction. Can someone please make an amendment to the article to make this point. In the literature I have seen it not clear what is the distinction between the direction of the edge and the direction of the gradient. From my understanding I do believe that the gradient direction is perpendicular to the edge. Namely the direction of the edge is parallel to the edge. Would someone please clarify this matter. — Preceding unsigned comment added by Macadamiaexpress (talkcontribs) 22:27, 27 February 2020 (UTC)[reply]

Code in julia?[edit]

Is the code written in julia not matlab?

In fact, the code is indeed written in matlab, but I added a julia implementation for reproducibility. Alexander-Barth (talk) 10:18, 25 August 2023 (UTC)[reply]
Which was redundant, so I removed it again. MrOllie (talk) 12:53, 25 August 2023 (UTC)[reply]
Can you explain why you think it is redundant? MATLAB is a proprietary program inaccessible to many. There are several other articles with multiple implementation (e.g. https://en.m.wikipedia.org/wiki/CORDIC#Software_example_(MATLAB)). Also the Julia implementation uses the same example image than the Wikipedia article and is less convoluted. Alexander-Barth (talk) 05:58, 26 August 2023 (UTC)[reply]
Also redundant, I removed one of those as well. I think it is redundant because it is - we don't need two implementations of the same thing. The purpose of Wikipedia is to explain a topic, not to be a repository of code people can cut and paste. It's also a place to write sourced content (See WP:NOR, WP:V). Your addition was unsourced. MrOllie (talk) 11:37, 26 August 2023 (UTC)[reply]
The MATLAB code is not sourced either. I am wondering why the MATLAB code should remain and the Julia code should go and not the reverse (Julia is open source, it uses the same example image as the article, the thresholding is more consicse). To me having as only example, an implementation in a proprietary language is problematic. 19:42, 26 August 2023 (UTC) Alexander-Barth (talk) 19:42, 26 August 2023 (UTC)[reply]
Ok, I removed that as well. Thanks for pointing that out. MrOllie (talk) 20:15, 26 August 2023 (UTC)[reply]
ok, I hope that I will be able to find the time to make a sourced implementation based on Sobel's article. I hope we can agree that this implementation can stay.
https://www.researchgate.net/publication/239398674_An_Isotropic_3x3_Image_Gradient_Operator . Alexander-Barth (talk) 06:16, 27 August 2023 (UTC)[reply]
It is not a 'sourced implementation' unless the exact source code is given by the cited source. We don't do original research here. Again, see WP:NOR, which I already linked for you above. MrOllie (talk) 12:20, 27 August 2023 (UTC)[reply]
Copying the exact source code could likely be a copyright violation.
Here are many more examples of source code examples on Wikipedia:
https://en.wikipedia.org/wiki/Visitor_pattern (C#, Smalltalk, Go, Java, Common Lisp, Python example)
https://en.wikipedia.org/wiki/Monte_Carlo_integration (C, Pyton, Mathematica example)
https://en.wikipedia.org/wiki/Jacobi_method (Python example)
https://en.wikipedia.org/wiki/Softmax_function (python, julia, R, Raku example)
https://en.wikipedia.org/wiki/Euler%E2%80%93Maruyama_method (python, matlab example)
https://en.wikipedia.org/wiki/Lorenz_96_model (python, julia)
...
(found by looking for "Python example" in the Wikipedia search box.)
They all do not quality as original research as they are straight-forward implementations of the method or algorithm in the cited in the references. Alexander-Barth (talk) 20:03, 27 August 2023 (UTC)[reply]
WP:OTHERSTUFF. It is more likely that those other instances need to be removed than your WP:OR should be allowed to stay. MrOllie (talk) 20:12, 27 August 2023 (UTC)[reply]

Wrong Gary Feldman linked[edit]

It was actually Gary M Feldman, not the linked Gary J Feldman. Dougf613 (talk) 04:16, 12 June 2023 (UTC)[reply]

Merge proposal[edit]

I have tagged this article and Irwin Sobel with a merge tag. The Irwin Sobel article is just three sentences, cited to a primary source and a directory profile, and as such the notability of the topic is in question, in spite of having an image processing operator named after him.

I suggest moving the two sentences about the Sobel operator to this article and redirecting Irwin Sobel here. There just isn't enough information about Irwin Sobel to merit a standalone article. ~Anachronist (talk) 22:27, 5 September 2023 (UTC)[reply]

  • Oppose I don't see the quality of either article being improved by that. In particular it reduces the biography to "He invented the Sobel operator, nothing more than that" which is quite unfair (the Stanford Hand-Eye project for another equally early, yet wide-reaching piece of work). Andy Dingley (talk) 22:38, 5 September 2023 (UTC)[reply]
    I am not suggesting reducing the biography, I am suggesting eliminating it and making it a redirect, after merging the couple of sentences about the origin of the Sobel operator to this article. That would be a slight improvement to this article, and whatever is in the biography doesn't merit a standalone article anyway. ~Anachronist (talk) 22:43, 5 September 2023 (UTC)[reply]
  • So you're judging the entire potential of a bio article by its current state? Do you really think he did nothing after the '60s? Andy Dingley (talk) 22:46, 5 September 2023 (UTC)[reply]
  • Oppose, at least in the short term. Give the biography three months for amplification (or not). If by then it hasn't been amplified, then merge; if it has been, don't. -- Hoary (talk) 00:01, 6 September 2023 (UTC)[reply]
  • Oppose (strongly): WP is not pay-per-page, and this significantly reduces information on Irwin Sobel.MüllerMarcus (talk) 15:47, 14 December 2023 (UTC)[reply]
  • Oppose Two completely different topics. One is a person, the other is a mathematical operator. Sincerely, North8000 (talk) 16:22, 14 December 2023 (UTC)[reply]
  • Support, by WP:1E: notable only for the Sobel operator and hence the biography should be merged there. There are many senior researchers at HP Labs, and this is not a recognized criterion for independent notability. Klbrain (talk) 07:36, 26 February 2024 (UTC)[reply]

Operator sign[edit]

The sign for the x derivative is currently reversed in the “formulation” section, but not in other parts of the article. In the revision history I see this being fixed and reverted over and over again. I will fix it again, but have no hopes another anonymous user is it going to revert it to be wrong again.

The correct sign for the x derivative has positive values on the left, negative ones on the right. For the y derivative it has positive values on top, negative ones on the bottom (with top and left being smaller indices).

This is the formulation used for the convolution, as it is applied in the article. Some libraries and books use correlation instead of convolution, and therefore define the operator mirrored.

One can see that the signs are correct by applying the operator to a ramp image, the derivative will be positive for a positive ramp (increasing in value to the right or bottom). crisluengo (talk) 14:59, 5 February 2024 (UTC)[reply]

It is unfortunate that the website linked to in this section also shows the wrong sign for the x derivative but not the y derivative. Weird! — Preceding unsigned comment added by Crisluengo (talkcontribs) 15:17, 5 February 2024 (UTC)[reply]

I have read Sobel’s text explaining his operator, and now understand why his definition differs from the sensical one. I have added this explanation to the “formulation” section, hopefully this now puts to rest the sign issues. crisluengo (talk) 15:38, 5 February 2024 (UTC)[reply]