




import cva
import numpy as np



def   lowerCAmelCase						(						_lowerCAmelCase							:				np.ndarray  ,							_lowerCAmelCase							:				int  ,							_lowerCAmelCase							:				int  ,							_lowerCAmelCase							:				int		):




 """simple docstring"""







 try:
  return int(image[x_coordinate][y_coordinate] >= center		)
 except (IndexError, TypeError):
  return 0



def   lowerCAmelCase						(						_lowerCAmelCase							:				np.ndarray  ,							_lowerCAmelCase							:				int  ,							_lowerCAmelCase							:				int		):




 """simple docstring"""







 UpperCAmelCase__								=  image[x_coordinate][y_coordinate]
 UpperCAmelCase__								=  [1, 2, 4, 8, 16, 32, 64, 128]

 # skip get_neighbors_pixel if center is null
 if center is None:
  return 0

 # Starting from the top right, assigning value to pixels clockwise
 UpperCAmelCase__								=  [
     get_neighbors_pixel(_lowerCAmelCase  ,							x_coordinate - 1  ,							y_coordinate + 1  ,							_lowerCAmelCase		),
     get_neighbors_pixel(_lowerCAmelCase  ,							_lowerCAmelCase  ,							y_coordinate + 1  ,							_lowerCAmelCase		),
     get_neighbors_pixel(_lowerCAmelCase  ,							x_coordinate - 1  ,							_lowerCAmelCase  ,							_lowerCAmelCase		),
     get_neighbors_pixel(_lowerCAmelCase  ,							x_coordinate + 1  ,							y_coordinate + 1  ,							_lowerCAmelCase		),
     get_neighbors_pixel(_lowerCAmelCase  ,							x_coordinate + 1  ,							_lowerCAmelCase  ,							_lowerCAmelCase		),
     get_neighbors_pixel(_lowerCAmelCase  ,							x_coordinate + 1  ,							y_coordinate - 1  ,							_lowerCAmelCase		),
     get_neighbors_pixel(_lowerCAmelCase  ,							_lowerCAmelCase  ,							y_coordinate - 1  ,							_lowerCAmelCase		),
     get_neighbors_pixel(_lowerCAmelCase  ,							x_coordinate - 1  ,							y_coordinate - 1  ,							_lowerCAmelCase		),
 ]

 # Converting the binary value to decimal.
 return sum(
     binary_value * power for binary_value, power in zip(_lowerCAmelCase  ,							_lowerCAmelCase		)		)


if __name__ == "__main__":
  # Reading the image and converting it to grayscale.
  _lowerCAmelCase  :				Dict						=				cva.imread(
      "digital_image_processing/image_data/lena.jpg", cva.IMREAD_GRAYSCALE
  )

  # Create a numpy array as the same height and width of read image
  _lowerCAmelCase  :				str						=				np.zeros((image.shape[0], image.shape[1]))

  # Iterating through the image and calculating the
  # local binary pattern value for each pixel.
  for i in range(0, image.shape[0]):
    for j in range(0, image.shape[1]):
      _lowerCAmelCase  :				List[str]						=				local_binary_value(image, i, j)

  cva.imshow("local binary pattern", lbp_image)
  cva.waitKey(0)
  cva.destroyAllWindows()











def   lowerCAmelCase						(						_lowerCAmelCase							:				int  ,							_lowerCAmelCase							:				int		):




 """simple docstring"""







 if a < b:
  return gcd(_lowerCAmelCase  ,							_lowerCAmelCase		)
 if a % b == 0:
  return b
 return gcd(_lowerCAmelCase  ,							a % b		)



def   lowerCAmelCase						(						_lowerCAmelCase							:				int  ,							_lowerCAmelCase							:				int  ,							_lowerCAmelCase							:				int		):




 """simple docstring"""







 if y == 0:
  return 1
 UpperCAmelCase__								=  power(_lowerCAmelCase  ,							y // 2  ,							_lowerCAmelCase		) % mod
 UpperCAmelCase__								=  (temp * temp) % mod
 if y % 2 == 1:
  UpperCAmelCase__								=  (temp * x) % mod
 return temp



def   lowerCAmelCase						(						_lowerCAmelCase							:				int		):




 """simple docstring"""







 UpperCAmelCase__								=  2
 while b < n:
  if gcd(_lowerCAmelCase  ,							_lowerCAmelCase		) == 1 and power(_lowerCAmelCase  ,							n - 1  ,							_lowerCAmelCase		) != 1:
   return False
  b += 1
 return True


if __name__ == "__main__":
  _lowerCAmelCase  :				Dict						=				int(input("Enter number: ").strip())
  if is_carmichael_number(number):
    print(F'''{number} is a Carmichael Number.''')
  else:
    print(F'''{number} is not a Carmichael Number.''')





