【OpenCV-Python】cvui 之 计数器
2023-09-14 09:01:40 时间
CVUI 之 计数器
cvui::counter()
为一个整型或者double值渲染一个计数器,可以点击向上或向下增加或减少值。
Python
import numpy as np
import cv2
import cvui
def counter_test():
WINDOW_NAME = 'Counter-Test'
# 创建画布
frame = np.zeros((400, 600, 3), np.uint8)
# 读取图像
cvui.init(WINDOW_NAME)
#
cntvalue = [1.0]
while True:
# 画布填色
frame[:] = (100, 128, 128)
'''
> theWhere: 画布
> theX: 绘制的 X
> theY: 绘制的 Y
> theValue: 值
> theStep: 间隔
> theFormat: 格式化的值或数字。例如,% d或 % .2f。
> theFontScale: 字体大小
> theInsideColor: 颜色
'''
cvui.counter(frame, 10, 10, cntvalue, 2, "%d")
# 显示
cvui.imshow(WINDOW_NAME, frame)
# ESC 退出
if cv2.waitKey(20) == 27:
break
if __name__ == '__main__':
counter_test()
CPP
原型
int counter(cv::Mat& theWhere, int theX, int theY, int *theValue, int theStep = 1, const char *theFormat = "%d", double theFontScale = DEFAULT_FONT_SCALE, unsigned int theInsideColor = DEFAULT_BUTTON_COLOR);
double counter(cv::Mat& theWhere, int theX, int theY, double *theValue, double theStep = 0.5, const char *theFormat = "%.2f", double theFontScale = DEFAULT_FONT_SCALE, unsigned int = DEFAULT_BUTTON_COLOR);
参数
theWhere: 画布
theX: 绘制的 X
theY: 绘制的 Y
theValue: 值
theStep: 间隔
theFormat: 格式化的值或数字。例如,%d或%.2f。
theFontScale: 字体大小
theInsideColor: 颜色
实例
int count = 2;
cvui::counter(frame, 90, 50, &count);
【参考】
相关文章
- pycharm导入Python_python简单项目
- python解压bz2文件命令,在Python中解压缩.bz2文件
- Python入门系列(三)基础数据类型
- python数组拼接字符串_Python练习题——数组拼接
- 符合python命名规范的标识符是什么_Python标识符命名规范
- python-opencv图像处理:sobel算子
- python海龟绘图画圆_Python启蒙之海龟作图「建议收藏」
- Python算法-汉诺塔
- python爬虫之BeautifulSoup4使用
- OpenCV-Python学习(14)—— OpenCV 绘制箭头线(cv.arrowedLine)
- 【说站】python可选参数是什么
- Python数组切片_python print数组
- python3 zipfile模块_Python ZipFile模块详解[通俗易懂]
- opencv使用教程_opencv安装教程python
- Python-OpenCV,基于标准文档的实例(一)
- python的enumerate函数怎么加判断条件_java中比int大的整数类型
- 基于Python的OpenCV关于色彩空间与通道的操作
- 什么是序列,Python序列详解(包括序列类型和常用操作)
- 手把手教你如何用 OpenCV + Python 实现人脸识别
- Python开发实例分享bt种子爬虫程序和种子解析
- Python内置的字符串处理函数详细整理(覆盖日常所用)