Use a digital camera in OpenCV instead of webcam

wsh
3 min readMay 2, 2019

Introduction

In the previous post, I introduced the way I used to connect a digital camera to an Ubuntu machine and use it to take a photo remotely. The reason I used a digital camera instead of a webcam is because it comes with higher frame rate and resolution. Since digital cameras do not usually work in plug-and-play on Linux machines, we had to install third-party programs and do some tweaks.
For more details, please see the previous post.

In this post, I’m going to show you how to use such a digital camera as an input device in OpenCV. The function cv2.VideoCapture() is used to take a photo or capture video frames usually with a webcam, and it is a plug-and-play. However, if a digital camera is used instead, we can expect much more resolution and higher frame rate.

The system I used:

  • Ubuntu 18.04.2 LTS
  • AMD Threadripper 2950x
  • Canon EOS kiss x4

Installations

All third-party software are the same as the previous post:

sudo apt-get install gphoto2 v4l2loopback-utils

Setups

After the installations have finished, connect your digital camera with a USB cable and turn on it. Check whether the camera was detected with the following command in terminal:

gphoto2 --abilities

--

--

Responses (2)