Skip to content

Scharr derivatives

Use a specialized 3×3 derivative kernel with improved rotational symmetry.

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

Combine horizontal and vertical responses for edge orientation.

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 ↗

A 3 × 3 signed grayscale derivative, displayed as absolute magnitude.

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

Get small-kernel image gradients when orientation accuracy matters.

How it works

  1. 01Weight the centre row or column more strongly.
  2. 02Subtract the opposite side to estimate a derivative.
  3. 03Combine horizontal and vertical responses for edge orientation.

x kernel = [−3,0,3; −10,0,10; −3,0,3]

What to tune

Choose dx=1, dy=0 or dx=0, dy=1 and use signed output. Scale differs from a 3×3 Sobel response.

Where it breaks down

It is still a local derivative and responds to noise. Blur first when the image is noisy.

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.