Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 1251

Python • openCV moveWindow won't Move

$
0
0
I have two USB Webcams connected to a Raspberry Pi4 . Running the following script I get two videos on the monitor as intended.

Code:

import cv2cam0 = cv2.VideoCapture(0)cam1 = cv2.VideoCapture(2)cv2.namedWindow("Cam 0", cv2.WINDOW_NORMAL)cv2.namedWindow("Cam 1", cv2.WINDOW_NORMAL)cv2.resizeWindow("Cam 0", 640, 480)cv2.resizeWindow("Cam 1", 640, 480)while True:    ret0, frame0 = cam0.read()    ret1, frame2 = cam2.read()        cv2.imshow("Cam 0", frame0)    cv2.moveWindow("Cam 0", 0, 0)            cv2.imshow("Cam 1", frame1)    cv2.moveWindow("Cam 1", 710, 0)            if cv2.waitKey(1) == ord('q'):        breakcam0.release()cam1.release()cv2.destroyAllWindows()
However, the problem is the windows aren't positioned as desired. "Cam0" is positioned in the center of the monitor and "Cam1" is overlayed onto "Cam0" slightly. I can use the mouse and move the windows, but the goal is to position them in a particular location on the monitor. I've ran this script on a Jetson Nano with the same cameras connected and the windows are positioned as desired.
Any suggestions as to what I'm doing wrong?
Thanks Brian

Statistics: Posted by briank1179 — Mon Dec 18, 2023 9:04 pm



Viewing all articles
Browse latest Browse all 1251

Trending Articles