Add private dataset and adjust purple range

This commit is contained in:
Pavle Portic 2018-03-15 21:25:14 +01:00
parent c3fe9e5995
commit 214c439d84
52 changed files with 38 additions and 14 deletions

1
3/private/inputs/B1.txt Normal file
View File

@ -0,0 +1 @@
@@DATASET_DIR@@\B1.png

1
3/private/inputs/B10.txt Normal file
View File

@ -0,0 +1 @@
@@DATASET_DIR@@\B10.png

1
3/private/inputs/B2.txt Normal file
View File

@ -0,0 +1 @@
@@DATASET_DIR@@\B2.png

1
3/private/inputs/B3.txt Normal file
View File

@ -0,0 +1 @@
@@DATASET_DIR@@\B3.png

1
3/private/inputs/B4.txt Normal file
View File

@ -0,0 +1 @@
@@DATASET_DIR@@\B4.png

1
3/private/inputs/B5.txt Normal file
View File

@ -0,0 +1 @@
@@DATASET_DIR@@\B5.png

1
3/private/inputs/B6.txt Normal file
View File

@ -0,0 +1 @@
@@DATASET_DIR@@\B6.png

1
3/private/inputs/B7.txt Normal file
View File

@ -0,0 +1 @@
@@DATASET_DIR@@\B7.png

1
3/private/inputs/B8.txt Normal file
View File

@ -0,0 +1 @@
@@DATASET_DIR@@\B8.png

1
3/private/inputs/B9.txt Normal file
View File

@ -0,0 +1 @@
@@DATASET_DIR@@\B9.png

View File

@ -0,0 +1 @@
827G

1
3/private/outputs/B8.txt Normal file
View File

@ -0,0 +1 @@
394G

1
3/private/outputs/B9.txt Normal file
View File

@ -0,0 +1 @@
756G

1
3/public/outputs/A1.txt Normal file
View File

@ -0,0 +1 @@
475G

1
3/public/outputs/A2.txt Normal file
View File

@ -0,0 +1 @@
684G

1
3/public/outputs/A3.txt Normal file
View File

@ -0,0 +1 @@
683G

1
3/public/outputs/A4.txt Normal file
View File

@ -0,0 +1 @@
56GG

1
3/public/outputs/A5.txt Normal file
View File

@ -0,0 +1 @@
151G

1
3/public/outputs/A6.txt Normal file
View File

@ -0,0 +1 @@
473G

1
3/public/outputs/A7.txt Normal file
View File

@ -0,0 +1 @@
564G

Binary file not shown.

View File

@ -16,18 +16,21 @@ import cv2 as cv
import itertools as it
import numpy as np
def main():
# for k in range(10, 11):
# filename = 'set/A' + str(k) + '.png'
filename = raw_input()
src = cv.imread(filename)
wrapper(src)
# filename = raw_input()
# src = cv.imread(filename)
# wrapper(src)
# for i in range(1, 11):
# filename = 'set/A' + str(i) + '.png'
# src = cv.imread(filename)
# wrapper(src)
# print_solution(i)
# i = 9
for i in range(2, 11):
filename = 'private/set/B' + str(i) + '.png'
src = cv.imread(filename)
wrapper(src)
cv.waitKey()
print_solution(i)
def wrapper(src):
@ -57,7 +60,7 @@ def wrapper(src):
def print_solution(i):
with open('outputs/' + str(i) + '.out', 'r') as f:
with open('private/outputs/B' + str(i) + '.txt', 'r') as f:
print f.read()
print
@ -122,7 +125,6 @@ def find_resistor(img):
rect = cv.boxPoints(rect)
# cv.drawContours(src, [np.int0(rect)], 0, (0, 0, 255), 2)
# cv.imshow('src', src)
# cv.waitKey()
return rect
@ -156,6 +158,7 @@ def crop_resistor(img, box):
x += int(0.1 * w)
w = int(0.8 * w)
img = img[y:(y+h), x:(x+w)]
# cv.imshow('img', img)
return img
@ -191,6 +194,7 @@ def find_bands(img):
# while hsv[0, i][0] >= 0 and i < w:
band_colors = []
for i in range(w):
# print i, hsv[0, i]
band_colors.append(check_color(hsv[0, i]))
band_colors = [k for k, g in it.groupby(band_colors) if sum(1 for _ in g) > 2]
@ -298,11 +302,11 @@ colors = {
},
'purple': {
'lowH': 140,
'highH': 164,
'lowS': 100,
'highS': 220,
'highH': 175,
'lowS': 170,
'highS': 255,
'lowV': 10,
'highV': 150,
'highV': 210,
},
'gray': {
'lowH': 0,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 414 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 416 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 414 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 415 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 415 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 988 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB