In the previous articles, the Opening operation and the Closing operations were specified. In this article, another morphological operation is elaborated that is Gradient. It is used for generating the outline of the image. There are two types of gradients, internal and external gradient. The internal gradient enhances the internal boundaries of objects brighter than their background and external boundaries of objects darker than their background. For binary images, the internal gradient generates a mask of the internal boundaries of the foreground image objects.
Syntax: cv2.morphologyEx(image, cv2.MORPH_GRADIENT, kernel)
-> image: Input Image array.
-> cv2.MORPH_GRADIENT: Applying the Morphological Gradient operation.
-> kernel: Structuring element.
Below is the Python code explaining Gradient Morphological Operation –
- Python | Morphological Operations in Image Processing (Closing) | Set-2
- Python | Morphological Operations in Image Processing (Opening) | Set-1
- Image segmentation using Morphological operations in Python
- Image Processing in MATLAB | Fundamental Operations
- Point Processing in Image Processing using Python-OpenCV
- Getting started with Scikit-image: image processing in Python
- Image Processing in Java | Set 3 (Colored image to greyscale image conversion)
- 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 without OpenCV | Python
- Python - Blood Cell Identification using Image Processing
- Image Processing in Python (Scaling, Rotating, Shifting and Edge Detection)
- Image Processing in Java | Set 5 (Colored to Red Green Blue Image Conversion)
- Image Processing in Java | Set 7 (Creating a random pixel image)
- Image Edge Detection Operators in Digital Image Processing
- Image Processing in Java | Set 11 (Changing orientation of image)
- Image Processing in Java | Set 8 (Creating mirror image)
- Image Processing in Java | Set 10 ( Watermarking an image )
- Digital Image Processing Basics
- Digital Image Processing Chain
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.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.