From 60268dea8608567ecb3f7fe4132b6bc687a32c64 Mon Sep 17 00:00:00 2001
From: Constantin Wenger <constantin.wenger@googlemail.com>
Date: Tue, 13 Aug 2019 20:42:38 +0000
Subject: [PATCH] scaled min size threshold down to 10k again from 100k because it won't work properly with lower res webcams
---
opencv_dnn.py | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/opencv_dnn.py b/opencv_dnn.py
index a2c9d3b..64a9067 100644
--- a/opencv_dnn.py
+++ b/opencv_dnn.py
@@ -49,15 +49,21 @@
for card_name in card_names:
# Fetch the image - name can be found based on the card's information
card_info['name'] = card_name
+ cname = card_name
+ if cname == 'con':
+ cname == 'con__'
img_name = '%s/card_img/png/%s/%s_%s.png' % (Config.data_dir, card_info['set'],
card_info['collector_number'],
- fetch_data.get_valid_filename(card_info['name']))
+ fetch_data.get_valid_filename(cname))
card_img = cv2.imread(img_name)
# If the image doesn't exist, download it from the URL
if card_img is None:
+ set_name = card_info['set']
+ if set_name == 'con':
+ set_name = 'con__'
fetch_data.fetch_card_image(card_info,
- out_dir='%s/card_img/png/%s' % (Config.data_dir, card_info['set']))
+ out_dir='%s/card_img/png/%s' % (Config.data_dir, set_name))
card_img = cv2.imread(img_name)
if card_img is None:
print('WARNING: card %s is not found!' % img_name)
@@ -374,7 +380,7 @@
return img_graph
-def detect_frame(img, card_pool, hash_size=32, size_thresh=100000,
+def detect_frame(img, card_pool, hash_size=32, size_thresh=10000,
out_path=None, display=True, debug=False):
"""
Identify all cards in the input frame, display or save the frame if needed
@@ -624,6 +630,8 @@
# Merge database for all cards, then calculate pHash values of each, store them
df_list = []
for set_name in Config.all_set_list:
+ if set_name == 'con':
+ set_name = 'con__'
csv_name = '%s/csv/%s.csv' % (Config.data_dir, set_name)
df = fetch_data.load_all_cards_text(csv_name)
df_list.append(df)
--
Gitblit v1.10.0