Skip to content Skip to sidebar Skip to footer

Why Does The Frame Width / Height Not Always Get Set?

There is a huge number of questions and corresponding answers of people asking how to set the frame height / width. A small sample below: Unable to change frame height, width in O

Solution 1:

You could try resizing each frame before displaying, please see code below.

Determine scaling


scale_percent = 40# percent of original size
width = int(img.shape[1] * scale_percent / 100) 
height = int(img.shape[0] * scale_percent / 100) 
dim = (width, height) 

Apply desired scaling using the cv2.resize, before displaying.

# resize output window
resized = cv2.resize(img, dim, interpolation = cv2.INTER_AREA) 

#show resized frame
cv2.imshow("base_img", resized)

Hope this helps. :)

Post a Comment for "Why Does The Frame Width / Height Not Always Get Set?"