Synesthesia-1

Synesthesia

Takes in an image and replace the colors with words semantically related to the color.

So, if there’s a red patch in your image, in that area in the resulting image, you might find the words “cherry”, “communism”, “anger”, and “balloon”

Concept: Natan Last, Execution: Jenna Zeigen (me!)

I’ve blogged about this project and more how each of the methods work at http://linkguistics.blogspot.com/2012/12/project-synesthesia.html

Components:

  1. cooccurrence.py – This is the module that makes the lists of words are associated with the colors.
  2. imagesimpler.py – This module reduces the color space so that the words can be properly associated with the colors
  3. synesthesizer.py – This module takes the words and image and maps them, creating the final piece
  4. synserver.py – Flask-powered; Makes synesthesizer a web app with a pretty GUI with the help of syn.js and syn.css

GUI

Initial Screen

While synthesizer.py also works as a command line tool, it also has a web app interface powered by Flask. You upload your image, which will them be previewed, and then choose all the conditions to modify the parameters.

GUI shown with preview of uploaded image

When you submit your image and choices, the result will appear and you can then click on the preview to download the image.

GUI shown with resulting image


API

cooccurrence.py

CooccurrenceFinder()

corpus_scraper(self, word, numdocs, redo=False)
find_relateds(self, corpus, word, distance, extra_stops, stdevs)
find_close_words(self, dist, text, word)
tally_occurrences(self, word, pair_set, stopwords)
find_significant_cooccurrences(self, counts, SDs)

imagesimpler.py

ImageSimpler():

simplify(self, imagefile, colors, percentsize)
scale_by_percent(self, im, percent)
map_RGB_to_color_word(self, colors)
reduce_to_requested_color_space(self, pix_obj, im, color_mapping)

synesthesizer.py

Synesthesizer():

combinatorics(self)
reconstitute(self)
synesthesize(self, image, colors, fontname)