

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

from digital_image_processing.filters.convolve import img_convolve


def    _UpperCAmelCase    (					_SCREAMING_SNAKE_CASE   :						List[str]    ):





    """simple docstring"""


    SCREAMING_SNAKE_CASE_													=  np.array([[-1, 0, 1], [-2, 0, 2], [-1, 0, 1]]    )
    SCREAMING_SNAKE_CASE_													=  np.array([[1, 2, 1], [0, 0, 0], [-1, -2, -1]]    )

    SCREAMING_SNAKE_CASE_													=  np.abs(img_convolve(_SCREAMING_SNAKE_CASE	,				_SCREAMING_SNAKE_CASE    )    )
    SCREAMING_SNAKE_CASE_													=  np.abs(img_convolve(_SCREAMING_SNAKE_CASE	,				_SCREAMING_SNAKE_CASE    )    )
    # modify the pix within [0, 255]
    SCREAMING_SNAKE_CASE_													=  dst_x * 255 / np.max(_SCREAMING_SNAKE_CASE    )
    SCREAMING_SNAKE_CASE_													=  dst_y * 255 / np.max(_SCREAMING_SNAKE_CASE    )

    SCREAMING_SNAKE_CASE_													=  np.sqrt((np.square(_SCREAMING_SNAKE_CASE    )) + (np.square(_SCREAMING_SNAKE_CASE    ))    )
    SCREAMING_SNAKE_CASE_													=  dst_xy * 255 / np.max(_SCREAMING_SNAKE_CASE    )
    SCREAMING_SNAKE_CASE_													=  dst_xy.astype(np.uinta    )

    SCREAMING_SNAKE_CASE_													=  np.arctana(_SCREAMING_SNAKE_CASE	,				_SCREAMING_SNAKE_CASE    )
    return dst, theta


if __name__ == "__main__":
 # read original image
 UpperCamelCase__					: Dict								=      imread("../image_data/lena.jpg")
 # turn image in gray scale value
 UpperCamelCase__					: Optional[int]								=      cvtColor(img, COLOR_BGR2GRAY)

 UpperCamelCase__		,	UpperCamelCase__					: Any								=      sobel_filter(gray)

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





def    _UpperCAmelCase    (					_SCREAMING_SNAKE_CASE   :						float	,				_SCREAMING_SNAKE_CASE   :						float    ):





    """simple docstring"""


    return a + b


if __name__ == "__main__":
       UpperCamelCase__					: Union[str, Any]								=      5
       UpperCamelCase__					: List[Any]								=      6
       print(F'The sum of {a} + {b} is {add(a, b)}')


