Tuesday, April 7, 2015

Lunar eclipse video without star tracker

Last Saturday was a (near) total lunar eclipse. I planned for taking a series of time-lapse photos to make a video of the vanishing moon. 

The weather is cooperating and the time-lapse was done successfully. I ended up with a decent amount of pictures. To make a video, I used my favorite free software - Windows Movie Maker.





Making video is easy. I pre-cut photos into 16:9 and just import all the pictures and change the Duration to 0.1s under the Edit tab. But the resulting video is bad. The moon appears to be jumping across the screen (need to view in full screen to see).



I realized that the moon is traveling faster than I expected and my time-lapse interval of 15s is way too long.

I wish my camera can turn along with the moon. But this is not possible after the fact. And a decent star tracker costs hundreds of dollars. Not something I am willing to invest in.

Time for some damage control. I realize I am anyway throwing away resolution when down-sampling pictures to 1080p. So why not use the full resolution and crop the picture such that the moon appears to be moving slower?

In order to do that, I must not be cropping constantly the same offsets as I need to account for the movement of the moon and "slow it down" (Essentially "zoom and pan"). Typical batch cropping tools like IrfanView isn't up for the task. I will need a command line based utility.

If it was back in the college days, I would go with netpbm but things have changed. After a bit of googling, I decided on ImageMagick. The syntax is fairly straight forward:

convert {width}x{height}+{x}+{y} {old file} {new file}


I decided 800x480 is the size I would use. So I just have to experiment with the x, y offsets. I decided to generate a script using my language of choice:

main()
{
    int x = 330;
    int y = 390;
    int p;

    for (p = 9021; p <= 9219; p++) {
        printf("convert -crop 800x480+%d+%d ../DSC0%d.jpg %d.jpg\n",
            x, y, p, p);
        x += 16;
        y += 12;
    }
}


Here is the final video. I guess I am happy with the effect: