diff --git a/.idea/workspace.xml b/.idea/workspace.xml index de975bd..a6a7328 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,7 +2,8 @@ - + + - + - - + + @@ -35,11 +36,11 @@ - + - - + + @@ -115,11 +116,11 @@ @@ -186,7 +187,7 @@ - + @@ -257,16 +258,6 @@ - - - - - - - - - - @@ -283,13 +274,23 @@ - - + + + + + + + + + + + + \ No newline at end of file diff --git a/camera.py b/camera.py index 2603b4e..38c8d1c 100644 --- a/camera.py +++ b/camera.py @@ -9,6 +9,7 @@ def capture(camera_stream = "/dev/video4"): cam.start() img = cam.get_image() pygame.image.save(img, './capture.jpg') + cam.stop() return './capture.jpg' diff --git a/index.py b/index.py index f93a7e5..d7ca344 100644 --- a/index.py +++ b/index.py @@ -34,7 +34,7 @@ def poll(): for stall in doc_ref_stalls: stall_obj = stall.to_dict() - color_reference = image_tools.average_color(stall_obj['locationX'], stall_obj['locationY'], stall_obj['width'], stall_obj['height'], reference) + color_reference = image_tools.average_color(75, 400, 50, 50, reference) color_compare = image_tools.average_color(stall_obj['locationX'], stall_obj['locationY'], stall_obj['width'], stall_obj['height'], img) stall_occupied = image_tools.threshold(image_tools.differences(color_reference, color_compare), float(os.getenv('E_HAT_TRIGGER_LEVEL'))) stall_obj['open'] = not stall_occupied