Description
Implement a function that can increase the contrast of a colored image using morphological operators. One way to achieve this goal is to use the following expression to increase the contrast of image I:
IIncContrast =I+a(I−I B)−b(I•B−I)
where I is the original image, B is the structuring element, a and b are constants, • indicates closing.
Apply your function to the image “Suez Canal.png”.
Deliverables:
• Your code.
indicates opening and
- Explain how the equation given above increases the contrast of images.
- The output image with a square structuring element of size 3 x 3 when a = 1 and b = 1.
- The output image with a square structuring element of size 9 x 9 when a = 1 and b = 1.
- The output image with a square structuring element of size 3 x 3 when a = 5 and b = 1.
- The output image with a square structuring element of size 3 x 3 when a = 1 and b = 5.
- Comment on the effect of increase the structuring element size on the output image.
- Comment on the effect of increasing or decreasing a and b on the output image.
- Suggest an expression that could decrease the contrast using morphological operators.
Note: Don’t use already existing functions in Python for morphological operators. You have to implement them from scratch.