suhail
suhail

Reputation: 21

How to align my OpenCV output from the webcam at the Centre of my screen

How can I align my OpenCV output from the webcam at the centre of my screen. The visuals are always positioned at the top right corner. I want the position exactly at middle of the screen or at top middle area(exactly under the webcam).

I got an error from moveWindow

frame = vid.read()
frame = cv2.flip(frame, 1)
frame = imutils.resize(frame, width=cam_w, height=cam_h)
frame = cv2.moveWindow(vid, 40, 30)


     #SystemError: <built-in function moveWindow> returned NULL without setting an error

Upvotes: 2

Views: 1732

Answers (1)

Yunus Temurlenk
Yunus Temurlenk

Reputation: 4352

First of all, to be able to move your window you should have a window first. You can check the documentation first before using it.

Here is an example of usage of moveWindow with imshow:

import cv2

image = cv2.imread("/home/cayirova/Downloads/cluster.png", cv2.IMREAD_UNCHANGED)
cv2.imshow('image',image)
cv2.moveWindow('image',400,200)
cv2.waitKey(0) 

Upvotes: 2

Related Questions