> 文章列表 > 【OpenCV-Python】cvui 之 图像

【OpenCV-Python】cvui 之 图像

【OpenCV-Python】cvui 之 图像

CVUI 之 图像

【OpenCV-Python】cvui 之 图像

Python

import numpy as np
import cv2
import cvuidef image_test():WINDOW_NAME = 'Image-Test'# 创建画布frame = np.zeros((400, 600, 3), np.uint8)# 读取图像image = cv2.imread("lena-face.jpg", cv2.IMREAD_COLOR)cvui.init(WINDOW_NAME)while True:# 画布填色frame[:] = (100, 200, 100)# 写文字cvui.text(frame, 100, 100, 'The image component')# 渲染图像控件cvui.image(frame, 200, 256, image)# 显示cvui.imshow(WINDOW_NAME, frame)# ESC 退出if cv2.waitKey(20) == 27:breakif __name__ == '__main__':image_test()

CPP

void image(cv::Mat& theWhere, int theX, int theY, cv::Mat& theImage);

参数
theWhere: 画布
theX: 画布横坐标
theY: 画布纵坐标
theImage: 图像

cv::Mat lena_face = cv::imread("lena_face.jpg", cv::IMREAD_COLOR);
cvui::image(frame, 10, 10, lena_face);

【参考】

cvui image