当前位置:网站首页>OpenCV - matchTemplate image template matching
OpenCV - matchTemplate image template matching
2022-08-09 16:03:00 【why why】
Template matching is the comparison of templates with overlapping image regions,An image processing method to locate coincident regions,本文记录 OpenCV Related content implementation method.
简介
Template matching tasks require searching for templates in images,A technique to determine where a template is located,Python OpenCV The function encapsulated in is cv2.matchTemplate
函数说明
function reference form
cv2.matchTemplate(image, templ, method[, result]) → result参数说明
参数 | 含义 |
|---|---|
image | image being searched,The template needs to grid the loss function in the image(需要 int8 或 float32 格式的图像) |
templ | Searched template images,size cannot be compared image 大,需要和imagehave the same image data format |
method | Specifies the loss function calculation method |
损失函数
method=CV_TM_SQDIFF
Calculate the mean squared error directly as a loss function
method=CV_TM_SQDIFF_NORMED
The mean square error loss function is calculated after normalizing the two vector modulo lengths
method=CV_TM_CCORR
Calculate the cross-correlation function result as the loss function
method=CV_TM_CCORR_NORMED
Calculate the result of the cross-correlation function normalized according to the modulo length as the loss function,个人比较推荐,效果也较好,If the image is not suitable for using this parameter directly, you can find a way to construct a normalized correlation loss function
method=CV_TM_CCOEFF
Decentralized correlation loss function
- 其中:
method=CV_TM_CCOEFF_NORMED
相关系数损失函数
示例引用
out_v = cv2.matchTemplate(image, template, cv2.TM_CCORR_NORMED)参考资料
边栏推荐
猜你喜欢

R7 6800H标压处理器+RTX 3050独显 无畏Pro15锐龙版高能开卖

机器学习--数学库--概率统计

听书项目总结

【DevOps】jekinsBuild step 'Execute shell' marked build as failure

C语言程序设计笔记(浙大翁恺版) 第十周:字符串

table中 You may have an infinite update loop in a component render function问题解决

【软考】2022年上半年软考过啦

leetcode 剑指 Offer 07. 重建二叉树

Shell -- -- -- -- -- - common gadgets, sort and uniq, tr, the cut

看完腾讯大佬90天整理的“Redis深度笔记”,我直接当场膜拜
随机推荐
暴雨天,看天翼云如何“快准稳”防涝
DSPE-PEG-Hydrazide,DSPE-PEG-HZ,磷脂-聚乙二醇-酰肼MW:1000
【LeetCode】15. 三数之和
由于谷歌版本自动更新,导致selenium项目报错,如何关闭谷歌浏览器的自动更新?
C语言——void指针、NULL指针、指向指针的指针、常量和指针
Shell -- -- -- -- -- - common gadgets, sort and uniq, tr, the cut
【Serilog】具有完全结构化事件的简单.NET日志记录
道路形态(道路要素)
firewall防火墙详解
How does the JVM judge that an object is useless
my creative day
C语言程序设计笔记(浙大翁恺版) 第七章:函数
Regular expression combat: the latest Douban top250 crawler super detailed tutorial
Swift中的Error处理
各种程序员线学习学习教程收集
DBCO-PEG-DSPE,磷脂-聚乙二醇-二苯并环辛炔,在无铜离子的催化下反应
易基因|作物育种:DNA甲基化在大豆优良品种培育中的作用研究成果
ORDER BY clause is invalid in views, inline functions, derived tables, subqueries, and common table expressions unless TOP, OFFSET, or FOR XML is also specified
【DevOps】jekinsBuild step ‘Execute shell‘ marked build as failure
C语言程序设计笔记(浙大翁恺版) 第八周:数组