




a_ 		=  [
    [0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0],
    [0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0],
    [0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0],
    [0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0],
]




def        __SCREAMING_SNAKE_CASE (	lowercase_       ,  lowercase_       ,  lowercase_       ,  lowercase_   )							->						bool:

    """simple docstring"""


    return 0 <= row < rows and 0 <= col < cols




def        __SCREAMING_SNAKE_CASE (	lowercase_       ,  lowercase_       ,  lowercase_       ,  lowercase_   )							->						int:

    """simple docstring"""


    __UpperCamelCase			=    len(lowercase_   )
    __UpperCamelCase			=    len(mat[0]   )
    if is_safe(lowercase_       ,  lowercase_       ,  lowercase_       ,  lowercase_   ) and (row, col) not in seen and mat[row][col] == 1:
        seen.add((row, col)   )
        return (
            1
            + depth_first_search(row + 1       ,  lowercase_       ,  lowercase_       ,  lowercase_   )
            + depth_first_search(row - 1       ,  lowercase_       ,  lowercase_       ,  lowercase_   )
            + depth_first_search(lowercase_       ,  col + 1       ,  lowercase_       ,  lowercase_   )
            + depth_first_search(lowercase_       ,  col - 1       ,  lowercase_       ,  lowercase_   )
        )
    else:
        return 0




def        __SCREAMING_SNAKE_CASE (	lowercase_   )							->						int:

    """simple docstring"""


    __UpperCamelCase			=    set()

    __UpperCamelCase			=    0
    for row, line in enumerate(lowercase_   ):
        for col, item in enumerate(lowercase_   ):
            if item == 1 and (row, col) not in seen:
                # Maximizing the area
                __UpperCamelCase			=    max(lowercase_       ,  depth_first_search(lowercase_       ,  lowercase_       ,  lowercase_       ,  lowercase_   )   )
    return max_area


if __name__ == "__main__":
 import doctest

 print(find_max_area(matrix))  # Output -> 6
 doctest.testmod()










import numpy as np
from cva import COLOR_BGR2GRAY, cvtColor, imread, imshow, waitKey

from digital_image_processing.filters.convolve import img_convolve




def   snake_case_	(    snake_case	)    ->							List[str]:
       lowercase__:  Any         =  np.array([[-1, 0, 1], [-2, 0, 2], [-1, 0, 1]]	)
       lowercase__:  Optional[Any]         =  np.array([[1, 2, 1], [0, 0, 0], [-1, -2, -1]]	)

       lowercase__:  Optional[int]         =  np.abs(img_convolve(snake_case     ,				snake_case	)	)
       lowercase__:  List[Any]         =  np.abs(img_convolve(snake_case     ,				snake_case	)	)
       # modify the pix within [0, 255]
       lowercase__:  Optional[Any]         =  dst_x * 2_55 / np.max(snake_case	)
       lowercase__:  Dict         =  dst_y * 2_55 / np.max(snake_case	)

       lowercase__:  Tuple         =  np.sqrt((np.square(snake_case	)) + (np.square(snake_case	))	)
       lowercase__:  str         =  dst_xy * 2_55 / np.max(snake_case	)
       lowercase__:  Tuple         =  dst_xy.astype(np.uinta	)

       lowercase__:  List[Any]         =  np.arctana(snake_case     ,				snake_case	)
       return dst, theta


if __name__ == "__main__":
 # read original image
 __lowerCAmelCase									=				imread('''../image_data/lena.jpg''')
 # turn image in gray scale value
 __lowerCAmelCase									=				cvtColor(img, COLOR_BGR2GRAY)

 __lowerCAmelCase			,__lowerCAmelCase									=				sobel_filter(gray)

 # show result images
 imshow('''sobel filter''', sobel_grad)
 imshow('''sobel theta''', sobel_theta)
 waitKey(0)


