# Quantum Dilation and Erosion
## 1 Introduction  
Image analysis is a technique of extracting useful information from images [1, 2] using various computer vision algorithms. Image processing has been on the rise for many years [3]. The concept of image analysis is applicable in multiple fields like health, technology, government sectors, etc. The main objective of image processing is to analyze and capture the features of an image like its size, shape and various other characteristics. It has majorly impacted the health industry by enabling quicker analysis of blood cells to identify various diseases [4]. This technique is also being used by governments to work towards road safety by using computer vision algorithms in radars to capture the digits of vehicle number plates [5]. Morphological image processing is a crucial component of image processing relating to shape or morphology features of the image [6]. Structuring element is a central element of image morphology, in the form of a matrix of binary pixels. The structuring element either fits or intersects the image based on the binary value of the pixels, and it is applied to the input image to generate an output image. Dilation and erosion [2], in simpler terms, opening and closing, are the two eminent morphological operators [7]. These operators are used for a variety of tasks like eradicating noise, detecting outliers in the image, i.e., its depressions, holes etc. as well as linking and separating various elements in the image. Erosion is done to remove details in a binary image whichresults in reducing the size of the image, whereas dilation enlarges the image by connecting the gaps within the image pixels. Dilation and erosion act opposite to each other when applied on a binary image, with the structural element being the deciding factor in the outcome of the image.  
Quantum morphology operations [8] are propounded based on the novel enhanced quantum representation model. The quantum logical operators are the base on which the quantum morphology operations are implemented. These quantum logical operators perform operations on pixels based on their corresponding pixel value within dual or multiple images. Logic gates are employed to transform input qubits to the same number of output qubits depending on the computation of the gates. Here, we will look at two quantum gates, the Toffoli gate and Swap gate. The Toffoli gate, aka CCNOT (controlled-controlled-not) gate [9; 10], is a reversible logic gate which inverses the output bits based on the input bits. The swap gate interchanges the qubits based on their placement in the matrices.  
In the paper written by [PERSON] et al. [11], a very interesting algorithm is proposed. They make use of the quantum circuits to accomplish the functions of dilation and erosion. Compared with the classical dilation and erosion algorithms, which are fundamental in classical image processing, this algorithm is pure quantum; that is, all of the operations are realized by the quantum gates in a quantum circuit. Although dilation and erosion are not very complicated algorithms, they require many of the conditions we need in quantum image processing. In this algorithm, a system for using qubits to code and process image information is built, so it could be easily applied to other algorithms in quantum image processing. The idea for the algorithm could also be applied into many other fields. This is a very practical attempt, or a good start, to the future use of real computers, which scientists all over the world are working on. This fundamental application promises the transplant action of more algorithms into quantum circuits in the future.  
However, the proposed algorithm is not completely accurate due to the ambiguous definition of the qubits for different information in the images, which we will discuss in this paper. Here, we propose a more consistent algorithm for quantum dilation and erosion as well as its implementation in the IBM quantum simulator.