In my previous article, I shared how to use PyQt and Dynamsoft Barcode Reader to create a simple Windows-styled GUI app to read barcodes from image files. Now I am going to add a little bit more code to scan barcodes from the webcam video stream.
For the past week, I was looking for a live streaming solution to broadcast video from a USB webcam that connects to Raspberry Pi. This post will help you set up a live streaming server on Raspberry Pi step by step.
Previously, I wrote an article Raspberry Pi Barcode Scanner with Webcam and Python illustrating how to build a simple barcode scanner using Dynamsoft Barcode Reader SDK and OpenCV from scratch. The method decodeFile() was used for detecting barcodes from an image file. To use the API, you have to write image buffer that obtained by OpenCV API to a file beforehand. Because the I/O operation takes too much time, this API is not suitable for real-time barcode detection from webcam video stream. Considering this scenario, I have added a new Python API decodeBuffer(). In this article, I will illustrate how to create and use the new API.
C# is the preferred programming language for developing Windows applications. However, Microsoft only provides .NET camera APIs for UWP applications. If you plan to write a classic Windows desktop application using a webcam, it will be complicated to create a C/C++ wrapper for DirectShow Win32 APIs. Dynamic .NET TWAIN is an SDK that supports programming for both scanner and webcam. In this article, you will see how easy to build a webcam application with the SDK. In addition, you can learn how to detect and recognize barcodes from the video stream with Dynamsoft Barcode Reader SDK.
OpenCV officially provides both C++ and Python APIs for developers. Most of the time, developers just need to use one kind of programming languages to read, write and process images with hundreds of computer vision algorithms. However, if you want to use OpenCV Python APIs with an extended C/C++ library, it will be tricky to pass the data. In this article, I will share how to read camera stream with OpenCV-Python and detect barcode with Dynamsoft C/C++ Barcode SDK.
Previously I shared how to use Touchless, which wraps the win32 APIs of DirectShow, to control webcam in C#. In this article, let’s take a further step to see how to use the more complicated DirectShow.NET APIs to capture the video stream and read barcode from preview frames on Windows.
When building a .NET application to read barcodes on Windows via camera, you need two types of SDKs – one for webcam, and the other for barcodes. In this post, I want to share how to use .Net webcam and barcode SDKs to create a simple WinForm barcode reader application in C#.
If you have a USB camera, how can you build a simple C# camera application on Windows 10? There are three options: WIA (Windows Imaging Acquisition), DirectShow and MediaCapture. After trying some sample code that downloaded from CodeProject and GitHub, I got the conclusion: 1. WIA is not good because it does not support my webcam. 2. DirectShow can work well, but there is no C# API provided by Microsoft. You need to create a wrapper for C++ API. 3. MediaCapture class that designed for UWP apps provides C# APIs which provide low-level control over the capture pipeline and enable advanced capture scenarios. In this article, I want to share how to create a simple C# webcam app in which I can handle every preview frame myself.
Although we have successfully ported Dynamsoft Barcode Reader SDK to Raspberry Pi, the performance is not as good as I expected. In my previous article, I demonstrated how to integrate the SDK into a barcode scanner application, in which the detection code works with webcam frame in the same thread. Apparently, it will block UI if the algorithm costs too much time. In this post, I will do three things: optimize the code with thread, beautify the code with clang-format, and make the webcam barcode scanner auto-launched after the system booted.