mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-26 01:51:40 +00:00
new branch and error
This commit is contained in:
@@ -7,7 +7,8 @@ from app.handlers.CamerasHandler import CamerasHandler
|
||||
from app.handlers.VisionHandler import VisionHandler
|
||||
|
||||
if __name__ == "__main__":
|
||||
mng = SettingsManager()
|
||||
# SettingsManager()
|
||||
CamerasHandler.init_camera()
|
||||
|
||||
VisionHandler().run()
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import cscore
|
||||
import cv2
|
||||
from cscore._cscore import VideoMode
|
||||
|
||||
from ..classes.SettingsManager import SettingsManager
|
||||
|
||||
|
||||
class CamerasHandler:
|
||||
@@ -41,9 +44,12 @@ class CamerasHandler:
|
||||
device_name = "pipeline" + str(suffix)
|
||||
|
||||
camera = cscore.UsbCamera(name=device_name, dev=device.dev)
|
||||
camera.setPixelFormat(pixelFormat=camera.enumerateVideoModes()[0].pixelFormat) #TODO if dictionary is empy do this else take from dictionary
|
||||
camera.setFPS(camera.enumerateVideoModes()[0].fps)
|
||||
camera.setResolution(width=camera.enumerateVideoModes()[0].width,height=camera.enumerateVideoModes()[0].height)
|
||||
camera.setPixelFormat(pixelFormat=
|
||||
getattr(VideoMode.PixelFormat, SettingsManager()
|
||||
.get_curr_cam()["video_mode"]["pixel_format"]))
|
||||
camera.setFPS(SettingsManager().get_curr_cam()["video_mode"]["fps"])
|
||||
camera.setResolution(width=SettingsManager().get_curr_cam()["video_mode"]["width"],
|
||||
height=SettingsManager().get_curr_cam()["video_mode"]["height"])
|
||||
|
||||
cameras[device_name] = camera
|
||||
|
||||
@@ -51,6 +57,10 @@ class CamerasHandler:
|
||||
|
||||
return getattr(CamerasHandler, "cams")
|
||||
|
||||
@staticmethod
|
||||
def init_camera():
|
||||
return CamerasHandler.get_or_start_cameras(CamerasHandler.get_cameras_info())
|
||||
|
||||
@staticmethod
|
||||
def get_usb_camera_by_name(cam_name):
|
||||
return CamerasHandler.get_or_start_cameras(CamerasHandler.get_cameras_info())[cam_name]
|
||||
|
||||
Reference in New Issue
Block a user