'''simple docstring'''




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






def __lowerCAmelCase			(							UpperCamelCase__    ,  UpperCamelCase__    ,  UpperCamelCase__    ,  UpperCamelCase__    ,  UpperCamelCase__    ,  UpperCamelCase__    )     ->   np.ndarray:

    # prepare kernel
    # the kernel size have to be odd
    if (ksize % 2) == 0:
        __lowerCamelCase          =  ksize + 1
    __lowerCamelCase          =  np.zeros((ksize, ksize)    ,  dtype=np.floataa    )

    # each value
    for y in range(UpperCamelCase__    ):
        for x in range(UpperCamelCase__    ):
            # distance from center
            __lowerCamelCase          =  x - ksize // 2
            __lowerCamelCase          =  y - ksize // 2

            # degree to radiant
            __lowerCamelCase          =  theta / 1_80 * np.pi
            __lowerCamelCase          =  np.cos(_theta    )
            __lowerCamelCase          =  np.sin(_theta    )

            # get kernel x
            __lowerCamelCase          =  cos_theta * px + sin_theta * py

            # get kernel y
            __lowerCamelCase          =  -sin_theta * px + cos_theta * py

            # fill kernel
            __lowerCamelCase          =  np.exp(
                -(_x**2 + gamma**2 * _y**2) / (2 * sigma**2)    ) * np.cos(2 * np.pi * _x / lambd + psi    )

    return gabor


if __name__ == "__main__":
  import doctest

  doctest.testmod()
  # read original image
  __UpperCAmelCase												=imread("../image_data/lena.jpg")
  # turn image in gray scale value
  __UpperCAmelCase												=cvtColor(img, COLOR_BGR2GRAY)

  # Apply multiple Kernel to detect edges
  __UpperCAmelCase												=np.zeros(gray.shape[:2])
  for theta in [0, 3_0, 6_0, 9_0, 1_2_0, 1_5_0]:
    __UpperCAmelCase												=gabor_filter_kernel(1_0, 8, theta, 1_0, 0, 0)
    out += filteraD(gray, CV_8UC3, kernel_aa)
  __UpperCAmelCase												=out / out.max() * 2_5_5
  __UpperCAmelCase												=out.astype(np.uinta)

  imshow("Original", gray)
  imshow("Gabor filter with 20x20 mask and 6 directions", out)

  waitKey(0)

'''simple docstring'''




from __future__ import annotations

from typing import Any






def __lowerCAmelCase			(							UpperCamelCase__    )     ->   None:
    create_state_space_tree(UpperCamelCase__    ,  []    ,  0    )






def __lowerCAmelCase			(							UpperCamelCase__    ,  UpperCamelCase__    ,  UpperCamelCase__    )     ->   None:

    if index == len(UpperCamelCase__    ):
        print(UpperCamelCase__    )
        return

    create_state_space_tree(UpperCamelCase__    ,  UpperCamelCase__    ,  index + 1    )
    current_subsequence.append(sequence[index]    )
    create_state_space_tree(UpperCamelCase__    ,  UpperCamelCase__    ,  index + 1    )
    current_subsequence.pop()


if __name__ == "__main__":
  __UpperCAmelCase												=[3, 1, 2, 4]
  generate_all_subsequences(seq)

  seq.clear()
  seq.extend(["A", "B", "C"])
  generate_all_subsequences(seq)
