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

标签 python c++ opencv image-processing

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

根据 OpenCV 3.0 文档 here , OpenCV 显然有一个函数可以做到这一点。

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

但是我不断得到:-

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

显然,相同的函数在 C/C++ 中运行良好,但在 Python 中却无法正常工作。很可能是因为它不适用于 python(也许)?

我该如何解决这个问题?

最佳答案

文档说

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).

有一个如何将它用作按钮的小示例。

关于python - 如何使用 cv2.createButton 在 OpenCV 3.1 中制作按钮?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38314933/

相关文章:

python - 如何为 python 中的特定行值选择数据框中的列数据?

python - 当主线程运行无限循环时,为什么在不同线程中导入模块需要很长时间?

c++ - 在C++中将数组打印为表格

C++:这是一个有效的常量成员函数吗?

c++ - OpenCV:代码执行无法继续,DLL 丢失

image-processing - 如何将 cv::remap 与正向网格而不是反向网格一起使用来扭曲图像?

python - 将字符串/对象更改为持续时间和总和

python - 如何防止记录 pyspark 'answer received' 和 'command to send' 消息

c++ - 为什么匿名 unique_ptr 值会立即被破坏

python - 从 BGR 到灰度的 OpenCV 颜色转换错误