from usefull_func import *


def filtre_sobel(img):

    if not is_greyscale(img):
        img = greyscale(img)

    mat_x = [[-1,0,1],[-2,0,2],[-1,0,1]]
    mat_y = [[-1,-2,-1],[0,0,0],[1,2,1]]
    Gx = convolution(img, mat_x)
    Gy = convolution(img, mat_y)
    
    filtred_image = application_norme(Gx,Gy)
    return filtred_image

