A starter guide to computer vision using MediaPipe and OpenCV.
Overview
In this article, let’s explore computer vision and the latest development in this area. I am going to show you code snippets using MediaPipe by Google to demonstrate various ML solutions and explore what is possible with the library.
Codebase
Let’s establish the codebase to use for all scenarios. The following code snippet is used to either capture video from your device camera or a video file.
- Using OpenCV, I can capture video either from a device camera or a video file.
# cap = cv2.VideoCapture(0) # Capture from camera. Adjust the number
cap = cv2.VideoCapture(capture) # Capture from video file,e.g. mp4