logo

关于image.find_template( )使用的问题

2020-01-15 10:57
L
陳沀沅臻23489

技术工程师你好!

image.find_template(template, threshold[, roi[, step=2[, search=image.SEARCH_EX]]])这个函数我没看明白。我对Python不熟悉。

里边threshold[,roi...] 这里边逗号和[之间是表示省略一个元素吗,这种套用方式和C语言是否一样?

从上边例程看img.find_template(template, 0.70, step=4,search=SEARCH_EX) 里边有template、0.7、step=4、search=SEARCH_EX这样四个量。这四个量和函数里边的threshold、roi等是怎么对应的,没看明白。

2020-01-15 18:22
I
网红小智智 星瞳科技

[]表示有默认参数,也叫可选的参数。

img.find_template(template, 0.70, step=4,search=SEARCH_EX)

template对应template

threshold对应0.70

step=4对应step

search=SEARCH_EX对应search

roi没有传参数,默认是整个画面

https://www.bing.com/search?q=python+%E9%BB%98%E8%AE%A4%E5%8F%82%E6%95%B0&qs=n&form=QBLH&sp=-1&pq=python+%E5%8F%AF%E9%80%89&sc=1-9&sk=&cvid=0A9B531E29C240D78FFC8ECF538EBFF9

2020-01-16 10:04
L
陳沀沅臻23489

@kidswong999 谢谢明白了:folded_hands: