{"uid":"cap_uxW5_29k7q3_si7VHdvsk","slug":"visionflow-match-template-matching-51d486c3","name":"VisionFlow Match – Template Matching","description":"Find 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.","url":"https://visionflow-match.saastemly.com/v1/template-match?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"image":{"type":"string","description":"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":{"enum":["TM_CCOEFF_NORMED","TM_CCORR_NORMED","TM_SQDIFF_NORMED"],"type":"string","description":"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":{"type":"string","description":"Base64 of the pattern to find, same formats. At most 1 million pixels and about 1 MB. Must fit inside the image."},"grayscale":{"type":"boolean","description":"Match on grayscale versions of both images (default false: match all three colour channels)"},"threshold":{"type":"number","description":"Minimum score for a match, 0-1 (default 0.8)"},"max_matches":{"type":"integer","description":"Most matches returned, 1-50 (default 5); overlapping positions are suppressed"}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.003","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.003/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.003","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.003","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_pdqkxtmUiG7SXeXxFb67j","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.003","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Locates where a small pattern image appears inside a larger image using OpenCV cv2.matchTemplate, returning pixel bounding boxes and scores for the best and all non-overlapping matches above a threshold.","exampleAgentPrompt":"I have a screenshot of a web page and a small cropped image of the 'Submit' button — can you find where that button appears in the screenshot, returning its pixel coordinates, using TM_CCOEFF_NORMED with a threshold of 0.85 and up to 3 matches?","exampleUseCases":[{"title":"UI automation element detection","prompt":"I'm automating a browser test and need to know the exact pixel coordinates of this 'Login' button icon in a full-page screenshot — find all non-overlapping occurrences with a match score above 0.9 using TM_CCOEFF_NORMED."},{"title":"Logo presence verification in screenshot","prompt":"I have a brand logo PNG and a product screenshot — can you check if and exactly where the logo appears in the screenshot, returning its bounding box and match score? Use grayscale matching since the colors might differ slightly."},{"title":"Repeated icon inventory in UI","prompt":"Here's a screenshot of a mobile app and a small 'star' icon crop — find up to 10 non-overlapping positions where this icon appears in the screenshot, with a threshold of 0.8, so I can count and map all the star ratings on screen."}],"resultDescription":"Returns the best match position (bounding box with x, y, width, height and score) plus a list of all non-overlapping positions scoring above the threshold, each as a pixel bounding box with its match score. Scores range from 0 to 1 (higher is better, except TM_SQDIFF_NORMED which is 1 minus the squared-difference value).","failureModes":["No match found above threshold — returns empty match list; lower the threshold or verify the template is from the same scale/perspective as the image","Template larger than image — returns error","Image or template exceeds size limits (4MP/2MB for image, 1MP/1MB for template) — returns error","Unsupported image format — returns error","Template and image scale/rotation differ — results unreliable; use /v1/homography instead","Base64 decoding failure if data URI is malformed"],"whenToPreferThis":"Use this endpoint when your pattern and the target image are at the same scale and orientation (no rotation, scaling, or perspective distortion) and you need fast, exact pixel-level template matching. Prefer it over the homography or feature-match siblings when dealing with crisp pixel-identical crops like UI elements, icons, or logos captured at the same resolution. If the pattern might appear at a different scale or angle, use the homography or feature-matching endpoints instead.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-22T00:31:18.899Z","isFirstParty":false,"canonicalSlug":"visionflow-match-template-matching-51d486c3"}