标签:video cap normal 图片 设置 open center set read
参数说明:0表示需要启动的摄像头,这里也可以写视频的路径
参数说明: 表示窗口的名字, cv2.WINDOW_NORMAL表示窗口的大小,这里窗口的大小是正常,
3.cv2.setWindowProperty(name, cv2.WND_PROP_FULLSCREEN, cv2.WND_PROP_FULLSCREEN)
参数说明: name表示需要更改像素的窗口名字, cv2.WND_PROP_FULLSCREEN表示全屏
参数说明: cv2.CAP_PROP_FRAME_WIDTH 表示设置其宽的大小, 1920表示设置的像素
video_capture = cv2.VideoCapture(0)
cv2.namedWindow("frame", cv2.WINDOW_NORMAL)
cv2.setWindowProperty("frame", cv2.WND_PROP_FULLSCREEN, cv2.WND_PROP_FULLSCREEN)
video_capture.set(cv2.CAP_PROP_FRAME_WIDTH, 1920)
video_capture.set(cv2.CAP_PROP_FRAME_HEIGHT, 1080)
while True:
ret, frame = video_capture.read()
(h, w) = frame.shape[:2]
print(h, w)
center = (w/2, h/2)
print()
M = cv2.getRotationMatrix2D(center, 90, 1.0)
rotated = cv2.warpAffine(frame, M, (1920, 1080))
cv2.imshow('image', rotated)
cv2.imwrite('2.png', rotated)
cv2.waitKey(0)
标签:video cap normal 图片 设置 open center set read
原文地址:https://www.cnblogs.com/enumx/p/12343976.html