Opening and Closing are dual operations used in Digital Image Processing for restoring an eroded image. Opening is generally used to restore or recover the original image to the maximum possible extent. Closing is generally used to smoother the contour of the distorted image and fuse back the narrow breaks and long thin gulfs. Closing is also used for getting rid of the small holes of the obtained image.
The combination of Opening and Closing is generally used to clean up artifacts in the segmented image before using the image for digital analysis.

Some of the differences between Opening and Closing are:
| S.No. | Opening | Closing |
|---|---|---|
| 1. | Opening is a process in which first erosion operation is performed and then dilation operation is performed. | Closing is a process in which first dilation operation is performed and then erosion operation is performed. |
| 2. | Opening operation performed on X & Y is the union of all translations of Y that fit entirely within X. | Closing operation performed on X & Y is the complement of the union of all translations of Y that do not fit entirely within X. |
| 3. | It eliminates the thin protrusions of the obtained image. | It eliminates the small holes from the obtained image. |
| 4. | Opening operation performed on X & Y is represented by (AoB). | Closing operation performed on X & Y is represented by (A.B) |
| 5. | Opening is used for removing internal noise of the obtained image. | Closing is used for smoothening of contour and fusing of narrow breaks. |
Opening is denoted by:
![]()
Properties of Opening are:
1. XoY is a subset (subimage of X)
2. If X is a subset of Z then XoY is a subset of ZoY
3.(XoY)oY = XoY
Closing is denoted by:

Properties of Closing are:
1. X is a subset subimage of X.Y
2. (X.Y).Y = X.Y
Recommended Posts:
- Python | Morphological Operations in Image Processing (Closing) | Set-2
- Python | Morphological Operations in Image Processing (Opening) | Set-1
- Image Edge Detection Operators in Digital Image Processing
- Digital Image Processing Chain
- Digital Image Processing Basics
- Redundancy in Digital Image Processing
- Difference between Digital Light Processing (DLP) and Liquid Crystal Display (LCD) Projector
- Difference between Image Processing and Computer Vision
- Image Processing in Java | Set 4 (Colored image to Negative image conversion)
- Image Processing in Java | Set 6 (Colored image to Sepia image conversion)
- Image Processing in Java | Set 3 (Colored image to greyscale image conversion)
- Image Processing in Java | Set 5 (Colored to Red Green Blue Image Conversion)
- Image Processing in Java | Set 7 (Creating a random pixel image)
- Getting started with Scikit-image: image processing in Python
- Image Processing in Java | Set 8 (Creating mirror image)
- Image Processing in Java | Set 11 (Changing orientation of image)
- Image Processing in Java | Set 10 ( Watermarking an image )
- Difference between Batch Processing and Real Time Processing System
- Difference between Traditional Processing and Stream Processing
- Image Processing In Java | Set 2 (Get and set Pixels)
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

