import os
import cv2
from timeit import default_timer as timer # 计时。
a = timer()
path = os.getcwd() + '/'
input_images_path = path + "/get_img/"
output_images_path = path + "/get_img/"
img = cv2.imread(input_images_path + 'test2.jpg')
Width = img.shape[1]//4
Height = img.shape[0]//4
# 显示框名字
cv2.namedWindow('Img_1', 0)
# 显示框大小
cv2.resizeWindow('Img_1', (Width, Height))
# 显示框位置,从最左上角开始,第一个是x坐标偏移,第二个是y坐标偏移
cv2.moveWindow("Img_1", 1, 50)
cv2.imshow('Img_1', img)
b = timer()
print(b - a)
cv2.waitKey(0)
python使用opencv显示固定位置和尺寸的图片
最新推荐文章于 2024-09-05 22:02:56 发布