如何使用cv2.createButton在OpenCV 3.1中制作按钮?

2024-04-30 04:34:23 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图在图像处理脚本中添加一个按钮,以保存二进制阈值的高和低HSV值。

根据OpenCV 3.0文档here,OpenCV显然具有这样的功能。

我正在编写这样的函数
cv2.createButton('Button',f)
其中,Button是按钮的名称,f是回调函数(只是一个空函数)

然而,我不断地得到:

AttributeError: 'module' object has no attribute 'createButton'

显然,同一函数在C/C++中工作得很好,但它不适用于Python。很可能是因为它不适合python(也许)?

我该如何解决这个问题?


Tags: 函数文档功能脚本名称here二进制button
1条回答
网友
1楼 · 发布于 2024-04-30 04:34:23

文件上说

Another important application of trackbar is to use it as a button or switch. OpenCV, by default, doesn’t have button functionality. So you can use trackbar to get such functionality (found at Trackbar as the Color Palette).

有一个小例子如何使用它作为按钮。

相关问题 更多 >