Skip to content

Latest commit

 

History

History
29 lines (21 loc) · 1.13 KB

README.md

File metadata and controls

29 lines (21 loc) · 1.13 KB

mosaic-cv

This script generates photo mosaics with Python3 using the OpenCV library to handle images. The script requires a target image and different images to be processed as the block units in the mosaic.

Usage

Run the following command:

python mosaic.py <target> <images> <block_size>
  • target: the target image directory.
  • images: the image directory to be used. A recursive search is used to find all the supported files. To add other image formats, edit the code to add the format prefix to the global variable IMAGE_FILE_FORMATS.
  • block_size: the size of a mosaic square block (in pixels).

Example

Using a custom dataset of images placed in /data/images:

python mosaic.py data/cat.jpg data/images 20
Mosaic Oricinal
Original image (data/cat.jpg) Mosaic output (data/out/mosaic-20-2320x3480)

The quality of the ouput is heavily dependent on the size and variety of your dataset.