title: How to correctly use cv2.imwrite to save an image in openCV with cv2.selectROI
body: <p>I am trying out OpenCV's ROI function. With this I am trying to crop out a section of an image that I load. After that I am trying to save the image as well as show it. Showing it is not much of a problem, but saving it is. The image is being stored as a big black rectangle instead of the actual cropped image. Here is my code:</p>
  
  <pre><code>import cv2
  import numpy as np
  from skimage.transform import rescale, resize
  
  if __name__ == '__main__' :
  
      # Read image
      im = cv2.imread("/Path/to/Image.jpg")
      img = resize(im, (400,400), mode='reflect') 
      # Select ROI
      r = cv2.selectROI(img)
  
      # Crop image
      imCrop = img[int(r[1]):int(r[1]+r[3]), int(r[0]):int(r[0]+r[2])]
  
      # Save first, then Display cropped image
      cv2.imwrite("../../Desktop/Image.jpg", imCrop) # This is where there seems to be a problem
      cv2.imshow("im", imCrop)
      cv2.waitKey(0)
  </code></pre>
  
  <p>Can some one please help?</p>