

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

from digital_image_processing.filters.convolve import img_convolve




def        lowerCAmelCase(	SCREAMING_SNAKE_CASE_       )->		Dict:



    """simple docstring"""






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

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

    UpperCamelCase_          =		np.sqrt((np.square(SCREAMING_SNAKE_CASE_       )) + (np.square(SCREAMING_SNAKE_CASE_       ))       )
    UpperCamelCase_          =		dst_xy * 2_5_5 / np.max(SCREAMING_SNAKE_CASE_       )
    UpperCamelCase_          =		dst_xy.astype(np.uinta       )

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


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

 SCREAMING_SNAKE_CASE     ,				SCREAMING_SNAKE_CASE						:Optional[int]      =			sobel_filter(gray)

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




from __future__ import annotations






def 		a__       (							A__							):
			if len(A__							) == 0:
						raise ValueError('find_max() arg is an empty sequence'							)
			SCREAMING_SNAKE_CASE_						:			str       						= nums[0]
			for x in nums:
						if x > max_num:
									SCREAMING_SNAKE_CASE_						:			Optional[int]       						= x
			return max_num


if __name__ == "__main__":
				import doctest

				doctest.testmod(verbose=True)





