Posts

Showing posts with the label code.PyQt5

Python 3/PyQt5 + picamera2 on Raspberry Pi, list available cameras.

Image
In previous exercises of Python/PyQt5 GUI to control Raspberry Pi Camera using picamera2 lib , with camera_controls and White Balance , camera is assigned manually in Python code or command line argument. In this exercise (picam2_qt5_global.py), number of cameras attached and cameras info are retrieved by calling Picamera2.global_camera_info(), then run picam2_qt5_.py base on user selection. Code: picam2_qt5_global.py """ Python 3/PyQt5 + picamera2 List available cameras. Run picam2_qt5_.py base on user selection. """ from PyQt5.QtWidgets import (QComboBox, QMainWindow, QApplication, QWidget, QVBoxLayout, QLabel, QLineEdit, QPushButton) from PyQt5.QtCore import QProcess import sys from picamera2 import Picamera2 cameras_info = Picamera2.global_camera_info() num_of_cam = len(cameras_info) if num_of_cam == 0: print("No camera attached! Exit") exit(1) print("number of cameras: ...

Python/PyQt5/Picamera2 to control Raspberry Pi Cameras with GUI, added White Balance setting.

Image
Further works on my previous post Python/PyQt5/Picamera2 to control Raspberry Pi Cameras with GUI, with camera_controls , added White Balance setting. Actually, I'm not sure the setting and operation of Awb and ColourGains. refer:  ~ The Picamera2 Library document, Appendix C: Camera controls. Code: picam2_qt5_2024-01-20.py """ Python 3/PyQt5 + picamera2 to control Raspberry Pi Camera Modules Tested on Raspberry Pi 5/64-bit Raspberry Pi OS (bookworm) # in my setup: # Picamera2(0) - HQ Camera # Picamera2(1) - Camera Module 3 picam2_qt5_2023-12-28.py first exercise picam2_qt5_2024-01-03.py Added Auto-Focus feature detection, and switch AF Mode between Continuous & Manual picam2_qt5_2024-01-07.py Display Preview in seperated window, both Main/Preview windows have Capture button. picam2_qt5_2024-01-13.py Add camera_controls to adjust brightness at runtime. Handle sys.argv, such that user can select cam at c...

Python/PyQt5/Picamera2 to control Raspberry Pi Cameras with GUI, with camera_controls.

Image
Follow my previous exercise  Python/PyQt5 GUI to control Raspberry Pi Camera using picamera2 lib , added function to change camera_controls for brightness at runtime. This video also show two instances run to control two cameras at the same time. Because my Camera Module 3 (with Auto-Focus) is assigned to Picamera2(1), so I make 1 as default. If you have one camera only, or you want 0 as default, set: DEFAULT_CAM_NUM = 0 picam2_qt5_2024-01-13.py """ Python 3/PyQt5 + picamera2 to control Raspberry Pi Camera Modules Tested on Raspberry Pi 5/64-bit Raspberry Pi OS (bookworm) # in my setup: # Picamera2(0) - HQ Camera # Picamera2(1) - Camera Module 3 picam2_qt5_2023-12-28.py first exercise picam2_qt5_2024-01-03.py Added Auto-Focus feature detection, and switch AF Mode between Continuous & Manual picam2_qt5_2024-01-07.py Display Preview in seperated window, both Main/Preview windows have Capture button. picam2_qt5_2024-01-13.py Add camera_controls to adjust brig...

Python/PyQt5 GUI to control Raspberry Pi Camera using picamera2 lib

Image
Previous post show a simple example of  Using the Raspberry Pi Camera in Python3/PyQt5 applications using picamera2 lib , here is another exercise with more. The video show the Python/PyQt5 run on Raspberry Pi 5 with dual camera, Camera Module 3 & HQ Camera with 6mm 3MP lens . The Raspberry Pi 5 is running 64-bit Raspberry Pi OS (bookworm). Note that if picam2 = Picamera(0) to use HQ Camera, the code will report RuntimeError: Control AfMode is not advertised by libcamera . Because HQ Camera have no Auto-Focus function. picam2_qt5_2023-12-28.py """ Python 3/PyQt5 + picamera2 to control Raspberry Pi Camera Modules Tested on Raspberry Pi 5/64-bit Raspberry Pi OS (bookworm) # in my setup: # Picamera2(0) - HQ Camera # Picamera2(1) - Camera Module 3 """ import sys, platform, os from PyQt5.QtWidgets import QMainWindow, QApplication, QPushButton, QLabel, QWidget, QTabWidget, QVBoxLayout, QGridLayout from PyQt5.QtGui import QIcon fr...