def ocv_crop(ocvimg, top_left, bottom_right, scale=1.0):
    """
    Crop OpenCV image  
    Args:  
      ocvimg : OpenCV input image
      top_left (tuple) : top-left point of cropping region
      bottom_right (tuple) : bottom-right point of cropping region
      scale (float) : scale factor for the cropping region
    Return:
      cropped OpenCV image
    """
    if top_left[0]>bottom_right[0] or top_left[1]>bottom_right[1]:
        top_left, bottom_right = bottom_right, top_left
    w, h   = (bottom_right[0]-top_left[0])*scale, (bottom_right[1]-top_left[1])*scale
    cx, cy = (bottom_right[0]+top_left[0])//2   , (bottom_right[1]+top_left[1])//2
    x1 = max(int(cx - w//2), 0)
    y1 = max(int(cy - h//2), 0)
    x2 = min(int(cx + w//2), ocvimg.shape[1]-1)
    y2 = min(int(cy + h//2), ocvimg.shape[0]-1)
    img = ocvimg[y1:y2,x1:x2].copy()
    return img