





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

from digital_image_processing.filters.convolve import img_convolve







def  A					(				UpperCAmelCase					):
					_snake_case							:       Union[str, Any]												= np.array([[-1, 0, 1], [-2, 0, 2], [-1, 0, 1]]					)
					_snake_case							:       Optional[Any]												= np.array([[1, 2, 1], [0, 0, 0], [-1, -2, -1]]					)

					_snake_case							:       Dict												= np.abs(img_convolve(UpperCAmelCase	,	UpperCAmelCase					)					)
					_snake_case							:       Optional[Any]												= np.abs(img_convolve(UpperCAmelCase	,	UpperCAmelCase					)					)
					# modify the pix within [0, 255]
					_snake_case							:       Optional[int]												= dst_x * 255 / np.max(UpperCAmelCase					)
					_snake_case							:       str												= dst_y * 255 / np.max(UpperCAmelCase					)

					_snake_case							:       List[str]												= np.sqrt((np.square(UpperCAmelCase					)) + (np.square(UpperCAmelCase					))					)
					_snake_case							:       List[Any]												= dst_xy * 255 / np.max(UpperCAmelCase					)
					_snake_case							:       Union[str, Any]												= dst_xy.astype(np.uinta					)

					_snake_case							:       str												= np.arctana(UpperCAmelCase	,	UpperCAmelCase					)
					return dst, theta


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

							__lowerCAmelCase , __lowerCAmelCase			:List[str]	 =     sobel_filter(gray)

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






def  A					(				UpperCAmelCase					):
					if not isinstance(UpperCAmelCase	,	UpperCAmelCase					):
										_snake_case							:       Optional[Any]												= F"""Input value of [number={number}] must be an integer"""
										raise TypeError(UpperCAmelCase					)
					if number < 1:
										raise ValueError("Input must be a positive integer"					)
					return number * (2 * number - 1)


if __name__ == "__main__":
							import doctest

							doctest.testmod()