
"""simple docstring"""

import numpy as np
from cva import COLOR_BGR2GRAY, CV_8UC3, cvtColor, filteraD, imread, imshow, waitKey
def 		UpperCAmelCase (		a_,						a_,						a_,						a_,						a_,						a_      ):





		'''simple docstring'''


		if (ksize % 2) == 0:
				lowerCamelCase					:      Optional[int]          =   ksize + 1
		lowerCamelCase					:      Any          =   np.zeros((ksize, ksize),						dtype=np.floataa      )

		# each value
		for y in range(a_      ):
				for x in range(a_      ):
						# distance from center
						lowerCamelCase					:      Optional[int]          =   x - ksize // 2
						lowerCamelCase					:      Optional[int]          =   y - ksize // 2

						# degree to radiant
						lowerCamelCase					:      Optional[Any]          =   theta / 180 * np.pi
						lowerCamelCase					:      Union[str, Any]          =   np.cos(_theta      )
						lowerCamelCase					:      Any          =   np.sin(_theta      )

						# get kernel x
						lowerCamelCase					:      Union[str, Any]          =   cos_theta * px + sin_theta * py

						# get kernel y
						lowerCamelCase					:      int          =   -sin_theta * px + cos_theta * py

						# fill kernel
						lowerCamelCase					:      List[str]          =   np.exp(
						    -(_x**2 + gamma**2 * _y**2) / (2 * sigma**2)      ) * np.cos(2 * np.pi * _x / lambd + psi      )

		return gabor


if __name__ == "__main__":
					import doctest

					doctest.testmod()
					# read original image
					_A						=			imread('../image_data/lena.jpg')
					# turn image in gray scale value
					_A						=			cvtColor(img, COLOR_BGR2GRAY)

					# Apply multiple Kernel to detect edges
					_A						=			np.zeros(gray.shape[:2])
					for theta in [0, 3_0, 6_0, 9_0, 1_2_0, 1_5_0]:
										_A						=			gabor_filter_kernel(1_0, 8, theta, 1_0, 0, 0)
										out += filteraD(gray, CV_8UC3, kernel_aa)
					_A						=			out / out.max() * 2_5_5
					_A						=			out.astype(np.uinta)

					imshow('Original', gray)
					imshow('Gabor filter with 20x20 mask and 6 directions', out)

					waitKey(0)








"""simple docstring"""

def 		UpperCAmelCase (		a_,						a_      ):





		'''simple docstring'''


		while b:
				lowerCamelCase     ,   lowerCamelCase					:      Tuple          =   b, a % b
		return a
def 		UpperCAmelCase (		a_,						a_      ):





		'''simple docstring'''


		return a if b == 0 else euclidean_gcd_recursive(a_,						a % b      )
def 		UpperCAmelCase (		):





		'''simple docstring'''


		print(F"""euclidean_gcd(3, 5) = {euclidean_gcd(3,						5      )}"""      )
		print(F"""euclidean_gcd(5, 3) = {euclidean_gcd(5,						3      )}"""      )
		print(F"""euclidean_gcd(1, 3) = {euclidean_gcd(1,						3      )}"""      )
		print(F"""euclidean_gcd(3, 6) = {euclidean_gcd(3,						6      )}"""      )
		print(F"""euclidean_gcd(6, 3) = {euclidean_gcd(6,						3      )}"""      )

		print(F"""euclidean_gcd_recursive(3, 5) = {euclidean_gcd_recursive(3,						5      )}"""      )
		print(F"""euclidean_gcd_recursive(5, 3) = {euclidean_gcd_recursive(5,						3      )}"""      )
		print(F"""euclidean_gcd_recursive(1, 3) = {euclidean_gcd_recursive(1,						3      )}"""      )
		print(F"""euclidean_gcd_recursive(3, 6) = {euclidean_gcd_recursive(3,						6      )}"""      )
		print(F"""euclidean_gcd_recursive(6, 3) = {euclidean_gcd_recursive(6,						3      )}"""      )


if __name__ == "__main__":
					main()






