Skip to content

pchinea/qtcam

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

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_()

Examples

About

PyQt5 widget for OpenCV camera preview.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages