Organize and Share your Electronics the way you want. Sign-Up for a free account now. It takes only 30 seconds!

OpenCV USB camera widget in PyQT

OpenCV USB camera widget in PyQT

3Both tools OpenCV and PyQT are incredibly useful. One in combination with Qt Designer gives rapid GUI building possibility. Another is used for visual image/video analysis. There was one drawback – very little documentation how to use them into one piece of code. All in the past now!

To be short – sample program I finally wrote starts Qt Designer generated user interface. After you press Start button separate thread (for initializing camera and capturing frames) starts. All new frames are being placed in queue. On the other hand interface checks if there are any frames in the queue and gets them for display. So GUI feels alive and is not occupied with real-time task.

To complement this simple example I added findCirclesGrid for greater visual representation. Provided code lacks this feature, but it is more than easy to implement it by yourself.

PyQT

PyQt is a set of Python bindings for the Qt application framework and runs on all platforms supported by Qt including Windows, OS X, Linux, iOS and Android.

To install download binary package from here.

OpenCV

OpenCV (Open Source Computer Vision Library) is an open source computer vision and machine learning software library. OpenCV was built to provide a common infrastructure for computer vision applications and to accelerate the use of machine perception in the commercial products.

To install read this official tutorial or install wheel from Unofficial Windows Binaries for Python Extension Packages.

Py Qtdesigner

This is rapid GUI development tool. Can be started in a minute by installing it and running with Python (I don’t have Python in my environment location so have to use full path):

c:Python27Scriptspip.exe pip install pyqode.designer
c:Python27Scriptspyqode-designer.exe
2

Qt Designer main view

Example

Once we are done installing required packages our test can be run. Here is quick example what can be expected (as I mentioned before feature extraction is added to make this video clip more appealing, provided code displays raw USB camera feed).

out

Displaying USB camera calibration window in PyQT

Script

Read more Here

 

More Articles to Read

App note: Testing inductors at application frequencies
App note: Testing inductors at application frequencies
1968 Princeton Reverb Repairs
1968 Princeton Reverb Repairs
Skill Sunday: Power Over Ethernet for Arduino
Skill Sunday: Power Over Ethernet for Arduino
More on Color TFT Displays ~ The Big Ones — 240 X 320
More on Color TFT Displays ~ The Big Ones — 240 X 320
Magnetic Rotary Encoder
Magnetic Rotary Encoder
Vertical Pole Climbing Robot
Vertical Pole Climbing Robot
ESP8266 Weather Station Projects
ESP8266 Weather Station Projects
Single tube Lethal Nixie clock
Single tube Lethal Nixie clock
How to make a simple 1 watt audio amplifier (LM386 based)
How to make a simple 1 watt audio amplifier (LM386 based)
Flashing Binaries to DRA7xx Factory Boards Using Device Firmware Upgrade
Flashing Binaries to DRA7xx Factory Boards Using Device Firmware Upgrade

Top




Shares