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

Pinned onto

Related Pins

Restoring a vintage Xerox Alto day 8: it boots!
Restoring a vintage Xerox Alto day 8: it boots!
Sonicare toothbrush teardown: microcontroller, H bridge, and inductive charging
Sonicare toothbrush teardown: microcontroller, H bridge, and inductive charging
Reverse engineering a server CPU voltage regulator module
Reverse engineering a server CPU voltage regulator module
Building a sweet plastic MIDI controller
Building a sweet plastic MIDI controller
Arduino Stopwatch
Arduino Stopwatch
App note: General overview of IR transmission in free ambient
App note: General overview of IR transmission in free ambient
Sonicare toothbrush teardown: microcontroller, H bridge, and inductive charging
Sonicare toothbrush teardown: microcontroller, H bridge, and inductive charging
App note: Using Vishay infrared receivers in a Wi-Fi environment
App note: Using Vishay infrared receivers in a Wi-Fi environment
Skill Sunday: Uploading to your Arduino via a Network
Skill Sunday: Uploading to your Arduino via a Network
One Phase Power Meter
One Phase Power Meter
WiFi Toilet Vacancy Sensor
WiFi Toilet Vacancy Sensor
HAL 9000 reimagined as a useless machine
HAL 9000 reimagined as a useless machine
Using the XMEGA Clock System
Using the XMEGA Clock System
An Arduino VU meter for classrooms
An Arduino VU meter for classrooms
DIY Calculator
DIY Calculator
Build your own robotic vacuum from scratch
Build your own robotic vacuum from scratch
An animatronic talking takeout container
An animatronic talking takeout container
Restoring a Xerox Alto day 7: experiments with disk and Ethernet emulators
Restoring a Xerox Alto day 7: experiments with disk and Ethernet emulators
IDE 1.6.12 released with Sierra support and more
IDE 1.6.12 released with Sierra support and more
IoT Propane Tank
IoT Propane Tank

Top


Shares