Monthly Archives: October 2010

Seam Carving for Content-Aware Image Resizing

Resizing an image can be problematic. If you want to make an image larger then you run the risk of creating grainy images with visible pixels. If you want to make an image smaller then you are condemned to lose detail and make features too small to be seen.

Take this image of a bubble. Making it smaller would make the detail invisible; making it larger makes individual pixels too large.

But what if there was a way to remove only the “boring” pixels? Just the ones that do not contribute to the overall image? That’s what Seam Carving for Content-Aware Image Resizing does; it picks out the pixels with the lowest “energy”, those with the least difference between them and their surroundings.

These are the pixels from the image above that the LiquidRescale seam carving plugin for GIMP thinks are the least interesting:

Removing them leaves behind the most interesting pixels:

Which can then be combined into the final, resized image. In this case the image has been shrunk to two-thirds of its original, horizontal size.

Results can be very impressive:

This is why you always put a 1kΩ resistor in series with an LED

It’s always a good idea to wire a 1kΩ resistor in series with any LEDs you use in order to limit the current, and this is why:

Usually the resistor just burns out, but this LED was entirely different – it split right in half! I’m still not quite sure why, but Occam’s Razor states that it’s more likely to be a manufacturing defect rather than some new phenomenon.

Thanks to my colleague PAS for bringing this to my attention.

Heavier going up, lighter coming down

If you’ve every felt a little bit heavier in a lift going up, or a little bit lighter in a lift coming down, you’re not imagining it.

Imagine standing on a set of scales in a lift. The Earth pulls you down onto the scales and the scales push back on you with an equal force – that’s the force that the scales read.

Einstein’s equivalence principle, part of the framework of general relativity, is that it is impossible to tell the difference between acceleration due to gravity and acceleration due to an external force*. If the lift is accelerating upwards this must be because a force is exerted upon the lift in an upward direction and as this is in addition to the force of the scales pushing upward, you feel heavier.

Some of the world’s fastest elevators, those found in the Taipei 101, go from stationary to 60 km/h in sixteen seconds, which means they accelerate at 1.05 m/s². When this is added to the acceleration due to gravity (9.81 m/s²) it increases the weight of an object by just under 11% – an 80 kg man would feel like he had a mass of 89 kg. When decelerating, the opposite is true – an 80 kg man would feel like he had a mass of 71 kg.

If the lift was accelerating downward quickly enough, at 9.81 m/s², then the person inside would feel completely weightless. This is how weightlessness is simulated in aircraft, accelerating downward in a powered dive at the same rate as gravity.

* Einstein’s equivalence principle is actually about the difference between inertial mass and gravitational mass but the difference isn’t particularly important here.