xtract.bot
POST /api/image-detect-contours

Find contours (closed outlines) in an image. Returns each contour as a polygon, plus area and bounding rectangle. Useful for shape analysis and ROI extraction.

Finds connected component outlines in an image. For each detected contour, returns: - The polygon vertices. - The bounding rectangle. - The pixel area. Useful for shape analysis, ROI extraction, and feeding the detected outlines into `image-perspective-warp` or similar.

Inputs

NameTypeDefaultDescription
image*fileInput image bytes.
thresholdnumber (0…255)127Binarisation threshold for the grayscale source (0-255).
minAreanumber100Drop contours whose pixel area is below this.
modeenum (external | tree)"external"RETR_EXTERNAL (outer only) or RETR_TREE (full hierarchy).
approxEpsilonnumber (0…1)0Polygon-approx epsilon as fraction of perimeter (0 = no approx).

Response

Modes: json. Cache: yes (24h TTL).