


'''simple docstring'''
import numpy as np
from cva import COLOR_BGR2GRAY, cvtColor, imread
from numpy import array, uinta
from PIL import Image

from digital_image_processing import change_contrast as cc
from digital_image_processing import convert_to_negative as cn
from digital_image_processing import sepia as sp
from digital_image_processing.dithering import burkes as bs
from digital_image_processing.edge_detection import canny
from digital_image_processing.filters import convolve as conv
from digital_image_processing.filters import gaussian_filter as gg
from digital_image_processing.filters import local_binary_pattern as lbp
from digital_image_processing.filters import median_filter as med
from digital_image_processing.filters import sobel_filter as sob
from digital_image_processing.resize import resize as rs

__snake_case							      =     imread(R'''digital_image_processing/image_data/lena_small.jpg''')
__snake_case							      =     cvtColor(img, COLOR_BGR2GRAY)


def 			a      (			)  ->	int:



					'''simple docstring'''






					UpperCamelCase__   :List[Any]												= cn.convert_to_negative(__a   )
					# assert negative_img array for at least one True
					assert negative_img.any()


def 			a      (			)  ->	Optional[Any]:



					'''simple docstring'''






					with Image.open('''digital_image_processing/image_data/lena_small.jpg'''   ) as img:
										# Work around assertion for response
										assert str(cc.change_contrast(__a ,					110   )   ).startswith(
										    '''<PIL.Image.Image image mode=RGB size=100x100 at'''   )


def 			a      (			)  ->	Optional[Any]:



					'''simple docstring'''






					UpperCamelCase__   :List[Any]												= canny.gen_gaussian_kernel(9 ,					sigma=1.4   )
					# Assert ambiguous array
					assert resp.all()


def 			a      (			)  ->	Dict:



					'''simple docstring'''






					UpperCamelCase__   :int												= imread('''digital_image_processing/image_data/lena_small.jpg''' ,					0   )
					# assert ambiguous array for all == True
					assert canny_img.all()
					UpperCamelCase__   :Optional[Any]												= canny.canny(__a   )
					# assert canny array for at least one True
					assert canny_array.any()


def 			a      (			)  ->	Optional[Any]:



					'''simple docstring'''






					assert gg.gaussian_filter(__a ,					5 ,					sigma=0.9   ).all()


def 			a      (			)  ->	Any:



					'''simple docstring'''






					UpperCamelCase__   :Optional[int]												= array([[0.2_5, 0.5, 0.2_5], [0.5, -3, 0.5], [0.2_5, 0.5, 0.2_5]]   )
					UpperCamelCase__   :Dict												= conv.img_convolve(__a ,					__a   ).astype(__a   )
					assert res.any()


def 			a      (			)  ->	Union[str, Any]:



					'''simple docstring'''






					assert med.median_filter(__a ,					3   ).any()


def 			a      (			)  ->	List[Any]:



					'''simple docstring'''






					UpperCamelCase__					,				UpperCamelCase__   :Dict												= sob.sobel_filter(__a   )
					assert grad.any() and theta.any()


def 			a      (			)  ->	Optional[Any]:



					'''simple docstring'''






					UpperCamelCase__   :str												= sp.make_sepia(__a ,					20   )
					assert sepia.all()


def 			a      (			__a = "digital_image_processing/image_data/lena_small.jpg"   )  ->	List[str]:



					'''simple docstring'''






					UpperCamelCase__   :List[Any]												= bs.Burkes(imread(__a ,					1   ) ,					120   )
					burkes.process()
					assert burkes.output_img.any()


def 			a      (			__a = "digital_image_processing/image_data/lena_small.jpg" ,					)  ->	List[Any]:



					'''simple docstring'''






					UpperCamelCase__   :int												= rs.NearestNeighbour(imread(__a ,					1   ) ,					400 ,					200   )
					nn.process()
					assert nn.output.any()







def 			a      (			)  ->	Optional[int]:



					'''simple docstring'''






					UpperCamelCase__   :Dict												= '''digital_image_processing/image_data/lena.jpg'''

					# Reading the image and converting it to grayscale.
					UpperCamelCase__   :str												= imread(__a ,					0   )

					# Test for get_neighbors_pixel function() return not None
					UpperCamelCase__   :Optional[int]												= 0
					UpperCamelCase__   :str												= 0
					UpperCamelCase__   :Tuple												= image[x_coordinate][y_coordinate]

					UpperCamelCase__   :int												= lbp.get_neighbors_pixel(
					    __a ,					__a ,					__a ,					__a   )

					assert neighbors_pixels is not None

					# Test for local_binary_pattern function()
					# Create a numpy array as the same height and width of read image
					UpperCamelCase__   :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]   ):
															UpperCamelCase__   :List[Any]												= lbp.local_binary_value(__a ,					__a ,					__a   )

					assert lbp_image.any()


'''simple docstring'''
from __future__ import annotations

import math


def        _lowerCAmelCase					(						_UpperCamelCase						:     int				)      ->			bool:
     """simple docstring"""




     if 1 < number < 4:
          # 2 and 3 are primes
          return True
     elif number < 2 or number % 2 == 0 or number % 3 == 0:
          # Negatives, 0, 1, all even numbers, all multiples of 3 are not primes
          return False

     # All primes number are in format of 6k +/- 1
     for i in range(5							, int(math.sqrt(_UpperCamelCase				) + 1				)							, 6				):
          if number % i == 0 or number % (i + 2) == 0:
               return False
     return True


def        _lowerCAmelCase					(						_UpperCamelCase						:     int				)      ->			list[int]:
     """simple docstring"""




     _SCREAMING_SNAKE_CASE							    =str(_UpperCamelCase				)
     _SCREAMING_SNAKE_CASE							    =[n]
     for i in range(1							, len(_UpperCamelCase				)				):
          list_nums.append(int(str_num[i:]				)				)
          list_nums.append(int(str_num[:-i]				)				)
     return list_nums


def        _lowerCAmelCase					(						_UpperCamelCase						:     int				)      ->			bool:
     """simple docstring"""




     if len(str(_UpperCamelCase				)				) > 3:
          if not is_prime(int(str(_UpperCamelCase				)[-3:]				)				) or not is_prime(int(str(_UpperCamelCase				)[:3]				)				):
               return False
     return True


def        _lowerCAmelCase					(						_UpperCamelCase						:     int = 11				)      ->			list[int]:
     """simple docstring"""




     _SCREAMING_SNAKE_CASE							    =[]
     _SCREAMING_SNAKE_CASE							    =13
     while len(_UpperCamelCase				) != count:
          if validate(_UpperCamelCase				):
               _SCREAMING_SNAKE_CASE							    =list_truncated_nums(_UpperCamelCase				)
               if all(is_prime(_UpperCamelCase				) for i in list_nums				):
                    list_truncated_primes.append(_UpperCamelCase				)
          num += 2
     return list_truncated_primes


def        _lowerCAmelCase					(						)      ->			int:
     """simple docstring"""




     return sum(compute_truncated_primes(11				)				)


if __name__ == "__main__":
     print(f'''{sum(compute_truncated_primes(1_1)) = }''')
