Find where a small pattern image (a button, icon, logo or crop) appears inside a
template-matchFind where a small pattern image (a button, icon, logo or crop) appears inside a larger screenshot or picture, using OpenCV cv2.matchTemplate. Returns the best position, plus every non-overlapping position scoring above the threshold, as pixel boxes with scores. Use it for exact-looking pixel patterns at the same scale; for different scale, rotation or perspective use /v1/homography. Price: $0.003 a call.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| image | Yes | Base64 of a PNG, JPEG, BMP or WebP file (a data: URI also works). At most 4 million pixels and about 2 MB. Alpha is dropped. | |
| method | No | OpenCV matching method (default TM_CCOEFF_NORMED, robust to brightness change). Scores are 0-1, higher is better; for TM_SQDIFF_NORMED the score is 1 minus the squared-difference value | |
| template | Yes | Base64 of the pattern to find, same formats. At most 1 million pixels and about 1 MB. Must fit inside the image. | |
| grayscale | No | Match on grayscale versions of both images (default false: match all three colour channels) | |
| threshold | No | Minimum score for a match, 0-1 (default 0.8) | |
| max_matches | No | Most matches returned, 1-50 (default 5); overlapping positions are suppressed |