
"""simple docstring"""

import numpy as np
from cva import COLOR_BGR2GRAY, cvtColor, imread, imshow, waitKey

from digital_image_processing.filters.convolve import img_convolve




def       lowercase__  (   lowerCAmelCase			:   Dict	)	-> Optional[Any]:






    """simple docstring"""




    UpperCAmelCase       =   np.array([[-1, 0, 1], [-2, 0, 2], [-1, 0, 1]]	)
    UpperCAmelCase       =   np.array([[1, 2, 1], [0, 0, 0], [-1, -2, -1]]	)

    UpperCAmelCase       =   np.abs(img_convolve(lowerCAmelCase	,			lowerCAmelCase	)	)
    UpperCAmelCase       =   np.abs(img_convolve(lowerCAmelCase	,			lowerCAmelCase	)	)
    # modify the pix within [0, 255]
    UpperCAmelCase       =   dst_x * 255 / np.max(lowerCAmelCase	)
    UpperCAmelCase       =   dst_y * 255 / np.max(lowerCAmelCase	)

    UpperCAmelCase       =   np.sqrt((np.square(lowerCAmelCase	)) + (np.square(lowerCAmelCase	))	)
    UpperCAmelCase       =   dst_xy * 255 / np.max(lowerCAmelCase	)
    UpperCAmelCase       =   dst_xy.astype(np.uinta	)

    UpperCAmelCase       =   np.arctana(lowerCAmelCase	,			lowerCAmelCase	)
    return dst, theta


if __name__ == "__main__":
   # read original image
   SCREAMING_SNAKE_CASE_         =  imread('''../image_data/lena.jpg''')
   # turn image in gray scale value
   SCREAMING_SNAKE_CASE_         =  cvtColor(img, COLOR_BGR2GRAY)

   SCREAMING_SNAKE_CASE_   ,  SCREAMING_SNAKE_CASE_         =  sobel_filter(gray)

   # show result images
   imshow('''sobel filter''', sobel_grad)
   imshow('''sobel theta''', sobel_theta)
   waitKey(0)





"""simple docstring"""

from __future__ import annotations

SCREAMING_SNAKE_CASE_         =  '''Alexander Joslin'''




def       lowercase__  (   lowerCAmelCase			:   int	)	-> int:






    """simple docstring"""




    if number <= 0:
        UpperCAmelCase       =   F"n must be greater than 0. Got n = {number}"
        raise ValueError(lowerCAmelCase	)

    UpperCAmelCase       =   [number + 1] * (number + 1)

    # starting position
    UpperCAmelCase       =   0
    for i in range(1	,			lowerCAmelCase	):
        UpperCAmelCase       =   min(table[i + 1]	,			table[i] + 1	)
        # check if out of bounds
        if i * 2 <= number:
            UpperCAmelCase       =   min(table[i * 2]	,			table[i] + 1	)
        # check if out of bounds
        if i * 3 <= number:
            UpperCAmelCase       =   min(table[i * 3]	,			table[i] + 1	)
    return table[number]


if __name__ == "__main__":
   import doctest

   doctest.testmod()



