title: Cropping an Image in using OpenCV function for Python
body: <p>I need an OpenCV function for python which allows cropping an image for given dimensions.</p>
  
  <p>I am using cv2.UMat() for loading images onto GPU and processing there itself. So, below index slicing option won't work on UMat objects.</p>
  
  <pre><code>image[CROP_DIMS[0]:-CROP_DIMS[1], CROP_DIMS[2]:-CROP_DIMS[3]])
  </code></pre>
  
  <p>To optimize and take full benefits of GPU, I need OpenCV function to crop an image using OpenCV Function, else I will have to get the image from GPU and again load onto GPU once cropped.</p>
  
  <p>Versions : 
  Python - 3.6.4
  OpenCV - 3.4.1</p>
  
  <p>I have already searched on stack overflow and google for same but didn't find any suitable matching answer. Either everyone is pointing to index slicing or functions from previous old opencv versions.</p>