since i used cv2.namedWindow('Frame', cv2.WINDOW_NORMAL)
I was able to resize my window while running but I also want to print the new window size. Anyone who could help?
Update: This is not the full code but it's something like this
cap = cv2.VideoCapture(0)
cv2.namedWindow('Frame', cv2.WINDOW_NORMAL)
while(True):
# Capture frame-by-frame
ret, frame = cap.read()
cv2.imshow('Frame',frame)
print(frame.shape) #prints image dimension
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
It kept printing (480, 640, 3) even after I resized the window
You can use the following command.
cv2.getWindowImageRect('Frame')
This will return a tuple of (x, y, w, h)
with the current information of the image that is showing in the window named 'Frame'
.
Note: This will return the details of the image, but not the information of the window that the image is in.
Edit Note: This function appears after opencv
3.4.1
release.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With