StrataQuest Home › StrataQuest Glossary › Sobel Filter
BOM Operation

Sobel Filter

Gradient computation for edge detection and membrane analysis

View
Definition
StrataQuest offers three Sobel filters, each its own operation under Filters. Sobel filter (horizontal) and Sobel filter (vertical) convolveLoading... the image with a fixed 3 × 3 kernel that approximates the derivative along one axis. Sobel filter (cross) approximates a second-order derivative on the diagonal, with a 3 × 3 or 5 × 5 kernel. Each returns one grayscale image in which high intensity variations stand out.
Three operations, no selector
Horizontal, vertical and cross are separate
One derivative per image
No magnitude or direction output
Cross is second-order
Diagonal variations, 3 × 3 or 5 × 5
Smoothing built into the kernel
In general, difference one way, average the other

How It Works

Take a single row of pixels crossing the bright edge of a nucleus: 10, 10, 10, 60, 110, 110. The change from pixel to pixel is 0, 0, 50, 50, 0: large on the climb, zero on the flats. A derivative filter computes that change at every pixel, so a flat region comes out near zero and an edge stands out.

StrataQuest's Sobel filter (horizontal) does this along the horizontal axis. Its predefined 3 × 3 kernel is convolved with the image to approximate the derivative on the horizontal, so pixels in the result emphasize high variations of intensity along that axis. Sobel filter (vertical) does the same on the vertical axis, and Sobel filter (cross) uses one of two predefined kernels to approximate second-order derivatives on the diagonal.

The reference's Effect lines don't quite agree with its descriptions. The horizontal filter's Effect says it detects horizontal edges, while in general a derivative along the horizontal axis responds most to edges that run vertically; the vertical filter's Effect says diagonal edges. Go by the descriptions, and check on a test image which edges light up.

In image processing generally, the standard Sobel kernels are the two below. The reference shows its kernels only as figures, so compare before relying on the signs.

  • Gx = [−1 0 1; −2 0 2; −1 0 1]: difference left to right, average top to bottom
  • Gy = [−1 −2 −1; 0 0 0; 1 2 1]: difference top to bottom, average left to right

A derivative is signed: a rising edge gives a positive value and a falling edge a negative one. The reference examples return 8-bit grayscale images, which hold no negative values, and the reference doesn't say how the sign is handled. Check whether both sides of a nucleus light up before treating the output as edge strength.

Simplified

A Sobel filter measures, at every pixel, how sharply brightness is changing in one direction. Flat regions come out dark and edges come out bright. StrataQuest has three: one for the horizontal direction, one for the vertical, and a cross version for the diagonal.

Image Processing Foundation

In image processing generally, Sobel belongs to the first-derivative gradient operators, which find edges by how fast intensity changes. Horizontal and vertical Sobel are of this kind. A first derivative is zero on flat stretches and nonzero along a ramp, so its edge response is as wide as the ramp. A second derivative, like the LaplacianLoading... or StrataQuest's Sobel filter (cross), responds at the start and end of a ramp instead, and is more sensitive to fine detail and to noise.

Sobel's 1, 2, 1 weighting is a small concession to noise. Prewitt's kernel averages with equal weights, 1, 1, 1, and Roberts Cross uses 2 × 2 kernels with no averaging at all, which makes it fast but sensitive to grain. The heavier center weight in Sobel approximates a Gaussian average across the direction of differencing.

The textbook gradient combines two Sobel outputs: magnitude √(Gx² + Gy²) and direction arctan(Gy/Gx). StrataQuest returns the components separately. The arithmetic operationsLoading... include Square, Add images and Square root, so a magnitude image could in principle be assembled, but the reference describes no such pipeline, and with signs and 8-bit storage unaccounted for, test it before trusting it. For thin, finished edges, the Canny edge detectorLoading... computes its own gradients and thins them.

Membranes are a different shape of signal: a quick drop and rise, or rise and drop, across a thin line. The Membrane detectorLoading... detects exactly that double variation in the grayscale image itself, so a gradient image isn't its documented input.

Simplified

Sobel measures how fast brightness changes, with a little built-in averaging so grain doesn't dominate. Simpler versions skip the averaging and react more to grain. The cross version measures a second derivative, which picks out finer detail and more grain.

Parameters & Settings

ParameterDefaultDescription
Image (all three)The input image. The reference examples use an 8-bit grayscale DAPI image. Horizontal and vertical have no other setting; their 3 × 3 kernel is fixed.
Kernel size (px) (cross only)3x3Which of the two predefined kernels to use: 3x3 or 5x5.
Border Value (cross only)0The value used for the pixels on the border.
Border type (cross only)Wrap BorderThe method used to create the border.

Each filter is chosen by name from the FiltersLoading... list; there is no variant setting. The reference examples return an 8-bit grayscale image, and the cross example uses the 5 × 5 kernel. Because each output is one derivative image, follow it with a thresholdLoading... when you need a mask.

Source: StrataQuest 8.1 Engines Reference, ch. 6.3 (Sobel filters pp. 144–151; Canny edge detector p. 122; Laplace filter p. 132; Membrane detector p. 138) and ch. 6.1 (pp. 22, 63, 66).

Simplified

Pick the operation by direction: horizontal, vertical, or the diagonal cross version. The first two have no settings. The cross version lets you choose a 3 × 3 or 5 × 5 kernel and how the image border is handled.

Connected Terms

Share This Term
Term Connections