- convert image to ascii image
- convert video to ascii video(MJPG codec)
Video is processed frame-by-frame, each frame is processed as an image using PIL, first it is resized to fit in time and quality, then each pixel is replaced with ascii character of same color, choice of ASCII character is based on Luminosity of pixel which is calculated by given formula. Finally video is written to output.avi in MJPG compression
Luminosity = 0.2126 * R + 0.7152 * G + 0.0722 * B
- using pipenv
pipenv install
demo.mp4
python3 image_to_ascii.py car.png 0
Original | ASCII |
---|---|
python3 image_to_ascii.py img.jpg 1
Original | ASCII |
---|---|
python3 video_to_ascii.py video.mp4
Original | ASCII |
---|---|
- Learned storage of image as matrix of pixels
- Learned to use PIL, OpenCV for image processing
- Learned to process video frame-by-frame as an image with PIL, OpenCV