Skip to content

Commit 21b538c

Browse files
committed
Added language support
1 parent eb5d62e commit 21b538c

12 files changed

+198
-97
lines changed

SmashDataCollector.py

Lines changed: 91 additions & 55 deletions
Large diffs are not rendered by default.

customizable.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
data_path = r'C:\Users\franc\Documents\VSCode\SmashDataCollector\data'
22
res_path = r'C:\Users\franc\Documents\VSCode\SmashDataCollector\res'
3-
output_path = r'C:\Users\franc\Documents\VSCode\SmashDataCollector'
3+
output_path = r'C:\Users\franc\Documents\VSCode\SmashDataCollector\output.tsv'
4+
5+
# Set the language variable to 0, 1 or 2 according to the following:
6+
# 0 for Japanese or Korean
7+
# 1 for English, Italian, Dutch or Russian
8+
# 2 for French, Spanish or German
9+
# 3 for Chinese (traditional or simplified)
10+
LANGUAGE = 1
411

512
LIVES = 3
613
TAKEN_GIVEN_DMG_THRESHOLD = 30

data/2020121110511900_c.jpg

206 KB
Loading

data/2020121110513400_c.jpg

217 KB
Loading

data/2020121110552100_c.jpg

292 KB
Loading

data/2020121110554800_c.jpg

315 KB
Loading

functions.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ def getClosestCharacterByCloseup(image, character_closeups, mask, background_bgr
8080
distances.append(numpy.min(character_distances))
8181
return numpy.argmin(distances)
8282

83-
8483
def getClosestPlayerByIcon(image, icons, background_bgr):
8584
empty_icon = numpy.full_like(image, background_bgr[0])
8685
empty_icon[:,:,1] = numpy.full((image.shape[0], image.shape[1]), background_bgr[1])
@@ -96,7 +95,7 @@ def getClosestPlayerByIcon(image, icons, background_bgr):
9695

9796
def getClosestDigit(image, digit_images):
9897
distances = []
99-
for i in range(11):
98+
for i in range(len(digit_images)):
10099
distances.append(numpy.sum(cv2.absdiff(digit_images[i], image)))
101100
digit = numpy.argmin(distances)
102101
return digit-1
@@ -190,15 +189,19 @@ def isValidFirstData(positions, times):
190189

191190

192191
def time2int(arg):
193-
return 60 * int(arg[0]) + int(arg[2:4])
192+
if(len(arg) == 4):
193+
return 60 * int(arg[0]) + int(arg[2:4])
194+
else:
195+
return 60 * int(arg[0:2]) + int(arg[3:5])
194196
def time2string(arg):
195197
if(arg == ""):
196198
return ""
197199
else:
198200
return str(time2int(arg))
199201

200202

201-
def convertMatchToString(file_name, players, characters, positions, times, falls, given_damages, taken_damages):
203+
def convertMatchToString(file_name, characters, positions, times, falls, given_damages, taken_damages):
204+
players = len(characters)
202205
match_string = file_name[6:8] + "/" + file_name[4:6] + "/" + file_name[0:4] + "\t"
203206
match_string += str(players) + "\t"
204207
for i in range(players):

output.tsv

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
2+
13
11/12/2020 3 Donkey Kong 2 3,2,2 69 69 83 Meta Knight 1 1,3 76 72 Young Link 3 1,2,2 57 63 77

res/digits/big_digits.png

181 Bytes
Loading

res/temp/template.png

198 Bytes
Loading

0 commit comments

Comments
 (0)