CVKit Template Match (f8.cvkit.templatematch)¶
No description.
- Service class:
f8.cvkit.templatematch - Version:
0.0.1 - Source directory:
f8/cvkit/template_match - Tags:
cv,template_match
When to Use¶
- Use
f8.cvkit.templatematchto find the best match for a known reference patch inside the frame. - It is well suited to buttons, icons, UI elements, and other visually stable anchors.
- It is also a common way to initialize a region before handing off to tracking.
Common Wiring Patterns¶
- Feed it from
f8.screencaporf8.implayer. - Keep a visual overlay or preview attached while tuning so you can confirm the match box is landing where expected.
- For long-lived following behavior, use "match first, then track".
Pitfalls / Gotchas¶
- Matching degrades quickly when the live target differs too much in scale, rotation, or lighting.
- Template matching is not a general detector; it works best when appearance is mostly stable.
- Threshold tuning should be evaluated against both false positives and misses, not just a single good frame.
Service Reference¶
How to Run¶
../win/f8cvkit_template_match_service.exe
- Workdir:
./ - Environment overrides: none
Typical Inputs / Outputs¶
- Data inputs: none
- Data outputs:
detections,monitor - Commands:
captureTemplateFrame,ping
Service State Fields¶
| Name | Access | Required | On Node | Schema | Description |
|---|---|---|---|---|---|
templateImagePngB64 |
rw |
true |
false |
string |
PNG bytes encoded as base64. Local-only payload; cleared when exporting publish JSON. |
matchThreshold |
rw |
true |
true |
number / default=0.5 |
0..1 score threshold used to emit detections. |
matchingIntervalMs |
rw |
true |
false |
integer / default=200 |
Minimum milliseconds between template matching passes. |
shmName |
rw |
true |
true |
string |
Optional SHM name override (e.g. shm.xxx.video). |
lastError |
ro |
true |
false |
string |
Last error message. |
active |
rw |
true |
false |
boolean / default=True |
Service lifecycle state (activate/deactivate). |
svcId |
ro |
true |
false |
string |
Readonly: current service instance id (svcId). |
Key Fields That Matter¶
templateImagePngB64(Template PNG (Base64),rw): PNG bytes encoded as base64. Local-only payload; cleared when exporting publish JSON. Schema:string.matchThreshold(Match Threshold,rw): 0..1 score threshold used to emit detections. Schema:number / default=0.5.matchingIntervalMs(Matching Interval (ms),rw): Minimum milliseconds between template matching passes. Schema:integer / default=200.shmName(Video SHM,rw): Optional SHM name override (e.g. shm.xxx.video). Schema:string.lastError(Last Error,ro): Last error message. Schema:string.active(Active,rw): Service lifecycle state (activate/deactivate). Schema:boolean / default=True.svcId(Service Id,ro): Readonly: current service instance id (svcId). Schema:string.
Service Commands¶
captureTemplateFrame¶
Capture current SHM frame as an encoded image (base64).
- Show on node:
true
| Param | Required | Schema | Description |
|---|---|---|---|
format |
true |
string |
|
quality |
true |
integer |
|
maxBytes |
true |
integer |
|
maxWidth |
true |
integer |
|
maxHeight |
true |
integer |
ping¶
Health check.
- Show on node:
false - Params: none
Service Data Input Ports¶
None
Service Data Output Ports¶
| Name | Required | On Node | Schema | Description |
|---|---|---|---|---|
detections |
true |
true |
object{detections, frameId, height, model, ...} |
Detection output in schema f8visionDetections/1 (single best match as 0/1 detection). |
monitor |
true |
false |
object{active, alive, cpu, error, ...} |
Unified runtime monitor snapshots (health/resource/perf/error). |
Operators¶
None