Commit 884c0e35 authored by YvanM's avatar YvanM

Fix "--sortbycsv" option which was sorting by surname instead of name.

parent 4716f87f
......@@ -166,7 +166,9 @@ if args.crop:
"detected. The first one will be used, others are available "
"in \"cropped\" directory")
for face_number,face in enumerate(faces):
# from my tests, when multiple faces are detected, the last one is
# usually the good one, so we reverse the list
for face_number,face in enumerate(reversed(faces)):
# makes the square around face a bit bigger to ease recognition
coordinates = enlargeFace(img.auto_orient().get_size(), face)
......@@ -212,6 +214,7 @@ if args.names:
if len(line) == 3 and line[2] == "NOPIC":
missingPics.append(lineNumber)
# eventually insert avatar in place of missing pictures
for index in missingPics:
picsList.insert(index, defaultPic)
......@@ -248,9 +251,7 @@ with tempfile.TemporaryDirectory() as tempDir:
cmd.append(picsList[i])
else:
# or sorted using surnames in CSV
print("namesList: " + str(namesList))
order = sorted(range(len(namesList)), key=lambda k: namesList[k])
print("order: " + str(order))
order = sorted(range(len(namesList)), key=lambda k: namesList[k].split("\n",1)[1])
for i in order:
cmd.append("-label")
cmd.append(namesList[i])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment