Skip to content

View yourself on the terminal! This is a C++ port of my AsciiVideo project in python.

License

Notifications You must be signed in to change notification settings

birinders/AsciiVideoCPP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AsciiVideoCPP

This is a rough-cut version of my AsciiVideo project, ported into C++.

Check the more capable and easier to setup version written in Python here.

See (for) yourself on the terminal!

Setup your IDE for use with OpenCV, or follow this tutorial here.
Run git clone https://github.com/birinders/AsciiVideoCPP.git to get started.

AsciiVideo--CPP is a very simple project at heart-

Take what you see, and show it on the terminal. The project uses OpenCV library in order to convert anything your webcam captures from a series of colourful dots to a series of black and white letters. The program uses the cv2 module to capture data from any camera connected to your device, and then converts it into a b&w image. This allows us to index every pixel in this image array, and convert it into suitable ascii characters according to their brightness.

Eg- A pixel with high brightness value is converted to a character with a larger area, like $ or #, whereas darker characters might get converted to dots("."), commas(",") or even blank spaces (" ") if the pixel is too dim.

  • Note- The default behaviour is to choose the external camera before the built in camera. You can change this behaviour in the Source.cpp file.

Ratio correction is an extremely important step for this project to work correctly. Since we know that characters are not square, but are taller than they are wide, like a vertical rectangle, we need to account for this differnce factor in order to produce the outputs in the correct ratio.

The above can be calculated using the following formula-

Image Description

The script will automatically check the aspect ratio of the incoming video stream, and readjust the output to match the input aspect ratio. The terminal is NOT automatically resized upon startup in the CPP port.

And that's it!

If everything has been set up correctly, you should now be seeing yourself on the terminal.

Hello
Meet Birinder: The person trying to convice you that AsciiVideo works better in Python
(trust me this works better in python)

  • Notes-
  1. If text appears out of place, try shrinking the terminal letter size by holding ctrl + mousewheel down.
  2. Make sure to set the terminal font to a monospace font. This is the default behaviour for most terminals, and is the core requirement for the output to be aligned.
  3. Try manually adjusting the letter_height and letter_width variables if the image appears too tall or too wide.

About

View yourself on the terminal! This is a C++ port of my AsciiVideo project in python.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages