PyQt5 widget for OpenCV camera preview with multiple instantiation and real time image filtering.
Project description
qtcam
PyQt5 widget for OpenCV camera preview with multiple instantiation and real time image filtering.
This module contains the next classes:
CameraDevice: Manages image capture and emits a signal when a new frame is available.CameraWidget: Implements a Qt widget for camera image preview.Filters: Implements some basic image filters.
Installation
pip install qtcam
Usage
Simple preview widget
from PyQt5.QtWidgets import QApplication
from qtcam import CameraDevice, CameraWidget
app = QApplication([])
widget = CameraWidget(CameraDevice())
widget.show()
app.exec_()
Multiple widget instances with image filtering
from PyQt5.QtWidgets import QApplication
from qtcam import CameraDevice, CameraWidget, Filter
app = QApplication([])
device = CameraDevice()
widget_1 = CameraWidget(device)
widget_1.show()
widget_2 = CameraWidget(device)
widget_2.add_filter(Filter.gray)
widget_2.show()
app.exec_()
Custom filtering
import cv2
from PyQt5.QtWidgets import QApplication
from qtcam import CameraDevice, CameraWidget
def custom_filter(frame):
return cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
app = QApplication([])
widget = CameraWidget(CameraDevice())
widget.add_filter(custom_filter)
widget.show()
app.exec_()
Selecting another camera
Another camera can be selected by passing its index to CameraDevice (the default index is 0).
from qtcam import CameraDevice
device = CameraDevice(1)
Examples
- multiple_widgets.py: Multiple widget instances using some built-in filters.
- filter_tester.py: PyQt application using the widget to test all built-in filters.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file qtcam-1.0.0.tar.gz.
File metadata
- Download URL: qtcam-1.0.0.tar.gz
- Upload date:
- Size: 15.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.0.1 CPython/3.13.1 Linux/6.8.0-1020-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
08e15e7d694f21b597d3a5ac69d04e5c8f3f9718add87fef7d4f607ba488efe1
|
|
| MD5 |
576344b2ea6184d2ffa2938133e51f8e
|
|
| BLAKE2b-256 |
cf380622dac74ffac5bfdb4085d53c2e58a6087e6f9093f1b8126f6e9c3fdb89
|
File details
Details for the file qtcam-1.0.0-py3-none-any.whl.
File metadata
- Download URL: qtcam-1.0.0-py3-none-any.whl
- Upload date:
- Size: 16.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.0.1 CPython/3.13.1 Linux/6.8.0-1020-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b0273e50963492a254d44ba037c0a099f7a0ee2000c1947cf4278a8690fab1ec
|
|
| MD5 |
909def9b3d9af42a146b2882954eb7c5
|
|
| BLAKE2b-256 |
6348969a550398d5c278d97a0a481bbc97e6e23fede06ed94bd23ce74bf82c14
|