<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>@ITP</title>
	<atom:link href="http://www.jackkalish.com/itp/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.jackkalish.com/itp</link>
	<description>Let&#039;s telecommunicate, interactively!</description>
	<lastBuildDate>Thu, 26 Apr 2012 23:32:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>DRIVE BY C4D</title>
		<link>http://www.jackkalish.com/itp/?p=471</link>
		<comments>http://www.jackkalish.com/itp/?p=471#comments</comments>
		<pubDate>Thu, 26 Apr 2012 23:32:10 +0000</pubDate>
		<dc:creator>jack</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.jackkalish.com/itp/?p=471</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.jackkalish.com/itp/wp-content/uploads/2012/04/C4D.jpg"><img class="alignnone size-full wp-image-472" title="C4D" src="http://www.jackkalish.com/itp/wp-content/uploads/2012/04/C4D.jpg" alt="" width="800" height="600" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jackkalish.com/itp/?feed=rss2&#038;p=471</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>To Position, Deposition, and Reposition: The Division of Meaning and Power</title>
		<link>http://www.jackkalish.com/itp/?p=455</link>
		<comments>http://www.jackkalish.com/itp/?p=455#comments</comments>
		<pubDate>Fri, 23 Dec 2011 05:16:01 +0000</pubDate>
		<dc:creator>jack</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[media]]></category>
		<category><![CDATA[nyu]]></category>
		<category><![CDATA[theory]]></category>
		<category><![CDATA[writing]]></category>

		<guid isPermaLink="false">http://www.jackkalish.com/itp/?p=455</guid>
		<description><![CDATA[Here is a PDF of my final paper for Politics of the Gaze, a media theory class at NYU taught by Allen Feldman that I was taking this semester: To Position, Deposition, and Reposition: The Division of Meaning and Power &#8230; <a href="http://www.jackkalish.com/itp/?p=455">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Here is a PDF of my final paper for Politics of the Gaze, a media theory class at NYU taught by Allen Feldman that I was taking this semester:</p>
<p><a href="http://www.jackkalish.com/itp/wp-content/uploads/2011/12/kalish_position.pdf">To Position, Deposition, and Reposition: The Division of Meaning and Power</a></p>
<p>This was by far the longest paper I have ever written. I found the process very challenging, but also rewarding.</p>
<p>And I can now officially say my third semester at ITP is over! Yahoo! Happy holidays!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jackkalish.com/itp/?feed=rss2&#038;p=455</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>XBee Basic Chat</title>
		<link>http://www.jackkalish.com/itp/?p=456</link>
		<comments>http://www.jackkalish.com/itp/?p=456#comments</comments>
		<pubDate>Thu, 22 Dec 2011 04:12:17 +0000</pubDate>
		<dc:creator>jack</dc:creator>
				<category><![CDATA[Sensitive Buildings]]></category>

		<guid isPermaLink="false">http://www.jackkalish.com/itp/?p=456</guid>
		<description><![CDATA[I initially had some trouble getting my XBees up and running. The problem started with me accidentally ordering the series 1 XBee instead of the series 2, TWICE. Once from Amazon and then again from Sparkfun because the descriptions were &#8230; <a href="http://www.jackkalish.com/itp/?p=456">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I initially had some trouble getting my XBees up and running. The problem started with me accidentally ordering the series 1 XBee instead of the series 2, TWICE. Once from Amazon and then again from Sparkfun because the descriptions were confusing and poorly labeled.</p>
<p>Anyway, once I got the right XBees, they initially would not work very well. As it turned out, one of my pins had a COLD SOLDER. What a pain! Even after all that, I was getting communication errors with XCTU. I final figured out how to reset the XBee by pulling it out from the USB explorer, putting it back in, then hitting the &#8220;Restore&#8221; command in XCTU. After that, things went smoothly and I was chatting away like hyped-up valley girl.</p>
<p>Truth.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jackkalish.com/itp/?feed=rss2&#038;p=456</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Wireless Light Sensor</title>
		<link>http://www.jackkalish.com/itp/?p=448</link>
		<comments>http://www.jackkalish.com/itp/?p=448#comments</comments>
		<pubDate>Tue, 18 Oct 2011 17:38:29 +0000</pubDate>
		<dc:creator>jack</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.jackkalish.com/itp/?p=448</guid>
		<description><![CDATA[Getting the Romantic Light Sensor from chapter 3 of Building Wireless Sensor Networks took be an exorbitantly long time. But here it it! The first problem I ran into was that the router XBee COMPLETELY stopped communicating with my computer through the &#8230; <a href="http://www.jackkalish.com/itp/?p=448">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Getting the Romantic Light Sensor from chapter 3 of Building Wireless Sensor Networks took be an exorbitantly long time. But here it it!</p>
<p><iframe src="http://player.vimeo.com/video/30745943" width="400" height="300" frameborder="0" webkitAllowFullScreen allowFullScreen></iframe></p>
<p>The first problem I ran into was that the router XBee COMPLETELY stopped communicating with my computer through the USB explorer. It took me a while to figure out how to reset the XBee. After that I got the router and coordinator talking to each other, but I was not getting a range of values on the serial data being received. For some reason, I would only get 518 as the value of the light sensor. Eventually I realized that there was a cold solder on pin 20 of the router XBee breakout board. Once I re-soldered the pin, everything worked like a charm!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jackkalish.com/itp/?feed=rss2&#038;p=448</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NIME Music Wall prototype</title>
		<link>http://www.jackkalish.com/itp/?p=444</link>
		<comments>http://www.jackkalish.com/itp/?p=444#comments</comments>
		<pubDate>Wed, 05 Oct 2011 20:21:19 +0000</pubDate>
		<dc:creator>jack</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.jackkalish.com/itp/?p=444</guid>
		<description><![CDATA[This semester at ITP I am really excited to be taking NIME: New Interfaces for Musical Expression. On the first day of class, out professor, Greg Shakar, asked for us to create a musical instrument in one week, and prepare a &#8230; <a href="http://www.jackkalish.com/itp/?p=444">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This semester at ITP I am really excited to be taking NIME: New Interfaces for Musical Expression. On the first day of class, out professor, Greg Shakar, asked for us to create a musical instrument in one week, and prepare a brief performance for the class.</p>
<p>I iterated over several ideas before I came to Music Wall. Initially what I wanted to create was an idea that I have had for some time for a musical instrument called &#8220;Beat Burger Helper&#8221; that would be sort of an assistant to beat-boxers. The premise is that when the performer makes sounds into the Beat Burger, the Beat Burger would process those sounds and play a sample of the sound that the user was attempting to emulate. For instance making the sound of a kick drum with your mouth, would result in a sample of an actual kick drum being played. Well, although this was a fun idea, it turned out to be too complicated to accomplish in the allotted time frame of one week.</p>
<p>The idea of the Music Wall came to me as an evolution of a previous idea of creating music by scanning the audience in the performance space. After an long night of coding what I came up with my initial prototype for &#8220;Music Wall.&#8221; This is a piece of software that uses computer vision to scan any surface to find objects (blob detection) and turn these objects into discrete musical notes. Essentially, it functions as a sequencer. In the video demo below, I am simply using pieces of grey tape on a white wall to compose a melody. The height of the piece of tape determines the pitch of the note. The horizontal position determines the length of the note, and its position in time, and the size of the determine the volume (larger objects are louder, smaller ones are quieter). At the end of the demo I give a shot of the Processing sketch in action.</p>
<p><iframe src="http://player.vimeo.com/video/30032749" width="640" height="480" frameborder="0" webkitAllowFullScreen allowFullScreen></iframe></p>
<p>Sorry for the poor quality and focus on the video. Thanks to my sister Anna for handling the camera (my Droid Incrapable).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jackkalish.com/itp/?feed=rss2&#038;p=444</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NIME Final Concept &#8211; Emotion Machine</title>
		<link>http://www.jackkalish.com/itp/?p=438</link>
		<comments>http://www.jackkalish.com/itp/?p=438#comments</comments>
		<pubDate>Tue, 04 Oct 2011 22:27:11 +0000</pubDate>
		<dc:creator>jack</dc:creator>
				<category><![CDATA[NIME]]></category>

		<guid isPermaLink="false">http://www.jackkalish.com/itp/?p=438</guid>
		<description><![CDATA[Concept Creating a feedback loop between the music, and the response that it elicits in the performer experiencing the music (Cage and Barishnikov) Nature of music; why do people like music to begin with; what does it mean? Emotional relationship &#8230; <a href="http://www.jackkalish.com/itp/?p=438">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><strong>Concept</strong></p>
<ul>
<li>Creating a feedback loop between the music, and the response that it elicits in the performer experiencing the music (Cage and Barishnikov)</li>
<li>Nature of music; why do people like music to begin with; what does it mean?</li>
<li>Emotional relationship between man and technology/computer/machine
<ul>
<li>How does technology extend/empower man?</li>
</ul>
</li>
</ul>
<p><a href="http://www.jackkalish.com/itp/wp-content/uploads/2011/10/sketch.jpg"><img title="sketch" src="http://www.jackkalish.com/itp/wp-content/uploads/2011/10/sketch-768x1024.jpg" alt="" width="640" height="853" /></a></p>
<p><strong>Process</strong></p>
<ul>
<li>Heartbeat creates beat/rhythm for the music performance. Heartbeat is synthetically augmented over time</li>
<li>Facial expression analysis triggers audio that is analogous with that expression</li>
<li>In the performance setting, the body of the performer is made to seem small, insignificant, in comparison to his technology/ computer extension/ representation (Wizard of Oz)</li>
<li>Visual effects modify the video signal in response to the emotions/physiological states of the performer or the music being generated</li>
</ul>
<p><strong>Technology</strong></p>
<ul>
<li>ofxFaceTracker is an open source face tracking library for Open Frameworks</li>
<li>FaceOSC is a library ported by Kyle McDonald over to OpenFrameworks, it is capable of capturing detailed facial analysis data, and sending it as midi out.</li>
</ul>
<p><strong>Feedback</strong></p>
<ul>
<li>How to tell a story during the performance? What is the experience of the performer?
<ul>
<li>is he interacting with some media, playing a video game, watching a movie, talking with friends? What is the arc of the story?</li>
</ul>
</li>
<li>Considering adding more layers of sound sampled from the body;
<ul>
<li>Galvanic Skin Response</li>
<li>EEG brain waves</li>
<li>sound of breath?</li>
</ul>
</li>
</ul>
<ul>
<li>How to make it more musical? (get more accurate control over the sound; discrete notes, chords, etc)</li>
<li>How to use head rotation to further augment the sound (add a sense of distance/directness)</li>
</ul>
<ul>
<li>Does the aesthetic work? (sound and visual)</li>
</ul>
<p><iframe src="http://player.vimeo.com/video/26098366" width="640" height="400" frameborder="0" webkitAllowFullScreen allowFullScreen></iframe></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jackkalish.com/itp/?feed=rss2&#038;p=438</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Imagining Sensitive Buildings &#8211; Real Lighting Network System</title>
		<link>http://www.jackkalish.com/itp/?p=424</link>
		<comments>http://www.jackkalish.com/itp/?p=424#comments</comments>
		<pubDate>Tue, 04 Oct 2011 17:45:01 +0000</pubDate>
		<dc:creator>jack</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.jackkalish.com/itp/?p=424</guid>
		<description><![CDATA[Below are the slides from my presentation of the concept for the Real Lighting Network System. This was created for the Imagining Sensitive Buildings assignment for the class Sensitive Buildings at ITP. I started off the presentation by talking about &#8230; <a href="http://www.jackkalish.com/itp/?p=424">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Below are the slides from my presentation of the concept for the Real Lighting Network System. This was created for the Imagining Sensitive Buildings assignment for the class Sensitive Buildings at ITP. I started off the presentation by talking about various apartments that I lived in in Brooklyn that don&#8217;t have adequate natural lighting, and how this is a common problem in urban dwelling environments. I then go on to talk about the various problems and health hazards associated with not getting enough exposure to sunlight:</p>
<ul>
<li>causes disassociation with the outside world, disruption of natural sleep cycle</li>
<li>depletion of vitamin D, Seasonal Affective Disorder</li>
<li>“A growing body of evidence suggests it can raise your risk of cancer, increase susceptibility to heart attack, diabetes and other disorders, and at least partly account for the region&#8217;s sky-high rates of multiple sclerosis.” &#8211; Seattle Times</li>
<li>it killed Mozart!!! (Requiem Mass in D-minor) [The Guardian]</li>
</ul>
<p>I then propose my solution: the Real Lighting Network System. A light sensor that senses the light outdoors, and adjusts the color-temperature and brightness of the light indoors to reflect the light outside.</p>
<p>I conclude by going into some more details of how this could be achieved using modern lighting technology, and other ideas for how the system can be used:</p>
<ul>
<li>contemporary lighting options are able to closely simulate the temperature of daylight</li>
<li>by sharing sensor data, users can simulate lighting from any part of the world within their own homes</li>
</ul>
<div id="__ss_9545381" style="width: 425px;">
<div id="__ss_9545381" style="width: 425px;">
<p><strong>The Slides:</strong></p>
<p><strong style="display: block; margin: 12px 0 4px;"><a title="Imagining Sensitive Buildings - Real Light Network System" href="http://www.slideshare.net/busybeingjack/imagining-sensitive-buildings-real-light-network-system" target="_blank">Imagining Sensitive Buildings &#8211; Real Light Network System</a></strong></p>
</div>
<div style="padding: 5px 0 12px;"><strong>Links to sources:</strong></div>
<div style="padding: 5px 0 12px;"><a href="http://seattletimes.nwsource.com/html/health/2004179538_vitamind13m.html">Does our lack of sun put your health in danger? (http://seattletimes.nwsource.com/html/health/2004179538_vitamind13m.html</a>)</div>
<div style="padding: 5px 0 12px;"><a href="http://www.guardian.co.uk/education/2011/aug/22/mozart-death-sunlight-vitamin-d">Did Mozart die of a lack of sunlight?</a> (<a href="http://www.guardian.co.uk/education/2011/aug/22/mozart-death-sunlight-vitamin-d">http://www.guardian.co.uk/education/2011/aug/22/mozart-death-sunlight-vitamin-d</a>)</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.jackkalish.com/itp/?feed=rss2&#038;p=424</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nap Feedback Buzzer</title>
		<link>http://www.jackkalish.com/itp/?p=420</link>
		<comments>http://www.jackkalish.com/itp/?p=420#comments</comments>
		<pubDate>Tue, 04 Oct 2011 16:38:46 +0000</pubDate>
		<dc:creator>jack</dc:creator>
				<category><![CDATA[Sensitive Buildings]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.jackkalish.com/itp/?p=420</guid>
		<description><![CDATA[For the second assignment for Sensitive Buildings, I worked with Emily Webster. We made a &#8220;Nap Feedback Buzzer.&#8221; It is composed of two sets of components. 1: One set is made up of an Xbee, Arduino, button, and two LEDS. &#8230; <a href="http://www.jackkalish.com/itp/?p=420">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>For the second assignment for Sensitive Buildings, I worked with <a href="http://emilywebster.com/">Emily Webster</a>. We made a &#8220;Nap Feedback Buzzer.&#8221; It is composed of two sets of components.</p>
<p>1: One set is made up of an Xbee, Arduino, button, and two LEDS.</p>
<p>2: The other is an Xbee, Arduino, buzzer, and two LEDS.</p>
<p>When the user first pushes the button on component #1, a message is sent from #1 Xbee to the Xbee on #2. When this message is received, #2 responds by flashing the red LED, and sends a confirmation message back to #1, which responds by flashing its red LED as well. After the user pushes the button 10 times, #2 responds by buzzing, and flashing the green light, and also sending a different confirmation message back to #1. In response, #1 flashes its green LED as well.</p>
<p>And here is a goofy video of it in action at midnight on Friday night:</p>
<p><iframe src="http://player.vimeo.com/video/30026482" width="640" height="480" frameborder="0" webkitAllowFullScreen allowFullScreen></iframe></p>
<p><a href="http://itp.nyu.edu/~eew246/mydomain/?p=526">Emily posted about this project as well</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jackkalish.com/itp/?feed=rss2&#038;p=420</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Illumination: real-time generative blackout poetry</title>
		<link>http://www.jackkalish.com/itp/?p=396</link>
		<comments>http://www.jackkalish.com/itp/?p=396#comments</comments>
		<pubDate>Tue, 10 May 2011 03:54:38 +0000</pubDate>
		<dc:creator>jack</dc:creator>
				<category><![CDATA[Learning Bit by Bit]]></category>
		<category><![CDATA[Reading and Writing Electronic Text]]></category>

		<guid isPermaLink="false">http://www.jackkalish.com/itp/?p=396</guid>
		<description><![CDATA[Illumination is an interactive art installation created by myself in collaboration with Yonatan Ben-Simhon. It uses light to discover and reveal poetry from within printed texts. What happens The basic set-up of Illumination is a table in a dark space, &#8230; <a href="http://www.jackkalish.com/itp/?p=396">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><iframe src="http://player.vimeo.com/video/23418952" width="640" height="360" frameborder="0"></iframe></p>
<p>Illumination is an interactive art installation created by myself in collaboration with <a href="http://yonatantsav.com/">Yonatan Ben-Simhon</a>. It uses light to discover and reveal poetry from within printed texts.</p>
<p><strong>What happens</strong><br />
The basic set-up of Illumination is a table in a dark space, lit from above by a spot-light. Visitors can take any piece of paper with printed text on it (newspaper or magazine articles, pages from a book, etc) and place it on the table. Upon doing so, the light shining on the table beings to flicker, and the text on the page begins to fluctuate and shake. After a few seconds, the light goes out. Slowly, individual words of the text begin to light up. One by one, words light up and construct poetry. Take away the text and place a new text on the table, and a new poem is revealed within the text. The unique language and tone of each text reveals a unique poem.</p>
<p><strong>How it was done</strong><br />
From a technical perspective, Illumination uses a camera, projector, and computer that work in synch to create this magical experience. The camera and projector are suspended above the table.  When a visitor places a text on the table surface, the camera above the table takes a high-resolution photo of the text which is uploaded to a computer nearby. A custom Python script running on the machine saves the JPEG image received from the camera as a TIFF. The script then uses the open-source Optical Character Recognition (OCR) software <a title="Tesseract" href="http://code.google.com/p/tesseract-ocr/">Tesseract</a> to generate an HOCR.html output file that consists of both the text of the image that was processed and the positions and locations of every words that is located.</p>
<p>A poetry-generation Python script trains a Markov model on hundreds of works of poetry and fiction, creating a statistical model of word sequences that appear in poetic and non-fiction texts. In addition, the texts are all tagged for parts of speech, and the Markov model is then seeded with the tagged texts as well. Then, the word and part-of-speech sequences that are generated by the Markov model are searched for in the OCR text, generating a poem of several lines long. This sequence of lines and words is sent as a multi-dimensional array of word indexes to an implementation of Processing.py that then displays the box locations of the words, animating them as they appear and fade out over time.</p>
<p><strong>More Sample Illumination Poetry</strong></p>
<p>As a case study of the entire process outlines above, here is a sample photo of text that was taken:</p>
<p><a href="http://www.jackkalish.com/itp/wp-content/uploads/2011/05/Capture_00001.jpg"><img class="alignnone size-large wp-image-405" title="Capture_00001" src="http://www.jackkalish.com/itp/wp-content/uploads/2011/05/Capture_00001-1024x768.jpg" alt="" width="640" height="480" /></a></p>
<p>Here is the HOCR output.html file generated by Tesseact: <a href="http://www.jackkalish.com/itp/wp-content/uploads/2011/05/output.html">output.html</a> (right-click to view source to see the box data)</p>
<p>And here is some sample poetry generated by Illumination:</p>
<p>will at any sight<br />
a will of town instincts<br />
the same, as well<br />
will of his actions<br />
will and sight policy<br />
and sight into instincts</p>
<p>will like a desert endgame well<br />
and to have it cornered.<br />
drawn profiles and instincts have<br />
it is a will fight well<br />
a will to turn large<br />
to turn the instincts from<br />
a will of some benefit,</p>
<p><strong>The Code</strong></p>
<p><code>"""<br />
illuminate.py</code></p>
<p><code>by Jack Kalish and Yonatan Ben-Simhon<br />
NYU ITP 2011<br />
"""</code></p>
<p><code>import processing.video.Capture as Capture<br />
import commands, subprocess, math, re, os, shutil, glob, random<br />
from BeautifulSoup import BeautifulSoup<br />
#from markov import MarkovGenerator<br />
import imageadjuster.ImageAdjuster as ImageAdjuster;<br />
from threading import Thread<br />
from MarkovGenerator import MarkovGenerator<br />
#from FakeMarkovGenerator import MarkovGenerator</code></p>
<p><code>#import MarkOutPoet<br />
#markOutPoet = MarkOutPoet()<br />
#markOutPoet.quickPoemForJack()</code></p>
<p><code>imgPath = 'captures/Capture_00001.JPG'</code></p>
<p><code>class Illuminate(object):<br />
def setup(self):<br />
#instantiate class vars<br />
self.fadeAlpha = 2<br />
self.lightColor = [255,244,208]<br />
#self.lightColor = 0xFFEF91<br />
self.calibrate = False<br />
self.speed = 250<br />
self.showImg = 1<br />
self.wordMargin = 3<br />
self.boxList = []<br />
self.currentBoxNum = [0]<br />
self.lastTime = [0]<br />
self.mt = []<br />
self.words = []<br />
self.loading = 0<br />
self.thread = None<br />
self.generator = None<br />
self.lightOn = True<br />
self.generator = None<br />
self.showTime = 1000<br />
# calibrate<br />
f = open('config.txt')<br />
str = f.read()<br />
print "str: "+str<br />
calib = str.split(',')<br />
print calib<br />
try:<br />
self.imgPos = [int(calib[0]),int(calib[1])]<br />
except:<br />
#set default calib value<br />
calib = [507,324,535,297]<br />
self.imgPos = [int(calib[0]),int(calib[1])]<br />
self.imgSize = [int(calib[2]),int(calib[3])]<br />
self.saveCalib();<br />
#set screen<br />
#frame.setLocation(1280,0);<br />
size(1600, 900)<br />
#myCapture = Capture(this, width, height, 30)<br />
fill(255, 5000)<br />
noStroke()<br />
self.adjust = ImageAdjuster(this)<br />
self.img = loadImage(imgPath)</code></p>
<p><code>self.line = []<br />
self.lines = []<br />
self.lineCnt = 0<br />
self.wordCnt = 0</code></p>
<p><code>def draw(self):<br />
#print 'drawing'<br />
#clearCaptures()</code></p>
<p><code>#self.showLoader()<br />
if self.lightOn:<br />
self.light()</code></p>
<p><code>if self.loading == 1:<br />
if self.thread and self.thread.isAlive():<br />
self.showLoader()<br />
else:<br />
self.loading = 0<br />
if self.onThreadComplete != None:<br />
self.onThreadComplete()</code></p>
<p><code>#print "self.lines: ",<br />
#print self.lines</p>
<p>if self.calibrate:<br />
image(self.img, self.imgPos[0], self.imgPos[1], self.imgSize[0], self.imgSize[1])</p>
<p>if len(self.lines)&gt;0:<br />
#background(0)</p>
<p>if self.lineCnt &lt; len(self.lines)-1: 				'''print "len(self.line): ", 				print len(self.line) 				print "len(self.words): ", 				print len(self.words) 				print "self.wordCnt: ", 				print self.wordCnt''' 				 				if millis() - self.lastTime[0] &gt; self.showTime:<br />
if self.wordCnt &gt;= len(self.line):<br />
#background(0)<br />
#go to next line<br />
self.wordCnt = 0<br />
self.lineCnt += 1<br />
self.line = self.lines[self.lineCnt]<br />
self.showTime = 2000<br />
self.fadeAlpha = 10<br />
#print "new line length:"<br />
#print len(self.line)<br />
#print " ".join(self.line)<br />
#print len(self.mt[self.currentBoxNum[0]])*100<br />
else:<br />
#background(0,10)<br />
#lightRandomWord()<br />
#print "self.wordCnt: ",<br />
#print self.wordCnt<br />
#print "line[self.wordCnt] ",<br />
#print self.line[self.wordCnt]<br />
self.lightWord(self.line[self.wordCnt])<br />
#self.lightNextMt()<br />
self.showTime = math.sqrt(self.getCurrentWordLength())*self.speed<br />
self.wordCnt += 1<br />
self.fadeAlpha = 2<br />
self.lastTime[0] = millis()<br />
fill(0,0,0,self.fadeAlpha)<br />
rect(0,0,width,height)<br />
else:<br />
#we gotta end it here, no more lines!<br />
self.end()</p>
<p>def light(self):<br />
background(self.lightColor[0],self.lightColor[1],self.lightColor[2])</p>
<p>def end(self):<br />
print "the poem is over"<br />
self.runThreadOn(self.makeNewPoem)</p>
<p>def makeNewPoem(self):<br />
print "thinking of a new poem...hmmm"<br />
#make a new poem between 3 and 14 lines long</p>
<p>self.lineCnt = 0<br />
self.wordCnt = 0<br />
numLines = round(random.random()*11)+3<br />
print "ok, it will be ",<br />
print numLines,<br />
print "lines long"<br />
lines =  self.generator.generateFromText(numLines)<br />
self.lines = lines<br />
self.line = lines[0]<br />
self.showTime = 5000</p>
<p>def getCurrentWordLength(self):<br />
return len(self.words[self.line[self.wordCnt]])</p>
<p>def runThreadOn(self, method, callback=None):<br />
if self.thread and self.thread.isAlive():<br />
print "thread already running"<br />
return<br />
self.onThreadComplete = callback<br />
self.thread = Thread(target=method)<br />
self.thread.start()<br />
self.loading = 1<br />
self.calibrate = False</p>
<p>def runThread(self):<br />
if self.thread and self.thread.isAlive():<br />
print "thread already running"<br />
return<br />
self.thread = Thread(target=self.run)<br />
self.thread.start()<br />
self.loading = 1<br />
self.calibrate = False</p>
<p>def showLoader(self):<br />
#print 'loading'<br />
#text("processing...", width/2, height/2)<br />
#jiggle the image?<br />
randomness = 3.0<br />
#print "random: "<br />
#print random(1)<br />
background(self.lightColor[0], self.lightColor[1], self.lightColor[2])</p>
<p>image(self.img, self.getWiggle(self.imgPos[0], randomness), self.getWiggle(self.imgPos[1], randomness), self.getWiggle(self.imgSize[0], randomness), self.getWiggle(self.imgSize[1], randomness))<br />
#background(self.lightColor,random.random()*255)<br />
fill(0, random.random()*50)<br />
rect(0,0,width,height)<br />
#image(self.img, self.imgPos[0], self.imgPos[1], self.imgSize[0], self.imgSize[1])<br />
#image(self.img, self.imgPos[0]*random(randomness*-1, randomness), self.imgPos[1]*random(randomness*-1, randomness), self.imgSize[0]*random(randomness*-1, randomness), self.imgSize[1]*random(randomness*-1, randomness))</p>
<p>def getWiggle(self, val, r):<br />
#print 'input val:',<br />
#print val<br />
val +=  (random.random()*r*2) - r<br />
#print 'output val',<br />
#print val<br />
return val</p>
<p>def run(self):<br />
#clear screen<br />
background(0)<br />
self.showImg = 0<br />
#wait for a new image to become available<br />
files = glob.glob('captures/*')<br />
while len(files) &lt; 1:<br />
while files[0] != 'captures/capture_1.JPG':<br />
files = glob.glob('captures/*')<br />
print "waiting for an image"<br />
#colorMode(HSB, 100);<br />
#tint(0,0)<br />
#adjust contrast<br />
#img.adjust.contrast(g, 2)<br />
self.capture() #convert to tiff<br />
#delete the original jpeg<br />
#commands.getstatusoutput('rm -f captures/capture_1.JPG')<br />
self.performOCR()<br />
self.words = self.parseWords()<br />
#TRAIN THE MARKOV GENERATOR<br />
self.generator = MarkovGenerator(n=3, max=30, min=4, words=self.words)</p>
<p>def onOCRComplete(self):<br />
print "finished reading!"<br />
self.lightOn = False<br />
self.runThreadOn(self.makeNewPoem)<br />
#now get generate the poetry from the text...<br />
#doMarkov()</p>
<p>def performOCR(self):<br />
print "reading text..."<br />
subprocess.call(['tesseract',r'captures/capture.tif', 'output', '-l', 'eng' ,'+hocr.txt'])<br />
#commands.getstatusoutput('tesseract capture.tif output -l eng +ocr/hocr.txt')<br />
#commands.getstatusoutput('tesseract captures/capture.tif output -l eng +hocr.txt')<br />
#commands.getstatusoutput('tesseract ocr/article.tif output -l eng +ocr/hocr.txt')</p>
<p>def lightRandomWord(self):<br />
self.lightWord(random.randint(0,len(boxList)))</p>
<p>def lightWord(self,id):<br />
#print "light word: ",<br />
print self.words[id],<br />
self.lightBox(self.boxList[id])</p>
<p>def lightNextBox(self):<br />
#background(0)<br />
#print 'light next word:'<br />
#print boxList[currentBoxNum[0]]<br />
self.lightBox(self.boxList[self.currentBoxNum[0]])<br />
self.currentBoxNum[0] += 1</p>
<p>def lightBox(self,r):<br />
xScale = self.imgSize[0]/float(2272)<br />
yScale = self.imgSize[1]/float(1704)<br />
#print r<br />
#fill(255,10)<br />
fill(self.lightColor[0],self.lightColor[1],self.lightColor[2])<br />
rect((float(r[0]))*xScale+self.imgPos[0]-(self.wordMargin), (float(r[1]))*yScale+self.imgPos[1]-(self.wordMargin), float(r[2])*xScale+(self.wordMargin*2), float(r[3])*yScale+(self.wordMargin*2))<br />
#delay(1000)</p>
<p>def moveImage(self,x,y):<br />
self.imgPos[0] += x<br />
self.imgPos[1] += y<br />
self.saveCalib()</p>
<p>def scale(self,x,y):<br />
self.imgSize[0] += x<br />
self.imgSize[1] += y<br />
self.saveCalib()</p>
<p>def saveCalib(self):<br />
print "save calib"<br />
f = open('config.txt', 'r+')<br />
f.truncate()<br />
calib = str(self.imgPos[0])+","+str(self.imgPos[1])+","+str(self.imgSize[0])+","+str(self.imgSize[1])<br />
print "calib: "+calib<br />
f.write(calib)<br />
f.close()</p>
<p>def clearCaptures(self):<br />
print "clear captures dir"<br />
files = glob.glob('captures/*')<br />
print "files:"<br />
print files<br />
for f in files:<br />
print f<br />
os.remove(f)<br />
#if f!= 'captures/capture_1.JPG':<br />
#os.remove(f)</p>
<p>#remove all images except for the first<br />
'''for files in os.walk('/captures'):<br />
print "file:"<br />
print f<br />
if f!= 'capture_1.JPG':<br />
os.unlink(os.path.join(root, f))'''</p>
<p>def capture(self):<br />
print "save tif"<br />
self.img.save("captures/capture.tif");</p>
<p>def parseWords(self):<br />
soup = BeautifulSoup(open('output.html'))<br />
print "parsing words..."<br />
boxes = soup.findAll('span', { "class" : "ocr_word" })<br />
cnt = 0<br />
words = []<br />
for word in boxes:<br />
#generate arrary of only words<br />
w = word.contents[0].contents[0]<br />
words.append(w)<br />
title = word['title']<br />
#print "title: " + title<br />
r = title.split(' ')<br />
r.pop(0)<br />
#generate another array of box data<br />
#convert array to processing rect object coords (x,y,W,H)<br />
r[2] = float(r[2]) - float(r[0])<br />
r[3] = float(r[3]) - float(r[1])<br />
self.boxList.append([r[0], r[1], r[2], r[3]])<br />
cnt += 1<br />
print "words:",<br />
print words<br />
return words<br />
#print "words array: "<br />
#print words</p>
<p>def keyPressed(self):<br />
print "keypressed: "<br />
print key<br />
if key == CODED:<br />
if keyCode == UP:<br />
self.moveImage(0,-1)<br />
elif keyCode == DOWN:<br />
self.moveImage(0,1)<br />
elif keyCode == LEFT:<br />
self.moveImage(-1,0)<br />
elif keyCode == RIGHT:<br />
self.moveImage(1,0)<br />
elif key==61:<br />
self.scale(1,0);<br />
elif key==45:<br />
self.scale(-1,0);<br />
elif key==93:<br />
self.scale(0,1);<br />
elif key==91:<br />
self.scale(0,-1);<br />
elif key==99:<br />
#c - turn calibration on<br />
background(0)<br />
self.calibrate = not self.calibrate<br />
elif key==32:<br />
#spacebar - run<br />
self.runThreadOn(self.run, self.onOCRComplete)</p>
<p>illuminate = Illuminate()</p>
<p></code></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><code>def setup(): illuminate.setup()<br />
def draw(): illuminate.draw()<br />
#def mousePressed(): illuminate.mousePressed()<br />
def keyPressed(): illuminate.keyPressed()</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jackkalish.com/itp/?feed=rss2&#038;p=396</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Final Project Proposal &#8211; Light-up Poetry</title>
		<link>http://www.jackkalish.com/itp/?p=390</link>
		<comments>http://www.jackkalish.com/itp/?p=390#comments</comments>
		<pubDate>Fri, 15 Apr 2011 16:50:38 +0000</pubDate>
		<dc:creator>jack</dc:creator>
				<category><![CDATA[Learning Bit by Bit]]></category>
		<category><![CDATA[Reading and Writing Electronic Text]]></category>

		<guid isPermaLink="false">http://www.jackkalish.com/itp/?p=390</guid>
		<description><![CDATA[For the final project I am collaborating with Yonatan Ben-Simhon. We are creating an interactive art installation inspired by Austin Kleon&#8217;s Newspaper Blackout Poems project. The basic set-up is this: Next to a table sits a stack of newspaper and magazine articles. The &#8230; <a href="http://www.jackkalish.com/itp/?p=390">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>For the final project I am collaborating with Yonatan Ben-Simhon. We are creating an interactive art installation inspired by Austin Kleon&#8217;s <a href="http://www.austinkleon.com/newspaperblackout/">Newspaper Blackout Poems project</a>.</p>
<p>The basic set-up is this: Next to a table sits a stack of newspaper and magazine articles. The visitor places one of the articles on the table. A camera above the table reads the text and processes it. Then, everything goes dark, and magically the text is lit up by an overhead projector. Individual words and phrases are lit up, creating poetry out of the original text.</p>
<p>We have already been working on this project for several weeks. Last week, we created a quick test of the installation set-up. Using a chain of tagged parts of speech, we then searched for the same parts of speech in the following sample article:</p>
<p><a href="http://www.jackkalish.com/itp/wp-content/uploads/2011/04/article0052.jpg"><img class="alignnone size-large wp-image-392" title="article005" src="http://www.jackkalish.com/itp/wp-content/uploads/2011/04/article0052-1024x881.jpg" alt="" width="640" height="550" /></a></p>
<p>The source text that we used for the POS tagging was the line:</p>
<p>&#8220;And now for something completely different.&#8221;</p>
<p>The resulting POS tags were: CC, RB, IN, NN, RB, JJ</p>
<p>Sample Text: yet  never  with  passage  about<br />
(created off: And now for something completely different)</p>
<p>word = yet, pos = CC, position = 70<br />
word = never, prevPos = RB, pos = RB, position = 475<br />
word = with, prevPos = IN, pos = IN, position = 484<br />
word = passage, prevPos = NN, pos = NN, position = 518<br />
word = about, prevPos = RB, pos = RB, position = 551</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jackkalish.com/itp/?feed=rss2&#038;p=390</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

