How to Convert OpenCV Image Data from Python to C

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.

Read more

C# Camera API for Getting Video Frame

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.

Read more

Barcode Scanner Optimization for Raspberry Pi

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.

Read more

Webcam Barcode Scanner with HTML5 and Web Browser

As Internet connection speed getting faster, more and more people tend to embrace cloud service. Any desktop applications could be transformed to cloud applications with better maintainability, security, and stability. End-users can use web browsers to get connected with social friends, store tons of personal data, watch live video, edit documents, publish blog posts and even write code. As a programmer, if you are still developing desktop applications, it is time to think about how to turn your apps into web services. In this article, we will take a glimpse of how to make webcam barcode scanner with Dynamic Barcode Reader SDK work and web technologies.

Read more

Real-time Webcam Barcode Detection with OpenCV and C++

Dynamsoft Barcode Reader C++ SDK is available for Windows, Linux, and Mac (iOS and Android editions are coming soon). I have shared an article that illustrates how to build webcam barcode reader in Python. In this tutorial, I’ll use a different C++ API to implement barcode scanner applications for Windows and Raspberry Pi with a webcam.

Read more

Reading Barcode with Webcam in OpenCV and Python

Barcode is an efficient way to make information readable for machines. There are many scenarios of using Barcode reader software. For example, companies use Barcode encoding and decoding software to manage various documents that captured by office scanners. Airport security uses handheld scanners to check the boarding pass and record personal information to the database. Students use the built-in camera of the smartphone to check attendance via Barcode reader software. Since I have a Webcam connected to my desktop PC, I want to empower it to work as a Barcode reader. To implement the solution, I decide to choose OpenCV and Dynamsoft Barcode Reader SDK.

Read more

Webcam in HTML5

In the previous blog post, I have glanced at HTML5. Probably many people have already experienced some cool functions of HTML5. In this article, I would like to share how to invoke Webcam in HTML5.

While strolling through StackOverflow, I found there are many questions about how to display webcam in a web browser. Using HTML5, with a few tricks, can manage to show a Webcam in a web browser conveniently.

Please follow this tutorial step by step, and you can instantly build a webcam application in a web browser.

Create a <video> element and two <button> elements

<video id="video"></video>
<button id="start">start</button>
<button id="stop">stop</button>


var streaming = false,
video = document.querySelector('#video'),
start = document.querySelector('#start'),
stop = document.querySelector('#stop'),
width = 320,
height = 0;

Get video

navigator.getMedia = (navigator.getUserMedia ||
                                   navigator.webkitGetUserMedia ||
                                   navigator.mozGetUserMedia ||
                  video: true,
                  audio: false
              function (stream) {
                  if (navigator.mozGetUserMedia) {
                      video.mozSrcObject = stream;
                  } else {
                      var vendorURL = window.URL || window.webkitURL;
                      video.src = vendorURL.createObjectURL(stream);
              function (err) {
                  console.log("An error occured! " + err);

Resize video

video.addEventListener('canplay', function (ev) {
                if (!streaming) {
                    height = video.videoHeight / (video.videoWidth / width);
                    video.setAttribute('width', width);
                    video.setAttribute('height', height);
                    canvas.setAttribute('width', width);
                    canvas.setAttribute('height', height);
                    streaming = true;
            }, false);

 Start or stop video

start.addEventListener('click', function (ev) {
            }, false);
stop.addEventListener('click', function (ev) {
            }, false);

Pretty easy. For further reading, you can refer to Mozilla’s WebRTC docs.

HTML5 is definitely the trend of web technology. However, it is not so mature yet. Browsers are adopting features from HTML5 and evolving themselves over time. In the current stage, considering the compatibility and the security, using a 3rd-party webcam plugin, like ImageCapture Suite, would be a good option, especially if your image capture project has a tight schedule. Besides image acquisition, the plugin also allows you to do simple image processing, HTTP uploading and downloading. ImageCapture Suite supports all the mainstream web browsers like Chrome, IE, Firefox, and Opera on both Mac and Windows platform.

If you have any questions or comments, please leave a message in the comments section below or email me at