CV Lab 16 · Module 6 — Shape & Structure

Contours & Shape Analysisv3 · elite

Drag the shape itself and watch the maths respond instantly. Every visual element in this lab follows one strict colour code, everywhere, so you never have to guess what a line means.

Tracing the outline A contour is a connect-the-dots list of (x,y) coordinates — in OpenCV, a NumPy array shaped (N, 1, 2). Hover near the boundary in Deform mode to see a live slice of that exact array.
Contour boundary Convex hull Bounding box Centroid
Ready.
Live Explanation
Loading…

Drag any of the 10 yellow handles — push a point inward to carve a concavity, pull it outward to sharpen a spike. Hover near the outline (without dragging) for the raw coordinate tooltip.

0%
Solidity
Raw contour array (first few points)

The vocabulary of a shape

Area, Perimeter, Centroid

Area is enclosed space, perimeter is boundary length, centroid is the balance point — exact geometry on a clean vector shape, discrete approximations on a pixel-traced one.

Convex Hull & Solidity

The hull is the tightest rubber band around a shape. Solidity = Area ÷ Hull Area — the liquid gauge is literally that ratio, dropping every time you carve a notch.

Retrieval modes

EXTERNAL sees only outer boundaries. LIST sees everything with no relationships. CCOMP flattens everything to exactly two levels. TREE is the only mode that preserves true nesting depth.

Why simplify at all

A contour traced from a noisy, pixelated camera frame can have hundreds of jittery points describing what is really a rectangle. RDP simplification collapses it back to its true handful of corners.

Predict, then verify

You pixelate a perfect circle heavily (large blocks) and measure its perimeter from the blocky traced outline, without simplifying. How does that measured perimeter compare to the true geometric circumference?