Skip to content

Commit

Permalink
refactoring(camera): replaced picamera by picamera2 for usage with bo…
Browse files Browse the repository at this point in the history
…okworm
  • Loading branch information
Mario Lukas committed May 30, 2024
1 parent 6f8c833 commit 410f2a8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/fabscan/config/dev.config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"folders": {
"www": "/home/pi/fabscan/src/www/",
"www": "/home/pi/src/www/",
"scans": "/home/pi/scans/"
},
"laser": {
Expand Down
25 changes: 6 additions & 19 deletions src/fabscan/scanner/laserscanner/driver/FSCameraPi.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,16 @@

class PiVideoStream:
def __init__(self, config, settings, framerate, **kwargs):
self._logger = logging.getLogger(__name__)
# initialize the camera
self.camera = Picamera2()
self.camera.start()
try:
self.camera = Picamera2()
self.camera.start()
except Exception as e:
self._logger.exception(e)

self.settings = settings
# set camera parameters
#self.camera.resolution = (config.file.camera.resolution.width, config.file.camera.resolution.height)
#self.preview_resolution = (config.file.camera.preview_resolution.width, config.file.camera.preview_resolution.height)
#self.camera.framerate = framerate

# set optional camera parameters (refer to PiCamera docs)
#for (arg, value) in kwargs.items():
# setattr(self.camera, arg, value)

# initialize the stream

#self.rawCapture = PiRGBArray(self.camera, size=(self.camera.resolution.width, self.camera.resolution.height))
#self.stream = self.camera.capture_continuous(self.rawCapture, format="bgr", use_video_port=True)

# initialize the frame and the variable used to indicate
# if the thread should be stopped
self.high_res_frame = None
self.low_res_frame = None
self.stopped = False
Expand All @@ -56,8 +45,6 @@ def update(self):
# if the thread indicator variable is set, stop the thread
# and resource camera resources
if self.stopped:
self.stream.close()
self.rawCapture.close()
self.camera.close()
break

Expand Down

0 comments on commit 410f2a8

Please sign in to comment.