




'''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 		a_( lowerCamelCase      )				->Dict:






       '''simple docstring'''




       lowercase  :		Union[str, Any]						=      np.array([[-1, 0, 1], [-2, 0, 2], [-1, 0, 1]]      )
       lowercase  :		Optional[int]						=      np.array([[1, 2, 1], [0, 0, 0], [-1, -2, -1]]      )

       lowercase  :		Tuple						=      np.abs(img_convolve(lowerCamelCase   ,				lowerCamelCase      )      )
       lowercase  :		Tuple						=      np.abs(img_convolve(lowerCamelCase   ,				lowerCamelCase      )      )
       # modify the pix within [0, 255]
       lowercase  :		Union[str, Any]						=      dst_x * 255 / np.max(lowerCamelCase      )
       lowercase  :		Optional[int]						=      dst_y * 255 / np.max(lowerCamelCase      )

       lowercase  :		Dict						=      np.sqrt((np.square(lowerCamelCase      )) + (np.square(lowerCamelCase      ))      )
       lowercase  :		Dict						=      dst_xy * 255 / np.max(lowerCamelCase      )
       lowercase  :		Tuple						=      dst_xy.astype(np.uinta      )

       lowercase  :		Any						=      np.arctana(lowerCamelCase   ,				lowerCamelCase      )
       return dst, theta


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

      lowercase	,	lowercase	:      Union[str, Any]				=       sobel_filter(gray)

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










'''simple docstring'''






def 		a_( lowerCamelCase   ,				lowerCamelCase      )				->list[tuple[int, int, int]]:






       '''simple docstring'''




       lowercase  :		Dict						=      sorted(lowerCamelCase   ,				key=lambda lowerCamelCase      : edge[2]      )

       lowercase  :		str						=      list(range(lowerCamelCase      )      )

       def find_parent(lowerCamelCase      ):
              if i != parent[i]:
                     lowercase  :		Optional[int]						=      find_parent(parent[i]      )
              return parent[i]

       lowercase  :		Union[str, Any]						=      0
       lowercase  :		Any						=      []

       for edge in edges:
              lowercase  :		Optional[Any]						=      find_parent(edge[0]      )
              lowercase  :		Any						=      find_parent(edge[1]      )
              if parent_a != parent_b:
                     minimum_spanning_tree_cost += edge[2]
                     minimum_spanning_tree.append(lowerCamelCase      )
                     lowercase  :		Optional[int]						=      parent_b

       return minimum_spanning_tree


if __name__ == "__main__":  # pragma: no cover
      lowercase	,	lowercase	:      List[Any]				=       list(map(int, input().strip().split()))
      lowercase	:      List[Any]				=       []

      for _ in range(num_edges):
            lowercase	,	lowercase	,	lowercase	:      Optional[Any]				=       (int(x) for x in input().strip().split())
            edges.append((nodea, nodea, cost))

      kruskal(num_nodes, edges)




