diff options
author | Jesusaves <cpntb1@ymail.com> | 2023-09-03 21:32:31 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2023-09-03 21:32:31 -0300 |
commit | 8169c56e3266e9c6698c922e739ecc2ae6ee6a7b (patch) | |
tree | 20454555c782610bc3259373f7f087d8a695d5eb /units.py | |
parent | f0ad703737566f29496e0a7f4b204f28e6abfeda (diff) | |
download | updates-8169c56e3266e9c6698c922e739ecc2ae6ee6a7b.tar.gz updates-8169c56e3266e9c6698c922e739ecc2ae6ee6a7b.tar.bz2 updates-8169c56e3266e9c6698c922e739ecc2ae6ee6a7b.tar.xz updates-8169c56e3266e9c6698c922e739ecc2ae6ee6a7b.zip |
Unsorted changesv2.3.9.3
Diffstat (limited to 'units.py')
-rwxr-xr-x | units.py | 27 |
1 files changed, 24 insertions, 3 deletions
@@ -70,9 +70,30 @@ for it in FILES: break if len(faces) != 1: - print("\033[1mERROR: %s has %d faces, no square possible!\033[0m" % (it, len(faces))) - bf1.append("* ERROR: %s needs a square\n" % it) - continue + print("INFO: %s has %d anime faces, no square possible!" % (it, len(faces))) + print("Retrying with human face...") + cPath="lbpcascade_face.xml" + iPath="ready-units/%s" % it + cascade=cv2.CascadeClassifier(cPath) + org_img=cv2.imread(iPath) + img=cv2.cvtColor(org_img, cv2.COLOR_BGR2GRAY) + maxi = 3.2 + step = 0.1 + curr = 1.0 + faces = [] + # Detect faces + while len(faces) != 1: + if curr == 1.0: + faces = cascade.detectMultiScale(img, scaleFactor=1.01, minNeighbors=5) + else: + faces = cascade.detectMultiScale(img, scaleFactor=curr, minNeighbors=5) + curr+=step + if curr > maxi: + break + if len(faces) != 1: + print("\033[1mERROR: %s has %d faces, no square possible!\033[0m" % (it, len(faces))) + bf1.append("* ERROR: %s needs a square\n" % it) + continue face=faces[0] |