Pixelate a picture with a custom pixel.
- pixelit.py : Python 3.7 file
- srcimg.jpeg : source image
- pix.jpg : source pixel image (square)
- output.jpg : output image file
The project was developed using python 3.7 using OpenCV and Numpy. The process includes:
- Reading an input image
- Converting the input image to grayscale
- Resizing the image to pixellate it
- Generating a matrix of 0s and 1s decided by a threshold grey value
- Reading input pixel and generating a corresponding blank pixel
- Creating a new matrix using the binary matrix of the original image as a template to place the input pixel and the blank pixels
- Output the image
- IMG_PX_SCALE - percentage of resolution you want to scale down to
- CONTRAST_THRESHOLD - value between 0 and 255, larger values make the output darker.
- Instead of a binary matrix, generate a range of values based on threshold ranges. Then, substitute the values with different input pixels.
- Improve program execution. There should be an easier way to map the pixels onto the matrix without the loops.