


"""simple docstring"""






def 							A_					(   snake_case__		)				->     float:
   return -num if num < 0 else num





def 							A_					(   snake_case__		)				->     int:
   if len(snake_case__		) == 0:
      raise ValueError('''abs_min() arg is an empty sequence'''		)
   _UpperCamelCase				:str				    =  x[0]
   for i in x:
      if abs_val(snake_case__		) < abs_val(snake_case__		):
         _UpperCamelCase				:Optional[int]				    =  i
   return j





def 							A_					(   snake_case__		)				->     int:
   if len(snake_case__		) == 0:
      raise ValueError('''abs_max() arg is an empty sequence'''		)
   _UpperCamelCase				:List[Any]				    =  x[0]
   for i in x:
      if abs(snake_case__		) > abs(snake_case__		):
         _UpperCamelCase				:Optional[int]				    =  i
   return j





def 							A_					(   snake_case__		)				->     int:
   if len(snake_case__		) == 0:
      raise ValueError('''abs_max_sort() arg is an empty sequence'''		)
   return sorted(snake_case__					,				key=snake_case__		)[-1]





def 							A_					(   )				->     Dict:
   assert abs_val(0		) == 0
   assert abs_val(34		) == 34
   assert abs_val(-10_00_00_00_00_00		) == 10_00_00_00_00_00

   _UpperCamelCase				:Optional[int]				    =  [-3, -1, 2, -11]
   assert abs_max(snake_case__		) == -11
   assert abs_max_sort(snake_case__		) == -11
   assert abs_min(snake_case__		) == -1


if __name__ == "__main__":
     import doctest

     doctest.testmod()

     test_abs_val()
     print(abs_val(-34))  # --> 34





"""simple docstring"""






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

from digital_image_processing.filters.convolve import img_convolve





def 							A_					(   snake_case__		)				->     str:
			_UpperCamelCase				:List[Any]				    =  np.array([[-1, 0, 1], [-2, 0, 2], [-1, 0, 1]]		)
			_UpperCamelCase				:Dict				    =  np.array([[1, 2, 1], [0, 0, 0], [-1, -2, -1]]		)

			_UpperCamelCase				:List[str]				    =  np.abs(img_convolve(snake_case__					,				snake_case__		)		)
			_UpperCamelCase				:Dict				    =  np.abs(img_convolve(snake_case__					,				snake_case__		)		)
			# modify the pix within [0, 255]
			_UpperCamelCase				:List[Any]				    =  dst_x * 2_55 / np.max(snake_case__		)
			_UpperCamelCase				:Tuple				    =  dst_y * 2_55 / np.max(snake_case__		)

			_UpperCamelCase				:Tuple				    =  np.sqrt((np.square(snake_case__		)) + (np.square(snake_case__		))		)
			_UpperCamelCase				:Any				    =  dst_xy * 2_55 / np.max(snake_case__		)
			_UpperCamelCase				:Optional[int]				    =  dst_xy.astype(np.uinta		)

			_UpperCamelCase				:str				    =  np.arctana(snake_case__					,				snake_case__		)
			return dst, theta


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

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

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

