
"""simple docstring"""




def        _lowerCamelCase ( __a    ):
		SCREAMING_SNAKE_CASE_						 = abs(snake_case__    )
		SCREAMING_SNAKE_CASE_						 = 0
		while n > 0:
				res += n % 10
				n //= 10
		return res



def        _lowerCamelCase ( __a    ):
		SCREAMING_SNAKE_CASE_						 = abs(snake_case__    )
		return n if n < 10 else n % 10 + sum_of_digits(n // 10    )



def        _lowerCamelCase ( __a    ):
		return sum(int(snake_case__    ) for c in str(abs(snake_case__    )    )    )



def        _lowerCamelCase ( ):
		from collections.abc import Callable
		from timeit import timeit

		def benchmark_a_function(__a,							__a    ) -> None:
				SCREAMING_SNAKE_CASE_						 = F'{func.__name__}({value})'
				SCREAMING_SNAKE_CASE_						 = timeit(F'__main__.{call}',							setup='''import __main__'''    )
				print(F'{call:56} = {func(snake_case__    )} -- {timing:.4f} seconds'    )

		for value in (262_144, 1_125_899_906_842_624, 1_267_650_600_228_229_401_496_703_205_376):
				for func in (sum_of_digits, sum_of_digits_recursion, sum_of_digits_compact):
						benchmark_a_function(snake_case__,							snake_case__    )
				print()


if __name__ == "__main__":
						import doctest

						doctest.testmod()
						benchmark()

"""simple docstring"""




import cva
import numpy as np





class  snake_case     :

							def __init__(self       ,       SCREAMING_SNAKE_CASE_       ,       SCREAMING_SNAKE_CASE_    ):

									"""simple docstring"""







									if k in (0.04, 0.06):
											SCREAMING_SNAKE_CASE_						 = k
											SCREAMING_SNAKE_CASE_						 = window_size
									else:
											raise ValueError('''invalid k value'''    )

							def __str__(self    ):

									"""simple docstring"""







									return str(self.k    )







							def _lowercase					(self       ,       SCREAMING_SNAKE_CASE_    ):

									"""simple docstring"""







									SCREAMING_SNAKE_CASE_						 = cva.imread(SCREAMING_SNAKE_CASE_       ,       0    )
									SCREAMING_SNAKE_CASE_ ,SCREAMING_SNAKE_CASE_						 = img.shape
									SCREAMING_SNAKE_CASE_						 = []
									SCREAMING_SNAKE_CASE_						 = img.copy()
									SCREAMING_SNAKE_CASE_						 = cva.cvtColor(SCREAMING_SNAKE_CASE_       ,       cva.COLOR_GRAY2RGB    )
									SCREAMING_SNAKE_CASE_ ,SCREAMING_SNAKE_CASE_						 = np.gradient(SCREAMING_SNAKE_CASE_    )
									SCREAMING_SNAKE_CASE_						 = dx**2
									SCREAMING_SNAKE_CASE_						 = dy**2
									SCREAMING_SNAKE_CASE_						 = dx * dy
									SCREAMING_SNAKE_CASE_						 = 0.04
									SCREAMING_SNAKE_CASE_						 = self.window_size // 2
									for y in range(SCREAMING_SNAKE_CASE_       ,       h - offset    ):
											for x in range(SCREAMING_SNAKE_CASE_       ,       w - offset    ):
													SCREAMING_SNAKE_CASE_						 = ixx[
													    y - offset : y + offset + 1, x - offset : x + offset + 1
													].sum()
													SCREAMING_SNAKE_CASE_						 = iyy[
													    y - offset : y + offset + 1, x - offset : x + offset + 1
													].sum()
													SCREAMING_SNAKE_CASE_						 = ixy[
													    y - offset : y + offset + 1, x - offset : x + offset + 1
													].sum()

													SCREAMING_SNAKE_CASE_						 = (wxx * wyy) - (wxy**2)
													SCREAMING_SNAKE_CASE_						 = wxx + wyy
													SCREAMING_SNAKE_CASE_						 = 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)       ,       2_55    )
									return color_img, corner_list


if __name__ == "__main__":
						lowerCAmelCase__							=				HarrisCorner(0.04, 3)
						lowerCAmelCase__,  lowerCAmelCase__							=				edge_detect.detect('path_to_image')
						cva.imwrite('detect.png', color_img)