To understand this article, you need basic knowledge of Python and of the Windows application development. You can find the code of the application also on. The code is designed to be easy to change and to expand. The application is based on a class that exposes some of the functionalities of DirectShow and that can be reused in other applications. Here, I want to propose a simple application written entirely in Python that allows you to capture images from a camera using DirectShow, display them on screen and perform simple processing on them using OpenCV. But it’s not a big deal because it has all the features needed and it’s used in so many applications that (in my opinion), Microsoft will keep it available for a long time. It’s based on the COM framework, so it is designed to be used from different programming languages.Ĭonversely, it’s quite an old technology that is being replaced by the Windows Media Foundation and Microsoft is not developing it anymore.It’s a technology well established and widely used.
#IMAGE CAPTURE DEVICES DRIVER#
In Windows to interact with the cameras, DirectShow is often used. Alternatively, you can use PyGame or the SDK provided by the camera manufacturer, if available. For instance, it’s not possible to list all the cameras linked to the PC and there isn’t a quick way to tune the parameters of the camera. OpenCV provides some basic methods to access the camera linked to the PC (through the object VideoCapture), but most of the time, they aren’t enough even for a simply prototype. It’s very easy to process images read from files, not so easy if you want to process images captured from a camera. Using OpenCV in Python is a very good solution to prototype vision applications, it allows you to quickly draft and test algorithms.