Thursday, December 16, 2010

Garbage, etc...

I've always been a little annoyed by the phrase "Garbage In, Garbage Out." People tend to say it as if they've come up with something remarkably clever. I never hear actual programmers use it-- it would be like rabbits reminding each other to be careful of predators.  I was pleased to see that Babbage felt the same way, referring to being questioned in Parliament:

"On two occasions I have been asked,—'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' ... I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question."

Tuesday, December 14, 2010

The Ivory Tower


"...in that country there live a great many elephants. They follow paths worn into the stone by unreckonable generations, and by these ways they come to a place called memorial, where the bones of their ancestors lay. It is a holy place to these animals, and the ritual is performed by them every year at the end of summer.
The people in that country have taken up the bones and built from them a high place.  They surely have been building this memorial for many, many years; for at the foundation can be found the yellowed tusks and cracked femurs of mastodons. On all these bones are carved the names of the dead, and their deeds, and all that they would record.  On the oldest bones these markings are barely discernible from the natural cracks in the bone, and indeed it is said that the first writing in that part of the world came from wise men who sought to divine the interpretation of these cracks.
 As one climbs the spiral staircases of that place, the story of all the people from the very first can be read from the walls, the oldest at the foundation, and the most recent in the tusks that form the delicate arches of the roof.
Before the tower lies a deep quarry, from which is hewn layers of fossiliferous stone, and into which a mighty cataract pours.  It is this stone that is used by all the people in the building of their homes, to keep them safe against the occasional storm and flood.
Those who study in that place are said to become able to hold it entirely within their minds, for it acts as a template on the memory.  They become able to close their eyes and walk about it at will in their imagination, and read wisdom from the inscriptions on the walls. Thus dreamers are said to enter by the gate of ivory (ἐλέφας) and of horn (κέρας)."


Monday, November 22, 2010

Visual Filters

I'm working on ways to teach computers to assign labels to different parts of an image or video.  The main tool I've been using is something we've dubbed a "visual filter."
Visual filters were originally thought up by Justin Domke, who called them a "Graphical Combination of Classifiers." Either name is an apt description, but some of this terminology is specific to the image and signal processing field, so I'll give a little background before I explain how this algorithm works.

Background:
If you remember back to high school algebra, a "function" can take several variables and gives as a result the unique value of a single variable. An image processing "filter" is a function in this sense. The variables it takes in are the colors of the pixels in a small window of an image, and the output is the color of a single pixel of the output. The filter scans the image, sliding across row after row, each time considering a region of the image that mostly overlaps with the regions it has already looked at. (If you want to know how a color can be an input variable, take a look at what I wrote here.)
Traditionally, filters have used fairly simple formulas to take these input colors and transform them into the output colors. (The "box blur," for example, simply takes the average of all the colors in the window and assigns it to the output.) That's why they are a fundamental tool in the image processing toolbox.  Adobe Photoshop has a main menu entry called "Filters." If you want to blur an image, find the edges, or many other simple tasks, you would use a filter.
These filters used simple formulas because early computers had very limited memory and it took a long time to filter an image, because the same formula needed to be applied as many times as there are pixels in the image.  So for a 1000 x 1000 (megapixel) image, that's a million times the variables need to be gathered from the sliding window and the formula need to be applied.

Visual Filters:
We wanted to build a filter that would take in a patch of an image, and color the output depending on what the window was centered on.  For example, one color for "human," and another color for "anything else." No one knows what formula would be able to do this; it must be terribly complicated.  But such a function must exist out there, out in Platonic space somewhere.
When scientists want to know what a function is that comes from the natural world, they gather data samples. For example, if you measure the height of a bouncing ball at various times, you can get a pretty good idea of the function that is describing how the ball bounces.  In the same way, if we take a million sample windows and label them appropriately, it helps us to estimate the shape of that complicated hidden function. A shortcut to doing this is to take a bunch of images, create an appropriate label image, randomly take samples from the image, and assign the samples the label from that spot in the label image.
A naive solution to our problem, then, would be the following: slide the window along the image, and at each step, compare what is in the window to every sample you have that is labeled. Find the best match or matches, and assign that label to your result. 
This would work, but the trouble is that the number of patches you would need is so absurdly high that you could never get enough. People can vary in lighting, in pose, in camera position, in appearance, in clothing, in age, in facial expression, and so forth. And even worse than that, the exact same sample from an image might be part of a person's shirt, or it might be part of a blanket on a bed.  Without looking at the surrounding context, you would never know.  So the algorithm needs a way to include context.

Including Context:
This is the really clever bit, in my opinion. For the first step, the program does the naive method, sliding the window and creating that output image by comparing what's in the window at each location to all the labeled samples. But then we go back, and define a new filter, a new function.  This one takes in a window on the image, but also takes in a window from the same location on the previously generated output map. This map is far from perfect, but if even some of the pixels are correctly labeled, that context information can help each patch be better labeled the next time. (Since we have the labeled training images, we know what this map is supposed to look like for some images.) So we do this over and over on the training images, building up maybe five filters to be run in succesion, each time improving the output.
Finally, once we have these five succesive filters, we can run them on new images.  As long as the new images are sufficiently similar to the training images, we can do a pretty good job of classifying every single pixel in that new image.

Details:
Instead of just taking the raw pixel values, we instead compress the information in such a way that it preserves similarity between patches.  This can be done by turning the sample into a SIFT feature, or a multi-scale patch compressed using PCA, or creating features similar to those used by the human visual system (What Serre et. al. call "standard model features.")  This serves two purposes: it lets us get away with fewer samples, and the individual samples don't take up as much memory.

Instead of searching for similar patches directly, we can train a classifier, using a neural net, for example. 

The direct method could be considered a "non-parametric classifier." Of course we aren't just taking the best match, but an average of all the nearby matches weighted by similarity. We can interpolate between them in a more intelligent way, by using anisotropic kernels.
The nice thing about using the data directly is that it enables the program to handle as many classes as we want and to keep throwing in more and more data (until we run out of memory.) This is generally known as "the Google approach."
We could train it using motion data as well, to improve the results on video.

Results:
Two papers about this:
http://frederickfiat.com/doug/papers/

Some images (more to come soon-- check the papers for other examples):
Detecting head, arms, and legs.  This was trained exclusively on sports images.

Detecting salient contours.  This was trained on hand-labeled salient edge images.  The point was mostly to show we could label edge-like features as well as regions.

Detecting trees.  This was trained using labeled images from the LabelMe database.

Friday, November 5, 2010

Summers Stay Hotel

The Summers Stay Hotel, also known as "Booked" is a hotel that is arranged like a library. Room numbers are according to the Dewey Decimal system, or by author's last name and genre, for the fiction section. Every wall of the hotel, both inside the rooms and out, is covered with bookshelves from ceiling to floor.  The front desk looks like an information desk.  There is no pool, but there is a children's room that has sliding ladders on the walls that can be brought up to high speed and crashed into each other (padded, of course.) When you "check out" from the hotel, they allow you to borrow a book for one year, hoping that you will return it the next year for another vacation stay.
The hotel has been so successful the owners are expanding to a cruise zepplin.  "Booked Passage" has rooms of much the same sort, but will slowly float between major university libraries around the world.

It turns out that someone else has had much the same idea, and such a hotel actually exists in NYC: http://www.libraryhotel.com/facts/index.cfm

Tuesday, November 2, 2010

Alignments

One thing about Dungeons and Dragons that really appealed to me was the way it imposed a game structure-- a simplification, an ordering-- on life as a whole.  It allowed me to think about philosophy, character, and story by making it simple enough to approach one piece at a time.  Of course any simplification is a distortion; compression inevitably introduces artifacts.  But the model is at worst merely wrong; without any model our ideas are "not even wrong." The D&D version of philosophy makes falsifiable predictions, so is useful as a starting point for thinking about these kinds of issues.
You see a lot of D&D type simplifying of the world in 1600-1900 European modernist philosophy. It's all binary oppositions and the imposition of an oversimplified order. Since their invention as a kind of small-scale wargame, tabletop roleplaying games have since moved in a more postmodern direction, emphasizing narrative and creativity, areas where they still hold the edge over digital RPGs.

(I am going to use all male examples below, but looking at the difference between how male and female characters in fiction realize these archetypes differently would itself be interesting.)

Lawful Good versus Chaotic Good: I think this is essentially a religious question.  A rational atheist may believe that laws are useful for society as a whole, but at any point his decision to follow a particular law depends on the law's utility. He may recognize that following the law as a default behavior avoids having to make difficult moral computations that can be paralyzing, but if he thinks breaking a law will serve a higher good (even after weighing its effect on society), he will do so. A true anarchist can be chaotic good since he only wants everyone to be equal (an-archy). This is the Superman vs. Batman conflict.

Chaotic Neutral: This is Captain Jack Sparrow, or Coyote the trickster god. His goals are often selfish and he carelessly hurts others; but he is not actively seeking power.  He doesn't actively oppress others. I think a lawful good character would judge that a chaotic neutral character, by not being lawful good, is in fact evil.  Personally, I thought that the point of Pirates of the Caribbean was to make a comedy about alignment. You have lawful good characters who gradually become neutral or even chaotic good.  There are also lawful evil characters, who are fairly rare in fiction, and a lot of the interpersonal conflict is driven by these differences in alignment.

Lawful evil versus chaotic evil: The lawful evil character is an authoritarian.  He wants there to be an order, but he wants it to be his order. A lawful evil character is without mercy, but not without justice.  I think of Javere the policeman from Les Miserables. The chaotic evil character is a monster, a predator. The Joker from The Dark Knight and Grendel fall into this category.

Lawful neutral:  I think a realistically portrayed robot would necessarily be lawful neutral.  For example, the terminator in the first film (despite its glowing red eyes and mean eyebrows) is actually lawful neutral. It appears evil to the characters in the film because the law it is following (its programming) pays no attention to morality, which for a person would in itself be evil (because part of our morality is innate and must be actively rejected.) But for the robot there is nothing but the law.

Here is a pretty good website, if you like this sort of thing:
http://easydamus.com/alignmenthpc.html

All this also brings to mind one of my favorite comics:
http://dresdencodak.com/2006/12/03/dungeons-and-discourse/ and
http://dresdencodak.com/2009/01/27/advanced-dungeons-and-discourse/

Tuesday, September 21, 2010

A singular quote


The "Singularity" is the idea that once we have built an artificial intelligence that is as good at programming (and thinking and invention in general) as a human, then it will be able to invent a still more powerful machine by itself, which will lead to an explosion in AI capability. (For instance, Deep Thought in the Hitchhiker's Guide series.)
Anyway, today I came across this quote which seems to be the earliest expression of the idea anyone has found yet: The Primitive Expounder in 1847.  The author has his tongue-in-cheek, but he is also probably one of the first to worry about allowing calculators in the public schools:
"A Thinking Machine! Yes, we can now have our thinking done for us by machinery! The Editor of the Common School Advocate says—" On our way to Cincinnati, a few days since, we stopped over night where a gentleman from the city was introducing a machine which he said was designed to supercede the necessity and labor of thinking. It was highly and respectably recommended, by men too in high places, and is designed for a calculator, to save the trouble of all mathematical labor. By turning the machinery it produces correct results in addition, substraction, multiplication, and division, and the operator assured us that it was equally useful in fractions and the higher mathematics." The Editor thinks that such machines, by which the scholar may, by turning a crank, grind out the solution of a problem without the fatigue of mental application, would by its introduction into schools, do incalculable injury, But who knows that such machines when brought to greater perfection, may not think of a plan to remedy all their own defects and then grind out ideas beyond the ken of mortal mind!"

Sunday, July 25, 2010

Magic


As I was walking by the banks of the Seine, I saw a woman bend over as if to pick up something from the ground. Through some sleight of hand, she produced a large golden ring and lifted it from the sidewalk.
"Is this yours?" she asked a passerby, a tourist, in accented English. The man shook his head and began to walk on.
"Do you think it is gold?" she asked, handing it to him.  He looked at it casually. It was shiny and brand new.
"I don't know," he said.  "Could be." he handed it back.
"Is too big for me," she said, slipping it over her finger.  It was clearly a man's ring.
 "You can have it," she said.  "I will give it to you.  To remember your lucky day in Paris." She smiled broadly at him.  Her hair was unkempt, and one eye looked off to the side.  But she had a charming smile.
"Thank you," he said genuinely, smiling back, handling the ring.  She walked on a few steps, and then turned.
"Could you give me some money for lunch, maybe?" She asked, her cheeks flushing.
"Sure," he said, and pulled out his wallet.  He handed her a five Euro note. She looked embarrassed but said, "Maybe five more Euros?"
He bit his lower lip, hesitating for a moment, but then handed over another bill.  "Here you go," he said.
They walked on, he more slowly than she.
I knew what was happening and what was going to happen. I have read enough books to know how these things play out. It was only later, on the plane, that I realized that it was probably worth it to him, ten Euros, for a moment with a magician, and a smile, and a shiny ring.

Sunday, June 20, 2010

From a Midrash on Goodnight Moon

"While the source-critical debate over Goodnight Moon never reached the heightened pitch of the argument over the Torah’s multiple authors ... the question of whether Goodnight Moon has one, three or more authors continues to keep scholars up past their bedtime. Can a work that clearly owes so much to the Ugaritic psalm, ‘I see the moon and the moon sees me,’ really have been written by a Manhattan socialite? Most scholars take  Margaret Wise Brown” as stand-in for a postulated committee of at least three authors.
Clearly most of the book consists of a “doublet,” that is, two versions of the same tale repeated. For convenience, we designate the first section, which announced the existence of the objects in the room, as E; the second, in which the objects are greeted “Goodnight room....” is designated G. Yet the repeating motifs of the Cow Jumping over the Moon and the Three Little Bears speak to a separate awareness of European folktales....."

Excerpt from http://www.shmoozenet.com/yudel/mtarchives/pix/Sham05.pdf

Wednesday, June 2, 2010

The Future Affects the Present and Affected the Past

I've been thinking about how many of the struggles of the last few centuries were because of a belief of one form or another in a prediction about the future. There was "Manifest Destiny" in the U.S. There was the establishment of the state of Israel, at the heart of the middle east conflict.  I don't know enough about how the ideas of Nietzsche and Hegel were adopted by the Germans to say for certain, but I have the impression they saw German domination of the world and eugenics as a historical inevitability that they were working out.  Certainly the Communists believed that laws of human nature led inevitably to the conclusion that there would be a revolution and that Communism would eventually encompass the earth.  All of these are beliefs about how the future would necessarily play out, science fictions that profoundly altered the unfolding of history by being widely believed.
The idea of population explosion in the 60s and 70s, Rachel Carson's Silent Spring, current beliefs about global warming-- all these ideas seem to be based on a belief that we can accurately say what will happen, that we can extrapolate.  Not to say that these ideas are right or wrong, just that I find it interesting that the belief that they are right is a powerful force in historical events.

Thursday, April 22, 2010

Poetry as checksums

When you're sending information over a noisy channel, it helps to send an extra byte every so often to make sure what you've sent so far was right.  It occured to me that poetry contains this redundant information, in the form of the rhyming words at the end of lines (or other structural regularities in the text.)  If the words match, you know you remembered the line correctly. This makes poetry easier to memorize and pass down from one person to the next, which was especially important in pre-literate societies.

Saturday, April 17, 2010

Living with a limited brain


Some interesting research has come out recently about the processing capacity of brains. For example, that the medial prefrontal cortex can only handle two tasks at once, or that working memory can only handle about 7 items at a time (but what's an item?), or that when people are actively trying to remember something complicated, their impulse control is reduced. In fact, there has been a lot of research showing that exerting the will to make a difficult decision uses a fuel resource (sugar from the blood) that many of these other tasks also need.
What happens when these resources are used up?  When we have been thinking too hard, or have been under heavy stress, or haven't had enough to eat or sleep, or are trying to remember too many things, or are trying to drive, or need a fix,we fall back on a simpler part of the brain. We lose the ability to think rationally, to choose future benefit over immediate reward; the ability to choose at all is reduced.  We become irritable, forgetful, angry, quick to argue.
I think one way to sell people things is to push them into this state of mental fatigue, so that they are more likely to make impulse decisions.  (Hence the TVs blaring advertisements at Walmart, or timeshare presentations.) I think it would be a good idea to plan our lives with these limitations in mind.  It can be very hard to see it happening to ourselves as it does; it just seems like everything is more irritating.  Other people see it as a bad mood.

Friday, April 16, 2010

Book of Life



There is a curious analogy between paleontology and biblical archaeology.  
In archaeology, you have the ruins of Jericho that can be dug up, and they're basically unchanged: some pieces may have been carried off by scavengers, and all the soft parts have dissolved, but basically the stone has been buried in the desert for a long time, and the archaeologist digs it up and makes guesses about it.
Along with that, the cultures involved are all still alive, still driving world history. So there's another source of information about the cultures that we can get through studying living languages, living cultures, and the text that holds them together.  The text itself has undergone edits, transpositions, errors, but manages to be maintained more or less intact through a process of careful copying and fact checking. 
We can dig up the bones of dinosaurs and make guesses about them, and try to reconstruct them that way.  Or we can look at the creatures descended from them, the birds, and study what has become of bird ways of life. And then there's the text, the bible of the saurischians, their DNA: which has been modified to suit the times, edited, miscopied, but thanks to the error checking molecules still contains in it most of the information about what dinosaurs were like, if we can learn to interpret the language its written in.

Saturday, March 27, 2010

Special effects

I was planning to use "blue-screen" mattes as training data for my computer vision algorithms, and as I was reading up on the history of matting, it occurred to me I had seen this all before: special effects are a pre-digital way of doing things that really ought to be done digitally. It has that same marvelous haphazard cobbled together feel that all the pre-electronic information processing devices did, which are so lovely because you can see how all the parts work, just by looking at them carefully.

Thursday, March 4, 2010

Math Geek Valentines


Roses are red
Violets are purple
HP-48's
Are programmed in RPL



Roses are rose
Violets are violet
Penrose's plane:
Aperiodically tile it


Roses are red
Violets are bluish
Parallelograms
Are rectangles skewished


.

Tuesday, March 2, 2010

moon art

      




Some of my art, created using Fourier transforms.

Saturday, February 27, 2010

Monsters

One of my earliest memories, from when I was three or four years old, is sitting on the sidewalk, looking at the house across the street. I believed that monsters lived there.  These monsters looked like ordinary people (in fact I don't recall having met them personally) but what they were supposed to do was the opposite of what we were supposed to do. Their parents told them to be mean to other people, and not to share, and to mess up their rooms. This last one seemed particularly  unfair, as their job seemed so much easier than mine.
There are a couple of things that strike me now, looking back on that:
1. I thought that cleaning one's room was a key part of moral behavior, and that not cleaning my room was immoral. When I read Seventh Son in junior high, the idea that people who invented things and made artwork were good, and that evil was the Unmaker really resonated with me. I think the two had something to do with each other.
2. At age three I was speculating on the possibility that moral requirements are different for people in other cultures, and that other cultures were monstrous. Even much later, into high school, the explanation I gave myself for the way people behaved towards me was that most people were actually trolls.  This wasn't meant literally, but simply to convey that their minds were as different from my own as another hominid species that would think nothing of feasting on human flesh.
For example: why would they drive past me, a pedestrian, and yell out the window rude comments as they drove by?  I understood, intellectually, that this must somehow be an activity that caused them pleasure, since it caused them to laugh, but I was completely perplexed by it on an emotional level. Or in study hall-- why would everyone want to spend the whole time talking, and have to be repeatedly punished to get them to stop?  Why didn't they want to sit quietly and draw aliens in their trapper keeper? It must be that their minds were organized completely differently than my own. And why did they enjoy anything having to do with sports? They couldn't be wrong in an absolute sense, since they were clearly in the majority, yet it never occured to me that I might be strange, only that I was living in an entire world of monsters. This perplexity kept me socially isolated and unhappy in school a lot of the time.
3. The idea that a rule to mess up your room instead of cleaning it was much easier to live by finally made sense when I learned about entropy when I was about eleven. (Not from school, of course.) Everything wants to get messy, and everything we do to fix it makes things worse somewhere else. The concept fascinated me, especially when I learned about the connections with information theory.

Friday, February 19, 2010

Aggregating risk

I'm sure this is common knowledge for finance majors, but it seemed like a surprising conclusion to me.

Suppose you have the opportunity to take a risk-- the price is $1000, and there is a 1 in 1000 chance of winning $2,000,000.  The "expected value" of this is $2000, but I would still argue that it would be a bad idea for most people to take this risk.  It's hard to come up with $1000, and chances are you would never hit the jackpot your whole life.

On the other hand, suppose you have the resources of a bank at your disposal: $100,000,000. If you played this game 100,000 times with that money, you would win around 100 times.  You would be virtually certain of approximately doubling your money. Your chance of not getting back more than you spent is tiny. It would be very foolish not to take this risk.

Isn't it odd that doing something once is a bad idea, but doing it 100,000 times is a good idea?

(Of course in the real world, risks aren't usually independent rolls of the dice like this but are correlated, which explains how the recent mortgage securities crash was possible.)

Sunday, February 7, 2010

The Country of Engravings

In that country, a system of trade has developed which is unique among the lands I have visited.  I have had to reconstruct the history, as it is no longer remembered, but it seems it must have been as follows:
Certain artists found it convenient to trade their paintings and drawings for shelter and food. This arrangement worked well, and the artists began to make compact and portable drawings that they could carry on their persons, to use for trade in such places as they found themselves.
A certain artist, an engraver by trade, printed up engravings of a popular sort and used these in place of drawings, finding the production of them more simple.  Others found such a system sensible, and they too became engravers, to the point that much of the country was engaged in creating engravings, and very few in the labors that benefit society materially. When the situation had grown untenable, a solution was proposed that a single printer could handle all of the work, freeing up other artists time to spend on gardening and so forth.  This solution was universally acclaimed, and the work was given to one indivdual, in the employ of society as a whole. To further save effort, he chose to only produce a few engravings, though in such prodigous quantities that there were enough for all who desired them. The artwork itself, though very carefully executed, soon grew unappealing through too much repitition, but the system was so much of an improvement of the previous system that few complained.

The Art Notorious

Johannes Trithemius (1462-1516) was an abbot in Germany. He wrote a three volume work entitled Steganographia. On the surface, it appears to be a magic text, demonstarting through the use of prayers, long lists of the names of angels and demons, and tables of astrological data, one can send messages without any possibility of interception. He became a major influence of later magicians and students of the occult. It was only many years later that people realized that his books were ciphertexts-- encoded messages. The lists of names and tables of numbers stood for letters in secret messages.


Another medieval magic text was the Art Notorious, or Art of Memory. It promised, among other things, to give the reader the power to commit to memory any text, no matter how long. This was done by imagining (or actually) walking through a vast cathedral or magical symbol, and at each stop associating the place with the words to be remembered. It also contained this tongue twister that was supposed to be a prayer/spell to give the reader eloquence:

Thezay lemach ossanlomach azabath azach azare gessemon relaame azathabelial biliarsonor tintingote amussiton sebamay halbuchyre gemaybe redayl hermayl textossepha pamphilos Cytrogoomon bapada lampdayochim yochyle tahencior yastamor Sadomegol gyeleiton zomagon Somasgei baltea achetom gegerametos halyphala semean utangelsemon barya therica getraman sechalmata balnat hariynos haylos halos genegat gemnegal saneyalaix samartaix camael satabmal simalena gaycyah salmancha sabanon salmalsay silimacroton zegasme bacherietas zemethim theameabal gezorabal craton henna glungh hariagil parimegos zamariel leozomach rex maleosia mission zebmay aliaox gemois sazayl neomagil Xe Xe Sepha caphamal azeton gezain holhanhihala semeanay gehosynon caryacta gemyazan zeamphalachin zegelaman hathanatos, semach [106] gerorabat syrnosyel, halaboem hebalor halebech ruos sabor ydelmasan falior sabor megiozgoz neyather pharamshe forantes saza mogh schampeton sadomthe nepotz minaba zanon suafnezenon inhancon maninas gereuran gethamayh passamoth theon beth sathamac hamolnera galsemariach nechomnan regnali phaga messyym demogempta teremegarz salmachaon alpibanon balon septzurz sapremo sapiazte baryon aria usyon sameszion sepha athmiti sobonan Armissiton tintingit telo ylon usyon, Amen.
What interests me about all of these magic books is that they actually would have worked. Trithemius's book did send undetectable messages, the Art of Memory did increase the ability to remember, and the spell for eloquence really would have been good practice for speaking.

What they have in common is that they were magic about the mind. Magic words can affect reality, but only by passing through a mind into a body and out into the world. The act of speaking "I do" creates a real and permanent change in the world if spoken during the proper ceremony, along with the rings of binding.

When people say that magic is only an illusion, or a trick, they're missing the point. Creating the illusion in people's minds is the magic.

Thursday, February 4, 2010

My Painting

(Click image to view full size)

 This combines my sketch filter (for the prominent under-drawing), a watershed algorithm (to reduce the number of colors), a brushstroke filter, and a canvas texture.

Sunday, January 31, 2010

Photoshop Bugs

I've been using Photoshop for one thing or another for more than ten years.  It's an indispensable tool. But the lack of any decent competition (yes, I know about Gimp and Paint.net, thank you) has left Adobe with no incentive to improve.  They still add features, but in a haphazard way that leaves the menus not making any sense. The 16-bit processing is restricted in odd ways, so that they include a photo editor with a completely different interface before you even get into Photoshop. Once you're in Photoshop, you can't manipulate the hidden information that is too bright or too dark to be represented within eight bits.
But what really annoy me are the longstanding bugs.  Some of these have been around since Photoshop 4.0 at least (We're now on 11.0, by the old count.) Here are three:

The cursor bug: Sometimes, the cursor tool will change from a circle showing the size of the brush to a cross-hair showing the center of the brush.  The way to fix it is to go into File>Edit>Preferences, and change the Painting Cursors from "Normal Brush Tip" to "Precise Brush Tip."  Yes, that's the opposite of what you want to accomplish.

The color matching bug: When using Image>Adjustments>Match Color, it's supposed to work like this: you select a region from one image, you select a region from another image, and the colors in the second image are bent to match the corresponding colors in the first image.  It works perfectly, and gives beautiful results that would be hard to accomplish by tweaking the curves. The trouble is when you try to apply the remapping to the whole image, by checking "Ignore Selection When Applying Adjustment." When you do this, the colors within the selection change radically.  It comes up with a new mapping, that is always worse than the mapping before the box was checked. I don't care what mapping you apply to the gamut of colors not included in my selection, Adobe: leave them alone, map them all to purple, whatever, I can cope. But the colors that are included in my selection, when I check that box, LEAVE THE MAPPING ALONE.  IT WORKS FINE.

The Anisotropic Diffusion bug: Hidden away as a bullet on an otherwise useless filter (Filter>Stylize>Diffuse) is the anisotropic diffusion filter.  This can be very useful for preventing jaggies when an image is enlarged, or for painterly effects. It basically smooths along edges, never across them. The trouble is, it is applied to a small region (368 pixel by 90 pixel strips) at a time. This leaves an edge which is treated differently between the two regions. It's done for speed and memory reasons.  I think they've improved this one, but it's still present.

My hope is that Adobe will somehow come across this post and fix the bugs.  I've also submitted them to their bug report website. But I'm not holding my breath.

Saturday, January 30, 2010

Six Signs the Circle



     When the Dark comes rising, six shall turn it back;
     Three from the circle, three from the track;
     Wood, bronze, iron; water, fire, stone;
     Five will return, and one go alone.


     Iron for the birthday, bronze carried long;
     Wood from the burning, stone out of song;
     Fire in the candle ring, water from the thaw;
     Six Signs the circle, and the grail gone before.




From the time I first read it, Susan Cooper's The Dark Is Rising was one of my favorite books. In the book, a young boy must find six signs of power in order to stop the advance of the darkness.  At the time, I tried to make my own six signs.  I whittled one out of pine, I glued some plastic jewels onto a gold colored canning jar lid, I scraped a pattern into the glass bottom of a bottle that my dad sawed off for me, and I tried to make another out of a stone ashtray from Pier One Imports. That was a long time ago, and I don't have any idea where those are any more, though I surely never threw them away. I also made a mask from feathers and antlers for my brother Steve's birthday, and included a note similar to the one Will receives in the book from his brother.
My brother David never forgot that I wanted a set of these, and for the last three years has been secretly working on making me the ones you see above (click the pictures to enlarge). These are made from the real materials (or nearly) and were crafted by hand.

Iron:  "a kind of ornament, made of black metal, a flat circle quartered by two crossed lines. It was about the size of his palm, and quite heavy; roughly forged out of iron, he guessed, with no sharp points or edges." This was cut from a cast-iron pan.  Afterwards it was seasoned in the oven, to turn it black.


Bronze: "a quartered circle identical with the one he wore on his belt, but gleaming with the dull brown-gold sheen of bronze." This was made by melting down thrift-store candlesticks in a homemade forge (blown air from a hairdryer helped the fire to burn hot enough.) The molten metal was poured into a plaster mold.


Wood: "Our wood is one which the dark does not love. Rowan, Will, that's our tree. Mountain ash... the skeleton of the wooden piece was left: a clear, smooth circle...there was no irregularity to it at all." This was carved from a piece of rowan, and oiled to make it glow.


Water: "It was wrought of iridescent glass, engraved with serpents and eels and fishes, waves and clouds and things of the sea." This one was made of molten glass poured into a sand mold.  It looks like ice from the shore of a lake.  It broke in the mail, but I fit all the pieces together and am going to glue them.


Fire:  "Gold of several different colors had been beaten together with great craftsmanship to make its crossed circle shape, and on all sides it was set with tiny gems, rubies and emeralds and sapphires and diamonds, in strange runic patterns." This sign is made of solid gold, which of course was impossible, so he cast it out of lead and covered it with gold leaf.  It is very heavy in the hand, but David pointed out that gold would be more than half again as heavy as lead. Around the side are the words in old English "LIHT MEC HEHT GEWRYCAN," which means "The Light ordered that I should be made."


Stone: "this was a natural flint, grown in the Chiltern chalk fifteen million years ago." This was carved from soapstone, which is the easiest stone to carve.

I told David that this was the best present I could think of. Here are some pictures of the making process.  Note that it's my Dad's homemade forge. I think it's a metal bucket with concrete lining the inside, and a hole to blow are in the bottom with the blowdryer.












Friday, January 22, 2010

Artificial Persons




Yesterday, the Supreme Court held that the right to free speech allowed unlimited expenditure on political speech by corporations.  In his dissent, Justice Stevens wrote, “Under the majority’s view, I suppose it may be a First Amendment problem that corporations are not permitted to vote, given that voting is, among other things, a form of speech.
 How can the first amendment be applicable to organizations of any kind?
Corporations were first called "artificial persons" in English courts in the 16th century.  Lawyers had tried to argue that their corporations could not be convicted, because the relevant laws began "No person shall...."
(The documents forming these early companies, by the way, were closely copied in the Mayflower Contract, and some of their language found its way into the U.S. constitution, which has influenced constitutions around the world.)
Adam Smith, with his customary foresight, worried about granting corporations these rights.  The problem was that corporations were superhuman—they tended towards immortality, growth in size, and growth in power. He suggested that laws limit the lifespan of any company.
The rights of artificial persons were first defined in law in regards to property. In the late 1700s, Stewart Kyd defined a corporation:
"a collection of many individuals united into one body, under a special denomination, having perpetual succession under an artificial form, and vested, by policy of the law, with the capacity of acting, in several respects, as an individual, particularly of taking and granting property, of contracting obligations, and of suing and being sued, of enjoying privileges and immunities in common, and of exercising a variety of political rights…."
Around the same time, Thomas Jefferson worried about the potential power of corporations. He tried to add an 11th amendment to ban “monopolies in commerce.” He wrote in a letter to James Logan, “I hope we shall... crush in its birth the aristocracy of our moneyed corporations which dare already to challenge our government in a trial of strength, and bid defiance to the laws of our country.”
But he was soon to see his fears realized. Daniel Webster argued a case for Dartmouth College whose contract the government wanted to dissolve before the Supreme Court, ending with a touching plea for those who loved the small institution. He convinced Justice John Marshall, who wrote, "A corporation is an artificial being, invisible, intangible, and existing only in contemplation of law. Being the mere creature of law, it possesses only those properties which the charter of its creation confers upon it either expressly or as incidental to its very existence. These are such as are supposed best calculated to effect the object for which it was created. Among the most important are immortality, and, if the expression may be allowed, individuality -- properties by which a perpetual succession of many persons are considered as the same, and may act as a single individual. They enable a corporation to manage its own affairs and to hold property without the perplexing intricacies, the hazardous and endless necessity, of perpetual conveyances for the purpose of transmitting it from hand to hand. It is chiefly for the purpose of clothing bodies of men, in succession, with these qualities and capacities that corporations were invented, and are in use. By these means, a perpetual succession of individuals are capable of acting for the promotion of the particular object like one immortal being."
By this point, the analogy had become more than that—it was justified as referring to the individuals who made up the company acting in unison. The rights were expanded to include other amendments again in 1887, in the case Santa Clara County v. Southern Pacific Railroad Company.
The idea has been further developed by later legal scholars.  In the 1952 Harvard Law Review, we find the following:
The conception of corporate personality is a simplification of the processes of thought. Its function is similar to that of an algebraic symbol. A mathematician finds it difficult to carry in his head a complicated expression such as x^2 + a x + b^2; and in order to simplify his mental processes he says to himself, "Let y = x^2 + a x + b^2," and then he uses y in his calculations instead of the longer and more cumbrous expression. So it is with the imaginary corporate personality in legal calculations. The lawyer finds himself unable to solve his problems if he thinks of a corporation not as a personified unit but as a shifting body of shareholders, or even as a real but impersonal entity; and he therefore says to himself, in effect, "Let the corporate personality equal the changing body of shareholders in respect to their relations to the joint property." By substituting the more compact idea for the more elaborate, he is enabled to reach correct results with less mental effort….”
The article also contains this fascinating tidbit:
“The famous dictum of Sir Edward Coke that corporations cannot be excommunicated because they have no souls, is seen to be illogical. This is illustrated by the history of the canon law, from which Coke derived his statement. Thus, Innocent IV held that corporations, or universitates, could not take an oath, or be baptized or excommunicated.”
One danger with all this is that corporations are legally required to work by only one motivation: to maximize the profits of shareholders. The only way Google can get away with the motto, “don’t be evil,” is because they can reasonably argue in court that in the long run, an ethical reputation will lead to greater profits.
The question I'm really interested in is, to what extent are the relevant decisions of corporations made by the executive (CEO), by committees, or (and this is most interesting) by policies and procedures that have been laid down beforehand and the employees are following? In the third case, these companies are acting as essentially programmed robots being treated legally as persons.
Anyway, that’s where the court is coming from.  It will be interesting to see how it all works out.  I can’t help but think that once artificial agents begin to exhibit what seems to be independent thought, that these laws will be applied to them as well. We will have to hope that the ethical basis of such machines is put on a surer footing.

Monday, January 18, 2010

"Pattern Recognition" and "Count Zero"

I reread Count Zero when I was in Athens last month, and it's still one of my favorite books. One thing that struck me was how similar the subplot involving Marly was to the plot of Pattern Recognition (a later novel by the same author, William Gibson.) In both books, a wealthy and mysterious older man hires (with a truly unlimited budget) a stylish young woman to trace the origin of an unusually evocative and eclectic collage. In Count Zero, the creator turns out to be an artificial intelligence residing on an abandoned space station. In Pattern Recognition, the artist is a brain-damaged woman.
What interested me was that in both cases, the mystery, having been traced back to its source, still isn't solved. We don't understand where the creativity in the machine is coming from; we don't understand where the creativity in the subconscious is coming from. We can tell in the novels that it has something to do with the richness of life and the tragedy of death and loss, but beyond that, finding the source of the artwork has just led to the realization that we still can't reach the source of the artwork, and perhaps never will be able to.