我试图用OpenCV在计算机上显示我的网络摄像头(GoPro 8)视频,但我不想使用自动旋转功能——我的意思是,当我从手持GoPro从横向移动到纵向(比如旋转90度)时,我希望计算机上显示的图像显示横向旋转的视图
Image displayed on computer when held on Landscape
Image displayed on computer when held on Portrait
上面的两张照片显示了is现在的功能,但我希望它看起来像下面的。 Ideal image displayed on computer when held on Portrait
这是我的密码:
video = cv2.VideoCapture(1)
cv2.namedWindow("window", cv2.WND_PROP_FULLSCREEN)
cv2.setWindowProperty("window",cv2.WND_PROP_FULLSCREEN,cv2.WINDOW_FULLSCREEN)
while(True):
ret, frame = video.read()
if ret == True:
flipped = cv2.flip(frame, 1) #flip frame vertically, I want it flipped for other reasons
cv2.imshow('window', flipped)
if cv2.waitKey(1) & 0xFF == ord('q') :
break
cv2.destroyAllWindows()
是否有任何方法可以忽略外部网络摄像头的方向?我尝试使用cv2.rotate()旋转图像,但这不是我想要的
我认为最好的解决方案是使用cv2.rotate,这样你就可以得到你想要的输出。顺便说一句,我使用的是Logitech 720p网络摄像头,当我把它放在纵向位置时,它会在不使用任何python函数的情况下为我提供所需的输出,下面是使用cv2.rotate()的输出代码
相关问题 更多 >
编程相关推荐