





import cva
import numpy as np
class 			UpperCamelCase_		:




					def __init__(		self				,						lowerCAmelCase_				,						lowerCAmelCase_  )		->							int:

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




					def __str__(		self  )		->							Tuple:
										return str(self.k  )






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

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


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










def 						lowerCamelCase__     (     UpperCamelCase__			:       list						)			-> list:



					'''simple docstring'''




					_snake_case									=				len(UpperCamelCase__						)
					for i in range(1       ,    UpperCamelCase__						):
										_snake_case									=				collection[i]
										_snake_case									=				0
										_snake_case									=				i - 1

										while low <= high:
															_snake_case									=				(low + high) // 2
															if val < collection[mid]:
																				_snake_case									=				mid - 1
															else:
																				_snake_case									=				mid + 1
										for j in range(UpperCamelCase__       ,    UpperCamelCase__       ,    -1						):
															_snake_case									=				collection[j - 1]
										_snake_case									=				val
					return collection


if __name__ == "__main__":
					UpperCAmelCase_      							=     input("""Enter numbers separated by a comma:\n""").strip()
					UpperCAmelCase_      							=     [int(item) for item in user_input.split(""",""")]
					print(binary_insertion_sort(unsorted))



