Skip to content

Sobel derivatives

Measure image change along x or y while smoothing in the perpendicular direction.

Try it on your image ↓

VISUAL WALKTHROUGHEdges
REFERENCE INPUTIntensity image

Flat regions and sharp transitions respond very differently.

RESULTCombine x and y

Magnitude makes transitions visible regardless of sign. Display normalization is applied only to this illustration.

STEP 03 / 03

Keep the signed response or combine x and y magnitudes.

Computed teaching example on a 24 × 16 image. Small kernels and simplified settings keep each change visible; use the image laboratory for native OpenCV.

Try it on an image

YOUR IMAGE · REAL OPENCV

Experiment at pixel level

Open full lab ↗

Signed grayscale derivative. The preview displays absolute magnitude; native samples preserve the sign.

The engine loads on your first run. Your images stay in this browser.

Input448 × 320
OutputWaiting for a result

Scroll over either image to zoom at the pointer. Use the scrollbars to pan both views over the same relative area. Zoom is relative to the input; pixel coordinates belong to each image. Warps can change scene correspondence.

Pixel inspector RGBA · native values · matched scale · 9 × 9 output pixels
Hover to inspect. Click to pin a pixel.
Input
Select a pixel

Output
Select a pixel

Sample models and licenses

When to use it

Estimate edge strength and orientation, normals, or inputs to gradient-based feature methods.

How it works

  1. 01Smooth across the direction perpendicular to the derivative.
  2. 02Subtract weighted samples on opposite sides.
  3. 03Keep the signed response or combine x and y magnitudes.

|∇I| = √(Ix² + Iy²)

What to tune

dx and dy choose derivative orders; ksize changes support; scale keeps magnitudes comparable across kernels.

Where it breaks down

An unsigned output clips negative derivatives. Convert to a signed or floating matrix before interpreting direction.

TypeScript API

Open an entry for its exact overloads, parameter descriptions, result ownership and pinned upstream source.

All of these calls execute on the CPU. Native objects need explicit disposal. See matrices and ownership and build compatibility.