title: How to set frame height and width in OpenCV Python
body: <p>I am working on <code>opencv python</code> project on <code>raspberry pi 4</code>(pi). Pi is connected to a screen of having resolution <code>800x480</code>. Picamera is also connected to pi to get live video feed. I need to show the video feed on right side of the frame and some information on left side of the frame. For this I have below code:</p>
  
  <pre><code>frame = cap.read()
  
  frame = imutils.resize(frame, width=400, height=480)
  frame2 = np.zeros((frame.shape[0], 400, frame.shape[2]), dtype=frame.dtype)
  
  (H, W) = frame.shape[:2]
  (H1, W1) = frame2.shape[:2]
  print("Frame {}, {}".format(H, W))
  print("Frame2 {}, {}".format(H1, W1))
  
  
  cv2.putText(frame2, "Some Information", (5, 30), cv2.FONT_HERSHEY_COMPLEX_SMALL, 1, (0, 0, 255), 1)
  cv2.putText(frame2, "More Information", (5, 60), cv2.FONT_HERSHEY_COMPLEX_SMALL, 1, (0, 0, 255), 1)
  cv2.putText(frame2, "Some More Information", (5, 90), cv2.FONT_HERSHEY_COMPLEX_SMALL, 1, (0, 0, 255), 1)
  
  image = np.hstack((frame2, frame))
  
  cv2.namedWindow(win_name, cv2.WINDOW_NORMAL)
  cv2.setWindowProperty(win_name, cv2.WND_PROP_FULLSCREEN, cv2.WINDOW_FULLSCREEN)
  cv2.imshow(win_name, image)
  
  key = cv2.waitKey(1) &amp; 0xFF
  if key == ord("q"):
      break
  </code></pre>
  
  <p>Code Explaination:</p>
  
  <p>I have resized <code>frame</code> to <code>400x480</code> because total width we have is <code>800</code> so I will divide it into two equal parts, keeping height as same <code>480</code>. This <code>frame</code> will show video feed on right side. I have also created <code>frame2</code> which will show the information on the left. I have also kept its width as <code>400</code>, not sure how to set height in this. Running this code I am getting below output:</p>
  
  <p><a href="https://i.stack.imgur.com/5QKL8.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5QKL8.jpg" alt="enter image description here"></a></p>
  
  <p>As you can see output frame is divided equally into two parts having width 400 but height has been reduced to 300, as the print output says</p>
  
  <pre><code>Frame 300, 400
  Frame2 300, 400
  </code></pre>
  
  <p>Can anyone please explain why height is reduced to <code>300</code> instead of <code>480</code>. Is there any way I can keep the height to <code>480</code>. Please help. Thanks</p>