Home > OS >  CV2 image and webcam always minimized when running a program
CV2 image and webcam always minimized when running a program

Time:05-30

cap = cv2.VideoCapture(0)

and

img = cv2.imread(/users/..../jumpingjacks.jpeg, 1)
cv2.imshow('Jumping Jacks', img)

when my prog run these two codes, the webcam feed and image doesn't pop out, but instead, it shows as minimized version, which requires me to press the icon at the bottom of the screen to bring it forward. anyidea what caused this ?

CodePudding user response:

Found the answer by trying out this codes :

img = cv2.imread('/users/..../jumpingjacks.jpeg', 1)
cv2.imshow('Jumping Jacks', img)
cv2.setWindowProperty("Jumping Jacks", cv2.WND_PROP_TOPMOST, 1)
cv2.waitKey(5000)
cv2.destroyAllWindows()

feel free to ask me if unsure

CodePudding user response:

You might want to set the following property to enable it.

CAP_PROP_SETTINGS Python: cv.CAP_PROP_SETTINGS

Pass the argument as True while calling VideoCapture()

Reference : https://docs.opencv.org/4.x/d4/d15/group__videoio__flags__base.html#gaeb8dd9c89c10a5c63c139bf7c4f5704d

  • Related