# Detecting contours in an image using OpenCV

OpenCVPythonServer Side ProgrammingProgramming

In this program, we will detect contours in an image. Contours can be explained simply as a curve joining all the continuous points having the same color or intensity. The contours are a useful tool for shape analysis and object detection and recognition.

## Algorithm

Step 1: Import OpenCV.
Step 2: Import matplotlib.
Step 4: Convert the image from bgr2rgb.
Step 5: Convert the rgb image to grayscale.
Step 4: Perform thresholding on the image.
Step 5: Find contours on the image.
Step 6: Draw contours on the image.
Step 7: Display the output.

## Example Code

import cv2
import matplotlib.pyplot as plt

plt.show()