Qu

edge_detect

Builtin index · Images

result = edge_detect(img)

Input: img · Output: result

What it is

img is an Image. Applies a fixed 3x3 discrete Laplacian edge filter, highlighting intensity discontinuities.

Overloads

One call shape — this function is not overloaded.

CodeInputOutputDescription
result = edge_detect(img)
img Imagenot documented yet
result Image
Returns a new Image, same dimensions as img.

Examples

From the documentation, and run by the build -- the output and the figure below are what the engine actually produced. Simplest first.

img = load_image("sample.bmp")
edges = edge_detect(grayscale(img))
imshow(edges)

from images

How it works

blur(img) / sharpen(img) — the two required convolution filters (3x3 box-average blur, 3x3 unsharp-mask sharpen); see image::Image's doc comments for the exact kernels. edge_detect(img) — a bonus third (3x3 discrete Laplacian). imfilter(img, kernel) — the generic escape hatch: an arbitrary odd-sized square Matrix kernel, direct 2-D convolution with edge-clamped borders (see image::Image::convolve's doc comment for why this is a small from-scratch 2-D convolution rather than a forced reuse of qu_core::transforms::conv, which is 1-D only).

From the note above this builtin in the interpreter, where the reasoning was written down as it was built.