The two-weeks-late back-from-holiday post

Almost three weeks late now. Oh, well.

We were in France with my parents for a week, followed by a week in the Netherlands. It was hot. We did very little, and had a great time doing so.

In The Netherlands, we spent two days at De Efteling, a theme park with a focus on fairytales. This is where we discovered that Fiona is as much of a thrill-seeker as her big brother. There is a rollercoaster called the Pegasus which has no height restrictions. It doesn’t have any loops in it, but it rattles around at a fair clip. Fiona looked kinda worried while we were on it, and when we disembarked, I asked her if she was okay.

“That was fun,” she said.

“You want to do that again?” I asked.

(Breathless) “Yeah!

Some random notes that I had meant to flesh out into a coherent narrative, but which seem a lot less pressing now:

  • I’ve known intellectually that booze is cheaper on the Continent, but for some reason it was only on this trip did this sink in properly. Holy shit! Even good single malt whisky is cheaper in Euros than it is here in its country of origin in Pounds. Having to pay even £4 for a bottle of quaffing wine now feels like a stiff gouging.
  • The Van Der Valk hotels we stayed in in Belgium and NL (Charleroi and Heerlen, respectively) didn’t have air conditioning. I don’t know if this is consistent across all their hotels, but bear it in mind if you decide to stay there when the temperature is in the mid 30s.
  • If you’ve got kids, consider getting a suite at the Van Der Valk hotels instead of just a double room with extra beds. They’re not much more expensive, and the extra space is fantastic. (Thanks, mum & dad!)
  • If you want to go to De Efteling when it’s quiet, choose the hottest days of the year. The park is thoroughly bedded into the surrounding forest, and all the waiting areas and walks between attractions are shaded by old trees. It was about 37C when we were there, and it was hot but bearable.
  • Dutch radio is chronically insipid. You remember the 1980s? They didn’t go away–they just retired to the Netherlands. In fact, I think Dutch radio stations are required by law to play at least one song an hour by either
    1. Billy Joel,
    2. Sade, or
    3. Simply Red.

    Bring your own CDs, or end up with MOR-induced psychosis within three days. Your choice.

  • Dutch doctors are wonderful. With the enormous heat, Alex ended up with a bad case of dehydration diarrhoea…and that’s all I’ll say about that.
  • Small local bakeries. Mmmmm, breeeeead.

That last point brings me round to the post-holiday diet: when we got back home, we looked at the photographs of ourselves and went, “bleah.” We’ve been living a snack-food rich lifestyle for too long, and it is time to cut back. Back in 1999, Abi and I both did a simple, low-calorie diet for a few months, and it was very successful for us. We’re doing the same thing this time round as well: we’re targeting 1500kCal a day, which should result in a loss of about 0.5kg a week.

Immediately after the holiday I was up at 80kg, which is heavier than I’ve ever been, and I really would like to get down to 70 and stay there. It’s a long-term project. In fact, it’s not so much a project as a lifestyle switch: once we’re down to our target weights, we have to stay there, and not slip back into old habits. Right now, the diet (for me) consists of a bowl of cereal for breakfast, a sandwich for lunch, and a pretty normal dinner. Fruit inbetween. I don’t drink coffee, so I don’t have a latte habit to deal with.

For the first few days, I spent a lot of time between meals thinking about the fact that I wasn’t eating, but that went away pretty soon. Now, a few weeks on, and I’m feeling pretty good about eating less and better. My weight is down, I’m feeling less bloated and sluggish. The food I do eat, I’m enjoying more. Also, Judging by my weight fluctuations (we’ve been weighing in every morning, and keeping a chart), I even seem to be able to cope with the odd diet malfunction (of the round, cheese-covered kind). So I’m not even feeling completely deprived of my favourite foods. Just not as a daily habit–only as an occasional indulgence.

Oh yeah, there’s some holiday photos, too. (More on Flickr: 1, 2, 3)

Alex sitting at a cafe in Castres, France

Fiona at De Efteling

Fiona and Alex deep in thought at De Efteling (watching Longneck)

Alex near (and in) a fountain in Castres

Alex with Pardoes at De Efteling

Fiona in the back garden in Mazamet

Fiona in a playground in Heerlen

Wiggle stereoscopy – a new approach

1. Introduction

If you’re never come across Wiggle Stereoscopy before, you should go straight over to Jim Gasperini’s web site. I first came across his images via BoingBoing a couple of years ago, but was reminded of it the other day by a link on Blog-Fu.

The technique gives an illusion of 3D by showing two images in rapid alternation: one from a left eye, and one from a right-eye perspective. Essentially it is separating the two pictures in time instead of space as is normally the case. You don’t need to wear special glasses to see the effect, and the illusion of dimensionality can be quite striking.

All of the 3D wiggle images I’ve seen on the web have either been animated GIFs, or Flash movies. These techniques have some disadvantages, though: animated GIFs are limited to a 256-colour palette, and using GIF compression for photos can result in large file sizes. Also, you need special programs to produce animated GIFs and Flash movies–you can’t just use plain ol’ Microsoft Paint.

However, I have come up with a new technique for showing wiggle stereograms on web pages, using only standard JPEG images, and a little sprinkling of Javascript. Using JPEGs gets around all of the limitations noted above, although it does introduce a few of its own. See for yourself if you think it’s worthwhile.

2. Wiggle it…with Javascript

The first step is to obtain a stereoscopic pair of photographs: two pictures of the same subject, taken a couple of inches apart. (I’ll describe how to make such a pair of photos with an ordinary digital camera in section 3.)

Alex image: right eye  Alex image: left eye

Next, using any graphics program you like, stitch these two pictures together side-by-side in a composite image of the same height, but exactly twice as wide as the originals. Then save this as a JPEG file.

Stitching two images together

In your web page, reference the composite image as you would any other picture, but give it a class attribute of “wiggle”:

<img src="http://www.sunpig.com/martin/images/2005/12/wiggle-alex-composite.jpg" class="wiggle" alt="Alex stereogram" />

Next, download the script file wiggle.js (version 1.2), and reference it in the head of your web page:

<head>
<title>Wiggly example<title>
<link rel="stylesheet" type="text/css" href="css/styles-site.css" />
...
<script language="javascript" type="text/javascript" src="js/wiggle.js"><script>
</head>

When executed, the wiggle script runs through the web page looking for images with the “wiggle” class. If it finds any, it replaces each one with a <div> element that is exactly half as wide as the composite image. It then uses the composite image as the background image for the <div>, so that you only see one half:

Replacing the composite image with a div

To perform the animation, the script simply switches the position of the background image every 120 milliseconds so that the visible part becomes hidden, and vice versa. (I chose 120 milliseconds because watching the effect at this speed felt right to me. There is no special significance to this frequency.)

Toggling the background image position

Assuming you have Javascript enabled in your browser, the finished product looks like this:

Alex in 3D!

Update (27 Dec 2005): Because of some problems with how Internet Explorer deals with background images, I have changed the underlying code slightly. Using the script is still just a matter of dropping it into your HTML page as described above, though. The new version (1.2) is available here.

The advantages of this method over using animated GIFs or Flash movies are:

  • No additional software required. Any image program that produces JPEGs will do.
  • You can use a full colour palette.
  • The file size will generally be smaller than the equivalent animated GIF. How much smaller depends on the compression settings you apply to the composite JPEG.

The disadvantages are:

  • It is Javascript-dependent. Without Javascript, you will just see the composite image, not the animation. This means that you won’t see the animation show up in any RSS feeds. Also, although I’ve tested it on modern versions of Firefox, IE, Opera, and Safari, the script will inevitably be incompatible with some browsers.
  • If there are lots of animations on the page, of if your browser is taking up a lot of memory and/or CPU time doing other things, the animation may judder.
  • Depending on your connection speed, you may see the composite images before the script kicks in and converts them to animations. There are ways around this, but for the benefit of simplicity, I’m presenting the wiggle script just the way it is.

Whether this trade-off is worth it, is up to you.

3. Some notes on taking stereoscopic pictures

It doesn’t take much hunting around on the web to find custom 3D camera solutions that you can either buy or build yourself. The traditional cheap-ass, lo-fi alternative is to find a stable resting point, and move your camera a couple of inches between snaps. However, if you have a camera with a high-speed continuous shooting mode, you have yet another option: hold the shutter button down, and let the camera take a stream of pictures while you gently move sideways.

The sideways slide

Better, though, is to move the camera in a slight arc, so that you keep a central point in focus:

The curved sideways slide

In ultra-high-speed continuous shooting mode, our Konica Minolta A200 takes 10 frames per second at a resolution of 640 x 480 (for up to 4 seconds). This produces up to 39 pairs of images (more if you also consider non-adjacent pictures), and often some of them are suitable for using as stereoscopic pairs. It’s not a particularly reliable method, but it’s an option. It can be quite useful if you’re trying to photograph moving targets (e.g. children) that are likely to zip half-way around the room in the time it takes you to reposition your camera for a second shot.

Keeping the camera moving in a graceful horizontal curve with no vertical travel is the really hard part. I’ve found that I get a steadier stream of images if I put the camera strap around my neck, and hold the camera out with both hands until the strap is taut: this stabilises the camera by anchoring it to my body, rather than just relying on my shaky hands.

Whichever method you use for getting your stereoscopic pairs, here’s a tip for producing images with the most striking 3D effect with the Wiggle technique. Try to capture a scene with three layers: foreground, centre, and background.

In the diagram below, points A and B are in the foreground, C is at the centre, and D and E are in the background.

Capturing a scene: foreground, background, and centre

When taking your pictures, try to angle the camera so that the central point stays fixed at the centre of the image:

Capturing a scene: holding the centre fixed

By keeping the central point fixed, the foreground and background points will be parallax-shifted in opposite directions: the background will appear to have moved from left to right, and the foreground will appear to have moved from right to left.

Capturing a scene: parallax effects

In the image below, the trees and fence are in the background, the white rose is in the foreground, and the dying fuchsia bush is at the central point:

Our back garden

Having the foreground and background move in opposite directions seems to be key to the visual effect: your brain somehow perceives this as “correct”, and compensates appropriately for the lack of real dimensionality. Also, an object at the central point provides an “anchor” for the entire image. Stereoscopic pairs where the central point is unoccupied (even though, geometrically, it is still present in the picture) don’t seem to be quite as vivid.

4. Wrapping it up

I’ve had great fun playing with this technique over the weekend. I hope I’ve shown that producing this neato 3D effect can be done with nothing more than a digital camera and the basic graphics programs that are (most likely) built in to your computer’s operating system. If you decide to play about with it yourself, leave a comment below so I can come and have a look at your pictures!

Tousle-headed girl

Fiona

Some of Fiona’s favourite phrases right now:

  • I’ll do it!
  • Mess! (After wiping her snotty nose on your shoulder)
  • Story please!
  • Stop it!
  • Nona good guy. Alex good guy. Mama good guy. Dada good guy.
  • Yah-voo (“love you”)

Fiona Walks!

Fiona has been cruising for months now, and walking hand-in-hand with us for a few weeks. While we were in France, we were tricking her into walking the odd step on her own. But today she finally decided that she was going to do the walking! (Click the picture for a 2MB video clip.)

Fiona walks!

Yay Chuffy!