



"""simple docstring"""






import cva
import numpy as np



class      A__  :




	'''simple docstring'''





	def __init__(	self:						List[Any]			,     _SCREAMING_SNAKE_CASE:						float			,     _SCREAMING_SNAKE_CASE:						int)							->			Dict:

				"""simple docstring"""

				if k in (0.04, 0.06):
							__lowerCAmelCase :    Any				=			k
							__lowerCAmelCase :    Union[str, Any]				=			window_size
				else:
							raise ValueError("invalid k value")

	def __str__(	self:						Tuple)							->			str:

				"""simple docstring"""

				return str(self.k)







	def 				_SCREAMING_SNAKE_CASE  (	self:						Optional[int]			,     _SCREAMING_SNAKE_CASE:						str)							->			tuple[cva.Mat, list[list[int]]]:

				"""simple docstring"""

				__lowerCAmelCase :    Dict				=			cva.imread(_SCREAMING_SNAKE_CASE			,     0)
				__lowerCAmelCase		,      __lowerCAmelCase :    str				=			img.shape
				__lowerCAmelCase :    list[list[int]]				=			[]
				__lowerCAmelCase :    Union[str, Any]				=			img.copy()
				__lowerCAmelCase :    Optional[Any]				=			cva.cvtColor(_SCREAMING_SNAKE_CASE			,     cva.COLOR_GRAY2RGB)
				__lowerCAmelCase		,      __lowerCAmelCase :    List[Any]				=			np.gradient(_SCREAMING_SNAKE_CASE)
				__lowerCAmelCase :    str				=			dx**2
				__lowerCAmelCase :    Union[str, Any]				=			dy**2
				__lowerCAmelCase :    Dict				=			dx * dy
				__lowerCAmelCase :    Optional[Any]				=			0.04
				__lowerCAmelCase :    Optional[Any]				=			self.window_size // 2
				for y in range(_SCREAMING_SNAKE_CASE			,     h - offset):
							for x in range(_SCREAMING_SNAKE_CASE			,     w - offset):
										__lowerCAmelCase :    Tuple				=			ixx[
										    y - offset : y + offset + 1, x - offset : x + offset + 1
										].sum()
										__lowerCAmelCase :    str				=			iyy[
										    y - offset : y + offset + 1, x - offset : x + offset + 1
										].sum()
										__lowerCAmelCase :    Optional[Any]				=			ixy[
										    y - offset : y + offset + 1, x - offset : x + offset + 1
										].sum()

										__lowerCAmelCase :    List[Any]				=			(wxx * wyy) - (wxy**2)
										__lowerCAmelCase :    Tuple				=			wxx + wyy
										__lowerCAmelCase :    int				=			det - k * (trace**2)
										# Can change the value
										if r > 0.5:
													corner_list.append([x, y, r])
													color_img.itemset((y, x, 0)			,     0)
													color_img.itemset((y, x, 1)			,     0)
													color_img.itemset((y, x, 2)			,     255)
				return color_img, corner_list


if __name__ == "__main__":
	__snake_case				:  Tuple =       HarrisCorner(0.04, 3)
	__snake_case ,						__snake_case				:  List[str] =       edge_detect.detect('path_to_image')
	cva.imwrite('detect.png', color_img)




"""simple docstring"""






def      _lowercase							(    __snake_case   ,__snake_case      )		->  int:
			return int((input_a, input_a).count(1      ) != 0      )


def      _lowercase							(    )		->  None:
			assert or_gate(0   ,0      ) == 0
			assert or_gate(0   ,1      ) == 1
			assert or_gate(1   ,0      ) == 1
			assert or_gate(1   ,1      ) == 1


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