Python OpenCV Tutorial


OpenCV cv2 Tutorial

OpenCV is a library of programming functions mainly aimed at real-time computer vision. We can do image processing, machine learning, etc using OpenCV.

In this series of OpenCV Python Examples, you will start to write Python programs to perform basic operations in Image Processing like reading an image, resizing an image, extracting the different color channels of the image and also working around with these color channels.

You will also learn some of the intermediate level topics like finding contours in the image, capturing video from camera, blending images, writing text on the image, etc.


Get Started

  1. Install OpenCV Python on Mac

Read and Save Operations

  1. Python OpenCV - Read image to array
  2. Python OpenCV - Show image
  3. Python OpenCV - Save image

Image Manipulation

  1. Python OpenCV - Add noise to image
  2. Python OpenCV - Add or blend two images
  3. Python OpenCV - Crop image
  4. Python OpenCV - Flip image
  5. Python OpenCV - Resize image
  6. Python OpenCV - Rotate image
  7. Python OpenCV - Scale image
  8. Python OpenCV - Write text on image

Conversions

  1. Python OpenCV - Convert image to black and white
  2. Python OpenCV - Convert image to grayscale
  3. Python OpenCV - Convert BGR to RGB

Conversion between Image Formats

  1. Python OpenCV - Convert PNG to JPG
  2. Python OpenCV - Convert PNG to JPG with specific background color
  3. Python OpenCV - Convert PNG to WebP
  4. Python OpenCV - Convert JPG to WebP

Filtering

  1. Python OpenCV - Blur image
  2. Python OpenCV - Filter image using convolution
  3. Python OpenCV - Find contours in image
  4. Python OpenCV - Edge detection

Morphing

  1. Python OpenCV - Image dilation
  2. Python OpenCV - Image erosion

Color Filtering

  1. Python OpenCV - Extract red color channel from image
  2. Python OpenCV - Extract green color channel from image
  3. Python OpenCV - Extract blue color channel from image
  4. Python OpenCV - Remove green color channel from image
  5. Python OpenCV - Remove blue color channel from image
  6. Python OpenCV - Remove red color channel from image

Video

  1. Python OpenCV - Capture video from camera
  2. Python OpenCV - Create video from images

Transformations

  1. Python OpenCV - Histogram Equalization

Image Feature Processing

  1. Python OpenCV - Corner Detection
  1. Image Histogram and Histogram Plotting:
    1. Provide a tutorial on computing and visualizing image histograms.
  2. Foreground Extraction:
    1. Demonstrate techniques for extracting the foreground from an image, especially when the background is cluttered.
  3. Image Segmentation:
    1. Explore different methods for segmenting an image into meaningful regions.
  4. Image Thresholding Techniques:
    1. Dive deeper into various thresholding methods like Otsu's method, adaptive thresholding, etc.
  5. Hough Transform:
    1. Explain how to use the Hough transform for line and circle detection in images.
  6. Face Detection with Haar Cascades:
    1. Provide a tutorial on using Haar cascades for face detection.
  7. Background Subtraction:
    1. Discuss methods for background subtraction in videos to isolate moving objects.
  8. Image Registration:
    1. Cover techniques for aligning images taken from different perspectives or times.
  9. Contour Features:
    1. Explore the use of contour features, such as area, perimeter, and centroid.
  10. Image Interpolation:
    1. Explain different interpolation methods used during image resizing.
  11. Color Spaces Conversion (YUV, Lab, etc.):
    1. Extend the color space conversion tutorials to cover less common color spaces.
  12. Camera Calibration with Chessboard Patterns:
    1. Provide a step-by-step guide on calibrating a camera using chessboard patterns.
  13. Image Warping and Transformation:
    1. Demonstrate how to warp and transform images using affine and perspective transformations.
  14. Custom Image Filters:
    1. Show how to create and apply custom image filters for specific effects.
  15. Object Tracking:
    1. Explore techniques for tracking objects in video streams.
  16. Image Similarity and Matching:
    1. Discuss methods for finding similarities between images or matching key features.
  17. Image Pyramids:
    1. Explain the concept of image pyramids and their applications, such as image blending.
  18. Video Stabilization:
    1. Provide a tutorial on stabilizing shaky videos using OpenCV.

Other Resources

If you would like to convert an image from one format to another, you may use the following online converter.

  1. Online Image Converter

Summary

In this tutorial of Python Examples, we learned how to work with Images and Videos, using Python OpenCV library.


Python Libraries