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.

50 lines
1.2KB

  1. # The following code was developed by Tim Chinenov
  2. # The script turns a random image into a Vaporwave themed
  3. # image. The program was written in opencv 3.3.1 and python 2.7
  4. # To run the program call the following command in terminal
  5. # python main.py
  6. import sys
  7. import logging
  8. import cv2
  9. from vaporwave import vaporize
  10. ESCAPE_KEY = 27
  11. logging.basicConfig(level=logging.INFO,
  12. format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s',
  13. datefmt='%m-%d %H:%M')
  14. logger = logging.getLogger("main")
  15. logger.setLevel(logging.INFO)
  16. def main():
  17. img = vaporize()
  18. cv2.namedWindow("pic", cv2.WINDOW_NORMAL)
  19. cv2.imshow("pic", img)
  20. while cv2.getWindowProperty("pic", cv2.WND_PROP_VISIBLE):
  21. key_code = cv2.waitKey(100)
  22. if key_code == ESCAPE_KEY:
  23. break
  24. elif key_code != -1:
  25. import time
  26. start = time.time()
  27. img = vaporize()
  28. cv2.imshow("pic", img)
  29. end = time.time()
  30. logger.info("Vaporizing and rendering took: %f seconds" % (end-start,))
  31. cv2.destroyAllWindows()
  32. sys.exit()
  33. if __name__ == "__main__":
  34. main()