# Performing white BlackHat operation on images using OpenCV

OpenCVPythonServer Side ProgrammingProgramming

In this program, we will perform the Blackhat operation on an image using OpenCV. BlackHat transform is used to enhance dark objects of interest in a bright background. We will use the morphologyEx(image, cv2.MORPH_BLACKHAT, kernel) function.

## Algorithm

Step 1: Import cv2.
Step 2: Read the image.
Step 3: Define the kernel size.
Step 4: Pass the image and kernel to the cv2.morphologyex() function.
Step 5: Display the output.

## Example Code

import cv2

cv2.imshow('BlackHat', image)