Skip to content

Latest commit

 

History

History
49 lines (37 loc) · 2.17 KB

Readme.md

File metadata and controls

49 lines (37 loc) · 2.17 KB

Photo Mosaic (Added limited support for video)

Requirements

Python 3, OpenCV 4(pip install opencv-python ), Numpypip install numpy, tqdm (pip install tqdm )

How to Use

  1. Clone or Download Repo
  2. Prepare images to create mosaic [and add to the folder called images] (about 20,30 works. More images of different color leads to better mosaics).
  1. Open CMD in the repo location and run mosaic.py python mosaic.py (https://www.thewindowsclub.com/how-to-open-command-prompt-from-right-click-menu/)
  • For Multithreaded, see example below

  • Note: If you want the above command to work, copy your image into the folder and rename it to me.jpg and add other image samples in the folder called images

  • Use -i [path] flag to add your content image

  • Use -d to add you datasets of images

  • Use -r to division of the image (Optional) . Default is 32. Higher value leads to better picture but it takes more time.

  • Use -s to specify size of output (Optional)

  • Use -o [path] to save image. (Add filename with path)

Note: MultiThreaded is faster but does not produce as good result as single threaded

Example

python mosaic.py -i dicaprio.jpg -r 50 -o diCaprio_mosaic.jpg OR python mosaic_multiThreaded.py -i dicaprio.jpg -r 50 -o diCaprio_mosaic.jpg

Input

Ouptut

MultiThreaded Ouptut (-r 90)

python mosaic.py -i me.jpg -r 64 -d ./images -s 600 600 -o ./output.jpg

Input

Ouptut

MultiThreaded Ouptut

VIDEO

IT TAKES A LONG TIME TO PROCESS IT

(Original video)(https://www.youtube.com/watch?v=_uqm-Ans1rU) See output.avi for processed video, using default settings.