detect_document
Detect the dominant document, screen, or whiteboard in an image and output the perspective transform for straightening. Read-only, returns a ready-to-paste quad when correction is needed.
Instructions
Detect the dominant quadrilateral (a sheet of paper, a screen, a whiteboard, a sign)
in a revision with a contour-based search, and return it as a ready-to-paste
perspective operation. This is to perspective what detect_tilt is to rotate:
read-only, it never modifies the image, and a null quad means "do not correct".
The quad is in post-EXIF-orientation pixel coordinates, ordered tl, tr, br, bl, and
output_size_hint is exactly the size perspective will produce from it.
Optional min_area_ratio (0.05..=1.0, default 0.2) is the smallest fraction of the
frame a candidate may cover. When quad is null the reason is the first warning:
no_quad_found, already_rectified (the page already fills the frame) or low_confidence.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| revision_id | Yes | 対象 revision ID("rev_...")。 | |
| min_area_ratio | No | 画像面積に対する候補四角形の最小面積比(0.05..=1.0)。省略時は 0.2。 |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| detection | Yes | 検出結果。`quad` が null なら「補正しない」で、理由は `warnings` の先頭に入る。 | |
| revision_id | Yes |