Life is never fair. Some of us have too much hair, some too little, most have hair in places where we don't want it to grow. How do you get rid of undesirable hair? Bleach it? Shave it? Pay someone for the sadistic procedure of waxing, slow-torture tweezing, or peculiar and painful threading? You cry, you scream, you pity yourself for paying money for this suffering. Yet, you are still in luck if you are spending only tens or even hundreds of dollars on this tiny semi-visible nuisance. A number of years ago I had the "honor" of participating in a hair removal procedure that lasted weeks and cost around $10,000.
It was for the supporting character role in the movie “Stuart Little.” The cat character. And the unwanted hairs were his whiskers. We, the special effects crew, had the task of helping the cat to meow a couple smart sentences. For this, an eloquent talking mouth had to be rendered on top of the cat's real mouth and computer generated whiskers had to be animated and "painted" on the sides of the animated mouth. The problem was that the cat's true whiskers stuck out from behind the new animated whiskers. They had to be removed.
As you may imagine, there were suggestions of cutting the whiskers of our cat actors or painting them orange. But whiskers, unlike fur, will not grow back and they actually provide an essential survival feature, helping cats to assess their surrounding space. So, we were stuck searching for thin, semi-transparent, long evasive sticks in every image of the talking cat shots. 24 images per second x 10 seconds x 5 shots = 1200 images! In each one we had to detect something that was hardly visible, remove it and paint back the obscured, rich fur texture. Sounds complex just for whiskers. Especially since the cat does not even have a chance to win an Oscar.
The reason why this all had to look perfect is that each such picture is projected on a giant movie screen so that every pixel is blown to 1 inch by 1 inch square and imperfections magnified and noticeable. Remember this before allowing anyone to take your close-up intended for a large projection. Especially, if you have unwanted facial hair. We tried to erase whiskers from each image by hand: too slow. We tried algorithms that walk the image as a map and detect “mountains” or “ridges” in the image – whiskers were hardly separable from the fur. After a week of experiments we found a solution. First, apply color contrast adjustment to each image to emphasize the whiskers. Then, use a special technique to find the motion of each whisker part from frame to frame. The whisker regions were then automatically erased and a picture of a clear cat's fur substituted underneath. This painted piece of fur was propagated from one image to another by the same motion. And the final touches were done with a Photoshop style brush. One cat, three people, two weeks of work, lots of hairy math ideas. And less than a minute of a screen fame.
Would you like to read something different from The Math Mom? Perhaps Woody Allen, leftovers and math of school lunches.