





"""simple docstring"""






from PIL import Image



def  __lowerCamelCase					(					lowerCAmelCase__				):
				A__ ,			A__							 =       image.size
				A__							 =       0
				A__							 =       image.load()
				for i in range(lowerCAmelCase__				):
								for j in range(lowerCAmelCase__				):
												A__							 =       pixels[j, i]
												mean += pixel
				mean //= width * height

				for j in range(lowerCAmelCase__				):
								for i in range(lowerCAmelCase__				):
												A__							 =       255 if pixels[i, j] > mean else 0
				return image


if __name__ == "__main__":
					SCREAMING_SNAKE_CASE						:						Dict					   =       mean_threshold(Image.open('''path_to_image''').convert('''L'''))
					image.save('''output_image_path''')










"""simple docstring"""






import numpy as np



def  __lowerCamelCase					(					lowerCAmelCase__				):
				return 1 / (1 + np.exp(-vector				))



def  __lowerCamelCase					(					lowerCAmelCase__				):
				return vector * sigmoid(lowerCAmelCase__				)


if __name__ == "__main__":
					import doctest

					doctest.testmod()


