working predictive model
This commit is contained in:
parent
284bd3315a
commit
8ff4856e4e
@ -1,7 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="f410c5c2-3ffe-4260-93eb-e3d83256d263" name="Default Changelist" comment="" />
|
||||
<list default="true" id="f410c5c2-3ffe-4260-93eb-e3d83256d263" name="Default Changelist" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/image_diff_color.py" beforeDir="false" afterPath="$PROJECT_DIR$/image_diff_color.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
@ -12,8 +14,8 @@
|
||||
<file pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/image_diff_color.py">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="240">
|
||||
<caret line="16" column="33" selection-start-line="16" selection-start-column="33" selection-end-line="16" selection-end-column="33" />
|
||||
<state relative-caret-position="281">
|
||||
<caret line="26" column="55" selection-start-line="26" selection-start-column="55" selection-end-line="26" selection-end-column="55" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
@ -53,6 +55,12 @@
|
||||
<item name="python-backend" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="lib" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="python-backend" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="python-backend" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="lib" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="test-images" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
</expand>
|
||||
<select />
|
||||
</subPane>
|
||||
@ -92,13 +100,9 @@
|
||||
<frame x="0" y="27" width="1920" height="1053" extended-state="6" />
|
||||
<editor active="true" />
|
||||
<layout>
|
||||
<window_info id="Favorites" side_tool="true" />
|
||||
<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 anchor="bottom" id="Version Control" />
|
||||
<window_info anchor="bottom" id="Python Console" />
|
||||
<window_info active="true" anchor="bottom" id="Terminal" visible="true" weight="0.32972974" />
|
||||
<window_info anchor="bottom" id="Event Log" side_tool="true" />
|
||||
<window_info id="Favorites" order="2" side_tool="true" />
|
||||
<window_info anchor="bottom" id="Message" order="0" />
|
||||
<window_info anchor="bottom" id="Find" order="1" />
|
||||
<window_info anchor="bottom" id="Run" order="2" />
|
||||
@ -106,6 +110,10 @@
|
||||
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
|
||||
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
|
||||
<window_info anchor="bottom" id="TODO" order="6" />
|
||||
<window_info anchor="bottom" id="Version Control" order="7" />
|
||||
<window_info active="true" anchor="bottom" id="Terminal" order="8" visible="true" weight="0.32972974" />
|
||||
<window_info anchor="bottom" id="Python Console" order="9" />
|
||||
<window_info anchor="bottom" id="Event Log" order="10" side_tool="true" />
|
||||
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
|
||||
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
|
||||
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
|
||||
@ -115,33 +123,18 @@
|
||||
<entry file="file://$PROJECT_DIR$/lib/test-images/lot-1-car.jpg">
|
||||
<provider selected="true" editor-type-id="images" />
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/image_diff_simple.py">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="300">
|
||||
<caret line="20" lean-forward="true" selection-start-line="20" selection-end-line="24" selection-end-column="80" />
|
||||
<folding>
|
||||
<element signature="e#0#15#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/image_diff_ssim.py">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="211">
|
||||
<caret line="15" column="62" selection-start-line="15" selection-start-column="62" selection-end-line="15" selection-end-column="62" />
|
||||
<folding>
|
||||
<element signature="e#0#15#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/image_diff_simple.py" />
|
||||
<entry file="file://$PROJECT_DIR$/image_diff_ssim.py" />
|
||||
<entry file="file://$PROJECT_DIR$/lib/test-images/lot-empty.jpg">
|
||||
<provider selected="true" editor-type-id="images" />
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/lib/test-images/lot-3-cars.jpg">
|
||||
<provider selected="true" editor-type-id="images" />
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/image_diff_color.py">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="240">
|
||||
<caret line="16" column="33" selection-start-line="16" selection-start-column="33" selection-end-line="16" selection-end-column="33" />
|
||||
<state relative-caret-position="281">
|
||||
<caret line="26" column="55" selection-start-line="26" selection-start-column="55" selection-end-line="26" selection-end-column="55" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
|
@ -1,6 +1,5 @@
|
||||
from PIL import Image
|
||||
|
||||
|
||||
def average_color(x, y, n, image):
|
||||
r, g, b = 0, 0, 0
|
||||
count = 0
|
||||
@ -13,6 +12,73 @@ def average_color(x, y, n, image):
|
||||
count += 1
|
||||
return ((r / count), (g / count), (b / count))
|
||||
|
||||
img = Image.open('./lib/test-images/lot-1-car.jpg').load()
|
||||
r, g, b = average_color(0, 0, 479, img)
|
||||
print(r, g, b)
|
||||
def differences(rgb_tuple1, rgb_tuple2):
|
||||
r1, g1, b1 = rgb_tuple1
|
||||
r2, g2, b2 = rgb_tuple2
|
||||
|
||||
return ((r1-r2), (g1-g2), (b1-b2))
|
||||
|
||||
def threshold(diff_tuple, trigger=4):
|
||||
dr, dg, db = diff_tuple
|
||||
return (((( dr**4 + dg**4 + db**4 ) / 3)**0.25) > trigger) # Thanks to Thomas Atkins, math whiz
|
||||
|
||||
|
||||
reference_image = Image.open('./lib/test-images/lot-empty.jpg').load()
|
||||
compare_image = Image.open('./lib/test-images/lot-1-car.jpg').load()
|
||||
|
||||
stall_1 = {
|
||||
'location': (54, 79, 109),
|
||||
'reference': average_color(54, 79, 109, reference_image),
|
||||
'compare': average_color(54, 79, 109, compare_image)
|
||||
}
|
||||
|
||||
stall_2 = {
|
||||
'location': (186, 81, 116),
|
||||
'reference': average_color(186, 81, 116, reference_image),
|
||||
'compare': average_color(186, 81, 116, compare_image)
|
||||
}
|
||||
|
||||
stall_3 = {
|
||||
'location': (317, 71, 127),
|
||||
'reference': average_color(317, 71, 127, reference_image),
|
||||
'compare': average_color(317, 71, 127, compare_image)
|
||||
}
|
||||
|
||||
stall_4 = {
|
||||
'location': (469, 76, 100),
|
||||
'reference': average_color(469, 76, 100, reference_image),
|
||||
'compare': average_color(469, 76, 100, compare_image)
|
||||
}
|
||||
|
||||
stall_5 = {
|
||||
'location': (27, 237, 119),
|
||||
'reference': average_color(27, 237, 119, reference_image),
|
||||
'compare': average_color(27, 237, 119, compare_image)
|
||||
}
|
||||
|
||||
stall_6 = {
|
||||
'location': (172, 240, 130),
|
||||
'reference': average_color(172, 240, 130, reference_image),
|
||||
'compare': average_color(172, 240, 130, compare_image)
|
||||
}
|
||||
|
||||
stall_7 = {
|
||||
'location': (317, 234, 144),
|
||||
'reference': average_color(317, 234, 144, reference_image),
|
||||
'compare': average_color(317, 234, 144, compare_image)
|
||||
}
|
||||
|
||||
stall_8 = {
|
||||
'location': (481, 233, 112),
|
||||
'reference': average_color(481, 233, 112, reference_image),
|
||||
'compare': average_color(481, 233, 112, compare_image)
|
||||
}
|
||||
|
||||
print(threshold(differences(stall_1['reference'], stall_1['compare'])))
|
||||
print(threshold(differences(stall_2['reference'], stall_2['compare'])))
|
||||
print(threshold(differences(stall_3['reference'], stall_3['compare'])))
|
||||
print(threshold(differences(stall_4['reference'], stall_4['compare'])))
|
||||
print(threshold(differences(stall_5['reference'], stall_5['compare'])))
|
||||
print(threshold(differences(stall_6['reference'], stall_6['compare'])))
|
||||
print(threshold(differences(stall_7['reference'], stall_7['compare'])))
|
||||
print(threshold(differences(stall_8['reference'], stall_8['compare'])))
|
||||
|
Loading…
Reference in New Issue
Block a user