def Scharr_edge(im, blurRadius=10, imblur=None):
    """Extract the edges using Scharr kernel (Sobel optimized for rotation
    invariance)

    Parameters:
    -----------
    im: 2d array
        The image
    blurRadius: number, default 10
        The gaussian blur raduis (The kernel has size 2*blurRadius+1)
    imblur: 2d array, OUT
        If not None, will be fille with blurred image

    Returns:
    --------
    out: 2d array
        The edges of the images computed with the Scharr algorithm

    """
    im = np.asarray(im, dtype='float32')
    blurRadius = 2 * blurRadius + 1
    im = cv2.GaussianBlur(im, (blurRadius, blurRadius), 0)
    Gx = cv2.Scharr(im, -1, 0, 1)
    Gy = cv2.Scharr(im, -1, 1, 0)
    ret = cv2.magnitude(Gx, Gy)
    if imblur is not None and imblur.shape == im.shape:
        imblur[:, :] = im
    return ret
Extract the edges using Scharr kernel (Sobel optimized for rotation
    invariance)

    Parameters:
    -----------
    im: 2d array
        The image
    blurRadius: number, default 10
        The gaussian blur raduis (The kernel has size 2*blurRadius+1)
    imblur: 2d array, OUT
        If not None, will be fille with blurred image

    Returns:
    --------
    out: 2d array
        The edges of the images computed with the Scharr algorithm