Нема описа
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839
  1. # What is the code to do : Extract faces from all image files in 'directory' and save them in 'out_src'.
  2. import os
  3. # - pip install ObjectExtractor ( OR pip3 install ObjectExtractor)
  4. from main_application import *
  5. from object_extractor import Extractor, FRONTALFACE_ALT2
  6. import uuid
  7. import main_application
  8. import click
  9. @click.command()
  10. @click.argument('eventid', default='')
  11. def crop(eventid):
  12. # original_working_directory = os.getcwd()
  13. # new_networked_directory = r'\\192.168.88.99\\Bizgaze\\port6003\\wwwroot\\_files\\'
  14. # # change to the networked directory
  15. # os.chdir(new_networked_directory)
  16. CURRENT_PATH = os.path.dirname(__file__)
  17. # extensions = ['jpeg', 'png']
  18. inputImg = 'Z:\\1\\CopyGallery\\' + eventid + "\\"
  19. out_src = '.\\sepration_crop\\' + eventid + "\\"
  20. index = 1
  21. for root, dirs, files in os.walk(inputImg, topdown=False):
  22. for name in files:
  23. f = os.path.join(root, name)
  24. Extractor.extract(os.path.join(CURRENT_PATH, f), cascade_file=FRONTALFACE_ALT2,
  25. output_directory=os.path.join(CURRENT_PATH, out_src),
  26. output_prefix=str(uuid.uuid4().hex[:15]) + str(index),
  27. start_count=1)
  28. #os.remove(f)
  29. index = index + 1
  30. crop()