title: Resizing image and its bounding box
body: <p>I have an image with bounding box in it, and I want to resize the image.</p>
  
  <pre><code>img = cv2.imread("img.jpg",3)
  x_ = img.shape[0]
  y_ = img.shape[1]
  img = cv2.resize(img,(416,416));
  </code></pre>
  
  <p>Now I want to calculate the scale factor:</p>
  
  <pre><code>x_scale = ( 416 / x_)
  y_scale = ( 416 / y_ )
  </code></pre>
  
  <p>And draw an image, this is the code for the original bounding box: </p>
  
  <pre><code>( 128, 25, 447, 375 ) = ( xmin,ymin,xmax,ymax)
  x = int(np.round(128*x_scale))
  y = int(np.round(25*y_scale))
  xmax= int(np.round  (447*(x_scale)))
  ymax= int(np.round(375*y_scale))
  </code></pre>
  
  <p>However using this I get:</p>
  
  <p><img src="https://i.stack.imgur.com/YMCRz.png" alt="enter image description here"></p>
  
  <p>While the original is:</p>
  
  <p><img src="https://i.stack.imgur.com/op4Rm.png" alt="enter image description here"></p>
  
  <p>I don't see any flag in this logic, what's wrong?</p>
  
  <p>Whole code:</p>
  
  <pre><code>imageToPredict = cv2.imread("img.jpg",3)
  print(imageToPredict.shape)
  
  x_ = imageToPredict.shape[0]
  y_ = imageToPredict.shape[1]
  
  x_scale = 416/x_
  y_scale = 416/y_
  print(x_scale,y_scale)
  img = cv2.resize(imageToPredict,(416,416));
  img = np.array(img);
  
  
  x = int(np.round(128*x_scale))
  y = int(np.round(25*y_scale))
  xmax= int(np.round  (447*(x_scale)))
  ymax= int(np.round(375*y_scale))
  Box.drawBox([[1,0, x,y,xmax,ymax]],img)
  </code></pre>
  
  <p>and drawbox</p>
  
  <pre><code>def drawBox(boxes, image):
      for i in range (0, len(boxes)):
          cv2.rectangle(image,(boxes[i][2],boxes[i][3]),(boxes[i][4],boxes[i][5]),(0,0,120),3)
      cv2.imshow("img",image)
      cv2.waitKey(0)
      cv2.destroyAllWindows()
  </code></pre>
  
  <p>The image and the data for the bounding box are loaded separately. I am drawing the bounding box inside the image. The image does not contain the box itself.</p>