Python OpenCV Reading AVI Video Format

In this Python OpenCV article iam going to talk about Python OpenCV Reading AVI Video Format, so first of all let’s talk that What is OpenCV.

 

What is OpenCV ?

OpenCV (Open Source Computer Vision) is free and open source library for computer vision and image processing. it was originally developed by Intel in 1999 and is now maintained by the OpenCV Foundation, a non profit organization.

OpenCV provides different functions and algorithms for tasks such as image and video processing, feature detection and extraction, object recognition, camera calibration and machine learning. it is written in C++, but also provides Python and Java interfaces for developers who prefer those languages.

OpenCV supports different platforms and operating systems, including Windows, Linux, macOS, Android and iOS, and it is widely used in industry and academia for applications such as robotics, surveillance, medical imaging and augmented reality.

 

You can install OpenCV using pip.

 

 

 

Some of the key features of OpenCV include:

  1. Image processing: OpenCV provides different functions for manipulating images such as filtering, smoothing, thresholding and edge detection.
  2. Feature detection and extraction: OpenCV includes algorithms for detecting and extracting features from images, such as corners, blobs and keypoints.
  3. Object recognition: OpenCV provides tools for training and using machine learning models to recognize objects in images and videos.
  4. Camera calibration: OpenCV includes functions for calibrating cameras, correcting lens distortion, and estimating camera parameters.
  5. Real-time video processing: OpenCV is optimized for real time processing of video streams and provides tools for tracking objects, detecting motion, and analyzing video data.

OpenCV is licensed under Apache 2.0 license, which allows developers to use and distribute it freely even in commercial applications.

 

 

 

Python OpenCV Reading AVI Video Format

Video can be Read either by using the feed from camera connected to a computer  or by reading a Video file. The first step towards reading a video file is to create a VideoCapture object. Its argument can be either the device index or the name of the video file to be read. In most cases, only one camera is connected to the system. So, all we do is pass ‘0’ and OpenCV uses the only camera attached to the computer. When more than one camera is connected to the computer, we can select the second camera by passing ‘1’, the third camera by passing ‘2’ and so on.

 

In this article we are using a globe avi you can download the AVI file from the link .

Download AVI Globe File

 

 

Also you can check Python GUI Development Tutorials in the below link.

 

 

 

 

This is the complete code for Reading AVI File Format

In the above code first we have imported Opencv, after that we are going to create a video capture i have said that if your using camera feed you can give “0”  in the constructor but if your using a AVI file you can give the name of that AVI file. after that we are going to create a while loop an we are checking if Video Capture is opened we are reading the AVI file.

 

 

 

 

Run the complete code, you will have your avi video.

OpenCV Reading AVI
OpenCV Reading AVI

 

 

 

 

Also you can watch the complete video for this article

Subscribe and Get Free Video Courses & Articles in your Email

 

Leave a Comment

Codeloop
Share via
Copy link
Powered by Social Snap
×