This commit is contained in:
glmdev 2019-02-09 18:31:26 -06:00
parent fb785dab53
commit 6f7b2c9ec6
3 changed files with 24 additions and 22 deletions

View File

@ -2,7 +2,8 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="f410c5c2-3ffe-4260-93eb-e3d83256d263" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/example.env" beforeDir="false" afterPath="$PROJECT_DIR$/example.env" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/camera.py" beforeDir="false" afterPath="$PROJECT_DIR$/camera.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/index.py" beforeDir="false" afterPath="$PROJECT_DIR$/index.py" afterDir="false" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
@ -13,11 +14,11 @@
</component>
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file pinned="false" current-in-tab="true">
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/index.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="375">
<caret line="25" column="56" selection-start-line="25" selection-start-column="56" selection-end-line="25" selection-end-column="56" />
<state relative-caret-position="540">
<caret line="36" column="67" selection-start-line="36" selection-start-column="67" selection-end-line="36" selection-end-column="67" />
<folding>
<element signature="e#0#21#0" expanded="true" />
</folding>
@ -35,11 +36,11 @@
<provider selected="true" editor-type-id="images" />
</entry>
</file>
<file pinned="false" current-in-tab="false">
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/camera.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="105">
<caret line="7" column="44" selection-start-line="7" selection-start-column="44" selection-end-line="7" selection-end-column="44" />
<state relative-caret-position="165">
<caret line="11" column="14" selection-start-line="11" selection-start-column="14" selection-end-line="11" selection-end-column="14" />
<folding>
<element signature="e#0#13#0" expanded="true" />
</folding>
@ -115,11 +116,11 @@
<option value="$PROJECT_DIR$/image_diff_color.py" />
<option value="$PROJECT_DIR$/.gitignore" />
<option value="$PROJECT_DIR$/config.py" />
<option value="$PROJECT_DIR$/camera.py" />
<option value="$PROJECT_DIR$/image_tools.py" />
<option value="$PROJECT_DIR$/example.env" />
<option value="$PROJECT_DIR$/.env" />
<option value="$PROJECT_DIR$/index.py" />
<option value="$PROJECT_DIR$/camera.py" />
</list>
</option>
</component>
@ -186,7 +187,7 @@
<frame x="0" y="27" width="1920" height="1053" extended-state="6" />
<editor active="true" />
<layout>
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.18133895" />
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.18133895" />
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
<window_info id="Favorites" order="2" side_tool="true" />
<window_info anchor="bottom" id="Message" order="0" />
@ -257,16 +258,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/camera.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="105">
<caret line="7" column="44" selection-start-line="7" selection-start-column="44" selection-end-line="7" selection-end-column="44" />
<folding>
<element signature="e#0#13#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example.env">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="75">
@ -283,13 +274,23 @@
</entry>
<entry file="file://$PROJECT_DIR$/index.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="375">
<caret line="25" column="56" selection-start-line="25" selection-start-column="56" selection-end-line="25" selection-end-column="56" />
<state relative-caret-position="540">
<caret line="36" column="67" selection-start-line="36" selection-start-column="67" selection-end-line="36" selection-end-column="67" />
<folding>
<element signature="e#0#21#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/camera.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="165">
<caret line="11" column="14" selection-start-line="11" selection-start-column="14" selection-end-line="11" selection-end-column="14" />
<folding>
<element signature="e#0#13#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</component>
</project>

View File

@ -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'

View File

@ -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