"""simple docstring"""
import numpy as np
from cva import COLOR_BGR2GRAY, CV_8UC3, cvtColor, filteraD, imread, imshow, waitKey





def    lowerCAmelCase__    (			_UpperCamelCase       :				int ,			_UpperCamelCase       :				int ,			_UpperCamelCase       :				int ,			_UpperCamelCase       :				int ,			_UpperCamelCase       :				int ,			_UpperCamelCase       :				int					)					->				np.ndarray:





						"""simple docstring"""






						if (ksize % 2) == 0:
												snake_case								=			ksize + 1
						snake_case								=			np.zeros((ksize, ksize) ,			dtype=np.floataa					)

						# each value
						for y in range(_UpperCamelCase					):
												for x in range(_UpperCamelCase					):
																		# distance from center
																		snake_case								=			x - ksize // 2
																		snake_case								=			y - ksize // 2

																		# degree to radiant
																		snake_case								=			theta / 1_8_0 * np.pi
																		snake_case								=			np.cos(_theta					)
																		snake_case								=			np.sin(_theta					)

																		# get kernel x
																		snake_case								=			cos_theta * px + sin_theta * py

																		# get kernel y
																		snake_case								=			-sin_theta * px + cos_theta * py

																		# fill kernel
																		snake_case								=			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
					SCREAMING_SNAKE_CASE__      						=  imread("../image_data/lena.jpg")
					# turn image in gray scale value
					SCREAMING_SNAKE_CASE__      						=  cvtColor(img, COLOR_BGR2GRAY)

					# Apply multiple Kernel to detect edges
					SCREAMING_SNAKE_CASE__      						=  np.zeros(gray.shape[:2])
					for theta in [0, 30, 60, 90, 120, 150]:
										SCREAMING_SNAKE_CASE__      						=  gabor_filter_kernel(10, 8, theta, 10, 0, 0)
										out += filteraD(gray, CV_8UC3, kernel_aa)
					SCREAMING_SNAKE_CASE__      						=  out / out.max() * 255
					SCREAMING_SNAKE_CASE__      						=  out.astype(np.uinta)

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

					waitKey(0)



"""simple docstring"""
def    lowerCAmelCase__    (			_UpperCamelCase       :				int ,			_UpperCamelCase       :				int					)					->				int:





						"""simple docstring"""






						return int((input_a, input_a).count(0					) == 0					)





def    lowerCAmelCase__    (			)					->				None:





						"""simple docstring"""






						assert and_gate(0 ,			0					) == 0
						assert and_gate(0 ,			1					) == 0
						assert and_gate(1 ,			0					) == 0
						assert and_gate(1 ,			1					) == 1


if __name__ == "__main__":
					test_and_gate()
					print(and_gate(1, 0))
					print(and_gate(0, 0))
					print(and_gate(0, 1))
					print(and_gate(1, 1))


