Git Product home page Git Product logo

asciimatic's Introduction

Asciimatic - an edge-based ASCII art generator

This repository contains a cleaned-up mirror of the SVN repo for Nathan Taylor's final project in CPSC 505: Image Understanding, Fall 2009, at the University of British Columbia.

Alt text

Typically, tools to generate ASCII art from raster images, such as aalib or libcaca, quantize the input image to a series of brightness levels, and a printable ASCII character is then assigned to a corresponding subregion of the image, where a "darker" brightness level is assigned a "denser" character, and lighter brightness levels are assigned "sparser" characters. While simple to implement and fast enough for real-time purposes (both mplayer and VLC can display video as ASCII, and Quake has been modified to run in the terminal), it is difficult to see what the image is unless the characters are very small; additionally, ANSI colour information is often needed in order to improve the "shading" of the image.

One can observe that more information than simply "brightness" can be encoded in an ASCII character; in particular, certain characters such as slashes, dashes, pipes, and other punctuation marks suggest strong direction. Also, the choice of character itself could suggest fine detail within the image (ie. a '+' when two near-parallel lines intersect, a 'O' for small circular features, etc.) Additionally, large swatches of similar colours look very busy to the eye; therefore, we may only want to register characters for regions of the image that correspond to changes in intensity; in other words, it is fruitful to consider an edge-based approach to ASCII-art generation.

My CPSC 505 miniproject performs Canny edge-detection on an input in order to extract the primal sketch of an image. Additionally, each subregion of the Canny primal sketch is treated as a filter, and template matching is applied to a subset of printable ASCII characters in order to ask the question, "what character best approximates this region of interest?" The character that corresponds to the highest normalized cross corellation with the filter is outputted.

Initially, the entire range of printable ASCII characters were used. However, this resulted in a very noisy output. Therefore, a subset was chosen by hand that perhaps best represents the kind of edges we would like to capture in text. Different characters could be chosen to represent different "shading types", at the artistic whim of the user.

Building and installation

$ make $ ./asciimatic [flags] <rows> <cols> <ifile>

Additional configuration parameters may be specified in ./config/asciimatic.cfg.

Dependencies

  • cairo
  • libconfig
  • libpthread
  • opencv
  • qt

Note that qt is an optional dependency for opencv and that you might have to specify its inclusion yourself.

asciimatic's People

Contributors

dijkstracula avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.