Skip to content

Instantly share code, notes, and snippets.

@docPhil99
docPhil99 / opencv_qt_label.md
Last active April 13, 2024 15:48
How to display opencv video in pyqt apps

The code for this tutorial is here

Opencv provides are useful, but limited, method of building a GUI. A much more complete system could be acheived using pyqt. The question is, how do we display images. There are quite a few possible routes but perhaps the easiest is to use QLabel since it has a setPixmap function. Below is some code that creates two labels. It then creates a grey pixmap and displays it one of the labels. code: staticLabel1.py

from PyQt5.QtWidgets import QWidget, QApplication, QLabel, QVBoxLayout
from PyQt5.QtGui import QPixmap, QColor
import sys
@uranusjr
uranusjr / rpi-qt5-cc.md
Last active May 7, 2019 14:35
在 Ubuntu 16.04 為 Raspbian Jessie 交叉編譯 Qt 5.6 桌面版

在 Ubuntu 16.04 為 Raspbian Jessie 交叉編譯 Qt 5.6 桌面版

筆記

Qt 在 Raspberry Pi 上可以跑兩種版本:

  • 桌面版。你平常在 Linux 發行版裡看到的會是這個,包含 Raspbian 在內。通常基於 X11,就是個普通的 GUI 框架。
  • 嵌入版。這個版本不需要鐘面系統,通常是直接走 framebuffer 直接把東西畫到螢幕上,適合一些嵌入式設備的應用。

這個教學會編譯桌面版,因為我對這個版本比較熟。我上次試的時候 OpenGL 在 embedded 版還有些問題,不過 Qt 在那之後有很多更新,狀況應該會好很多。Qt 官方 wiki 也有個相關的教學:

@nioto
nioto / PiCameraStream
Created March 4, 2014 10:14
Simple MJpeg streamer for Raspberri Pi Camera
#!/usr/bin/python
'''
A Simple mjpg stream http server for the Raspberry Pi Camera
inspired by https://gist.github.com/n3wtron/4624820
'''
from BaseHTTPServer import BaseHTTPRequestHandler,HTTPServer
import io
import time
import picamera
@n3wtron
n3wtron / simple_mjpeg_streamer_http_server
Last active December 22, 2023 13:32
Simple Python Motion Jpeg (mjpeg server) from webcam. Using: OpenCV,BaseHTTPServer
#!/usr/bin/python
'''
Author: Igor Maculan - n3wtron@gmail.com
A Simple mjpg stream http server
'''
import cv2
import Image
import threading
from BaseHTTPServer import BaseHTTPRequestHandler,HTTPServer
from SocketServer import ThreadingMixIn