






from pathlib import Path

import numpy as np
from PIL import Image


def   lowerCamelCase__			(     lowercase				):

  """simple docstring"""






  SCREAMING_SNAKE_CASE       :      Dict							=    rgb[:, :, 0], rgb[:, :, 1], rgb[:, :, 2]
  return 0.2989 * r + 0.5870 * g + 0.1140 * b


def   lowerCamelCase__			(     lowercase				):

  """simple docstring"""






  return (gray > 127) & (gray <= 255)


def   lowerCamelCase__			(     lowercase						,     lowercase				):

  """simple docstring"""






  SCREAMING_SNAKE_CASE       :      str							=    np.zeros_like(lowercase				)
  SCREAMING_SNAKE_CASE       :      Union[str, Any]							=    np.zeros(
      (image.shape[0] + kernel.shape[0] - 1, image.shape[1] + kernel.shape[1] - 1)				)

  # Copy image to padded image
  SCREAMING_SNAKE_CASE       :      Tuple							=    image

  # Iterate over image & apply kernel
  for x in range(image.shape[1]				):
    for y in range(image.shape[0]				):
      SCREAMING_SNAKE_CASE       :      int							=    (
          kernel * image_padded[y : y + kernel.shape[0], x : x + kernel.shape[1]]
      ).sum()
      SCREAMING_SNAKE_CASE       :      str							=    int(summation > 0				)
  return output


if __name__ == "__main__":
   # read original image
   snake_case    				=		Path(__file__).resolve().parent / """image_data""" / """lena.jpg"""
   snake_case    				=		np.array(Image.open(lena_path))
   # kernel to be applied
   snake_case    				=		np.array([[0, 1, 0], [1, 1, 1], [0, 1, 0]])
   snake_case    				=		dilation(gray_to_binary(rgb_to_gray(lena)), structuring_element)
   # Save the output image
   snake_case    				=		Image.fromarray(output).convert("""RGB""")
   pil_img.save("""result_dilation.png""")














import qiskit


def   lowerCamelCase__			(     lowercase						,     lowercase				):

  """simple docstring"""






  SCREAMING_SNAKE_CASE       :      List[str]							=    qiskit.Aer.get_backend("aer_simulator"				)

  # Create a Quantum Circuit acting on the q register
  SCREAMING_SNAKE_CASE       :      Dict							=    qiskit.QuantumCircuit(lowercase						,     lowercase				)

  # Map the quantum measurement to the classical bits
  circuit.measure([0]						,     [0]				)

  # Execute the circuit on the simulator
  SCREAMING_SNAKE_CASE       :      Union[str, Any]							=    qiskit.execute(lowercase						,     lowercase						,     shots=1000				)

  # Return the histogram data of the results of the experiment.
  return job.result().get_counts(lowercase				)


if __name__ == "__main__":
   print(F"""Total count for various states are: {single_qubit_measure(1, 1)}""")






