Frame interpolation for timelapse, using Julia

A long time ago I wrote a python utility to interpolate frames for use in timelapse. This project was timelapse.py.

Back in 2014 I ported the idea to the very-alpha-level language Julia.

In recent weeks Julia released version v1.0.0, followed shortly by compatibility fixes in the Images.jl library.

And so I’m pleased to announce that the julia implementation of my project, timelapse.jl (working simply off file mtimes without reference to exif) has also been updated to work with julia v1.0.0 and the new Images.jl API.

Usage:

zsh/scr, photos 11:32AM sunset/ % ls *
images-in/:
med-00001.png med-00022.png med-00065.png med-00085.png
med-00009.png med-00044.png med-00074.png

images-out/:

zsh/scr, photos 11:32AM sunset/ % ~/j/timelapse/timelapse.jl 50 images-in images-out
[1.536147186333474e9] - Starting
[1.536147186333673e9] - Loading modules
[1.536147201591988e9] - Sorting parameters
[1.536147201648837e9] - Reading images from directory [images-in]
[1.536147202022173e9] - Interpolating 50 frames
[1.53614720592181e9] - frame 1 / 50 left=1, right=2, prop=0.11999988555908203
[1.536147217019145e9] - saving images-out/image-00001.jpg
[1.536147218068828e9] - frame 2 / 50 left=1, right=2, prop=0.24000000953674316
[1.536147222013697e9] - saving images-out/image-00002.jpg
[1.536147222819911e9] - frame 3 / 50 left=1, right=2, prop=0.3599998950958252
[1.536147226688287e9] - saving images-out/image-00003.jpg

...

[1.536147597050891e9] - saving images-out/image-00048.jpg
[1.53614761140285e9] - frame 49 / 50 left=6, right=7, prop=0.880000114440918
[1.536147615090572e9] - saving images-out/image-00049.jpg
[1.536147615649168e9] - frame 50 / 50 left=6, right=7, prop=1.0
[1.536147619363807e9] - saving images-out/image-00050.jpg
[1.536147619960565e9] - All done
zsh/scr, photos 11:40AM sunset/ %

zsh/scr, photos 11:51AM sunset/ % ffmpeg -i images-out/image-%05d.jpg -qscale 0 -r 50 sunset-timelapse.mp4
ffmpeg version 3.4.2-2+b1 Copyright (c) 2000-2018 the FFmpeg developers

...

zsh/scr, photos 11:51AM sunset/ % ll -h sunset-timelapse.mp4
-rw------- 1 tim tim 4.9M Sep 5 11:46 sunset-timelapse.mp4

A Bit Damp

Another Friday evening, another great way to end the week with a camera in hand. As I finished up work, wondering whether to mow the lawn, I looked out the window and saw awesome clouds zipping past.

Grab camera, grab Dog, go walkies and shoot whatever happens. There was rain. There was sun.

And after the rain, the sun illuminating the gently undulating crop fields contrasted amazingly with the remaining ominous clouds beyond.

Simple undulating rural countryside – with dramatic clouds above.

Exploring Strathearn

I spent a happy evening exploring the Quoig area in Strathearn – the floodplain of the river Earn between Comrie and Crieff, south of the A85. Disused railway line, Sir David Baird’s monument and a luscious sunset. Can’t complain 🙂

 

Focus-Stacking with the Fuji X-H1

For years I’ve been a fan of superresolution – taking multiple images of a scene with subtle sub-pixel shifts and upscaling before blending to give a greater resolution photo than any one source.

One of the features I used occasionally on the Pentax K-1 was its pixel-shift, whereby the sensor moved four times around a 1px square; this gives an improved pixel-level resolution and full chroma detail at each point.

Having exchanged that for the Fuji X-H1, I still look to perform super-resolution one way or another. Hand-held HDR always works – in this case even better than either the K-1 or the X-T20 because the X-H1 permits 5 or 7 frames per bracket at ±2/3EV each, which is ideal.

But I thought I’d experiment with a different approach: focus-stacking. This way, the camera racks the focus from foreground to background in many fine steps. Keeping the focal-length the same, the effective zoom changes subtly between successive images. Essentially, where hand-held HDR varies the position stochastically in an X-Y plane, focus-stacking means pixels from the source frames track a predictable radial line in the superresolved image.

The X-H1 has focus-bracketing but leaves the blending up to the user in post. That’s OK.

First, an overview of the scene:

Scene overview: Fuji X-H1, 18-135mm lens at 127mm, f/8 narrow DoF

The X-H1 made 50 frames, focussing progressively from front to back. These were blended using enfuse:

time align_image_stack -a /tmp/aligned_ -d -i -x -y -z -C [A-Z]*.{tif,tiff,jpg,JPG,png}
time enfuse -o "fused_$base" /tmp/aligned_* -d 16 -l 29 --hard-mask --saturation-weight=0 --entropy-weight=0.4 --contrast-weight=1 --exposure-weight=0 --gray-projector=l-star --contrast-edge-scale=0.3

The results are a little strange to behold – while the effective DoF is much increased (the distant wood texture is clear) the rock detail is quite soft; I suspect some of the above numbers need tweaking.

However, with a bit of work – both enhancing the local contrast and using in-painting to tidy up the rock itself – a pleasant image emerges:

The final polished result: banded rock on wood, Fuji X-H1

A definite improvement. I may have to use it in my landscape work a bit 🙂

Gear Change Time

Back in May I had a bit of a holiday. Figured the primary camera would be occupied taking timelapse video sequences for a couple of the evenings, and what happens if I find something else to take a photo of? So a friend suggested I get a Fuji X-T20.

Loved it.

Sold the K-1 dSLR and all the other Pentax kit, bought a Fuji X-H1 and some nice lenses to augment it.

Having spent all last Friday having the day off for the purposes of swapping the gear, I called in at Portknockie to make some photos of the well-known Bow Fiddle rock. The tide was low, requiring more care scrambling over the rocks.

Getting a bit more artistic, a long exposure view of the clouds passing by and a toned and tweaked edit:

The Zeiss 12mm f/2.8 Touit Fuji X-mount lens is a beauty. Being for APS-C crop-sensor only, it’s comparatively small, but elegantly formed with the curves flowing from lens-hood to body where the aperture and focus rings are smooth rubber perfectly integrated into the body.

I still maintain the most interesting views are to be found within the caves beside Bow Fiddle, not just staring at the lump itself. This is the first test image made with the Zeiss lens – sitting inside one of the caves, looking out, an HDR composite of 5 frames ±2/3EV each and even so it took a delicate touch getting the best RAW conversion and blend (haven’t used LuminanceHDR in ages!).

Testing my newly acquired Zeiss 12mm f/2.8 Touit lens – inside one of the caves looking out, of necessity a 5-shot HDR ±2/3EV. That lens is awesomely sharp, even with slightly elevated ISO around 640-1600.

Finally, one to relax with: the most serene simple composition of blue-grey sky with warm crepuscular rays spreading from behind a cloud. Light and sea, what more does one need?

Beautiful simplicity: a very cool blue-grey sky with orange crepuscular rays in the distance.

West Woods of Ethie

It was one of those crazy late-spring days with a clear divide in the weather – everywhere north of the highland boundary fault was meant to get extreme precipitation, while Fife and Angus remained cool and dry. So we walked for a while in the West Woods of Ethie, admiring the lines and shapes of tall beech trees and subtle light and shade under the canopy.

Aberdeenshire Coast: Catterline

I’d never really explored much of the Aberdeenshire coastline. On Saturday, however – feeling liberated from EV range anxiety – I discovered Catterline, just south of Fowlsheugh and Dunnottar. Towards the end of a beautiful sunny day, with just enough low golden light on the landscape… I had to fly the drone a bit, too.

The coast enjoys many large rocky outcrops (all conglomerate for a few miles around):

Perhaps my favourite shot is one of the more unusual by my standards: quite a thought-out composition of receding layers of rock, with the cliffs behind casting a huge shadow mid-way up one of the rocks, with Todhead Point lighthouse in the distance – near and far, light and dark, mankind and nature all rolled into one:

Todhead Point Lighthouse from Catterline Bay

Not bad going for the little Fuji camera; having set it to f/16 for depth of field, I’m surprised it chose exposures 1/52s and 1/26s at ISO 1600 and 1/60 at ISO 1000 for its HDR bracketing, but the results are excellent, no noise problems even in the shadows.

To finish, a simple statement of peace: nothing much, just sky above, a gentle disturbance in the sea below; all is calm, all is blue:

Peace: blue sky, blue sea

Birks of Aberfeldy

A few weeks ago, I spent a happy Saturday afternoon strolling around the Birks of Aberfeldy, testing the newly acquired Fuji X-T20.

For context, a general landscape of the lower end of the gorge with the Moness water flowing around rocks and pebbles in the riverbed:

The Moness river flowing over rocks and pebbles

For consistency, everything else was shot coupled with the Helios 58mm f/2 lens using the Acros+Yellow black&white film emulation mode and ISO 200.

Some abstract tree foliage patterns:

Details of tiny flowers closeup:

Of all the mini-waterfalls up the left side of the gorge, I’m particularly fond of the way the water flows over the moss on this one:

Statue of Robert Burns sitting on a bench:

Scultpure of Robert Burns sitting on a bench at the Birks of Aberfeldy

Shortly after these photos were made, the heavens opened – a huge cumulonimbus cloud the shape of the Starship Enterprise disgorged itself over a lot of Highland Perthshire, flooding the roads in Aberfeldy itself; as I was walking down the north side of the gorge, it was quite disconcerting feeling the sandy gravel getting washed away in the channels underfoot. Fun fun!

A brief flirtation with electric vehicles

The world of EV ownership is fraught with systemic problems, chief among which being range anxiety. Actually – it’s calling it range-anxiety that’s the problem; concerns about range are very legitimate. Some of the biggest sources of friction between EV enthusiasts and skeptics are the assumptions that an average commute distance is a meaningful quantity; that people should be prepared to plan their driving around charging points; for longer trips to less over-populated areas where the distance between chargers is an appreciable proportion of the battery’s range, either ignore the risk of being stranded or swap to diesel (an admission that EVs aren’t up to the job yet).

If that’s all I said, I’d just be trolling. But I put my money where my heart was.

40kWh => 150 WLTP miles was the barest minimum range I could consider for my driving (mostly photo-hunting expeditions). Christmas and New Year were spent oogling pictures of shiny interiors online. Caught the bug.

She was called Aoife. Aoife the Leafy. Aoife the brand-spanking-new Leaf 2018-model Tekna-with-extra-bells-on spec shiny green Leafy for which I fairly emptied the personal piggy-bank back in February (when they’d only been G/A for a week) and gained keys-in-grubby-paw at the end of March.

Three days later we’re back. Would help if they connected both ends of the brake light cable. Would also help if they’d enabled the SIM card.

There followed 4 weeks of blissful silent driving. 7kW charger installed in the garage. Solar panels providing free miles. We went places: Argyll and back (scary when the weather changed and the battery got low); Kingussie and Alvie; Livingston and Tillicoultry; twice-weekly trips to nearest town and back – the closest I have to a mythical “commute”.

On May 4 we set sail for a round trip of down-south-shire™, got as far as Abington, tried to use an Ecotricity charger, bang, whole EV system dead.
Much of that day was spent walking Dog in a field behind Abington services whilst organising RAC, Nissan and RAC car hire on the phone.
Needed flat-bed all the way back to the dealer – Dog in Aoife’s boot with the windows dropped as we travelled north on a sunny day while I panicked about him all the way from the front cab. Second set-off was 6.5hr later than intended but we made it to Sussex with 3mins to spare before midnight. Vauxhall Ashtrays really do suck – that one was named the Chemical Toilet for the stench of Domestos. We did 1079mi that weekend in it, though.

Relay in the battery gone bing.

Over the subsequent 3 weeks the dealer decided their own screwdrivers were insufficient so it was taken to Edinburgh for major works; on the way there or back the haulage company dented the wheel-arch trim with the webbed rope, which took another week for the dealer to fix.
On May 25, in time for the second bank-holiday weekend, I collected Aoife from the dealer, got not even 30mins up the road before the ProPilot went bing as well.
Back to the dealer, this time with Dad in tow to lend a little clout.
My end-May holiday week in Caithness was spent, not gliding around serenly from planned charger to planned charger, but polluting the planet a petrol auto Juke, being the only thing the dealer had to offer at short notice.

On return from the wilds up North, the dealership were understanding; the sales manager suggested redoing the whole order from the top, create a new Aoife, try again and do it right this time. Either that or refund the whole lot. Those were my top two options as well.
Then the lead-time exploded from “6-7wk” to “Oct/Nov”.
At this point, rumours abound of next year’s Leaf including a 60kWh model which is far more attractive.

I negotiated with Nissan HQ directly concerning a “soft Breggsit” that would see me slide from Aoife to next year’s Leaf ASAP but the best package they could offer had no certainty – would require 4 dice to land 6s for satisfaction, including it not going bing again in the meantime; they wouldn’t be drawn whether it would come in a 60kWh version or not. In short, nothing I couldn’t do better by stepping away and approach whole market fairly afresh next year.

So that fell through, and a couple of days ago (after 6wk in the bad Joke, and more importantly after only having driven Aoife for 4 out of 14 weeks “ownership”) I finally signed the paperwork for a buy-back. (That’s what they call a refund where they tell you they’re retaining half your original deposit as the cost of ownership for the two “months” that you’ve “had” the car.)

That’s the story. My first ever brand-new car. My first EV. My first time of rejecting a car for being both unreliable and not really adequate after all. All in one. What would normally be a 3- to 4-year ownership cycle speeded-up 12x in so many months.

Today we collected Smith – back to a Hyundai diesel i30, which works – named for the agent who takes 3 movies to fleetingly escape the Matrix. Next year I shall reassess the market; Nissan can just compete alongside everyone else.

A little more on the systemic side. Here’s what I’ve learned.

1) People expect to be able to load up a car with range-reducing 8l of water, food, spare windscreen squirter juice, range-reducing weighty cameras and throw the range-reducing dog in the boot and go away exploring for a few days. Doing our own thing, where we like, when we like, not refuelling too often nor too long. Not subjecting the dog to undue stress in the process. Best not to try and persuade people they want otherwise.

2) Someone needs to consider the privacy aspect of these remote control apps. By tracking its location, I now know which panel-beater company was used and where a technician lives.

3) The specifics of each adventure pale into insignificance compared to a whole ownership experience. The good old-fashioned qualities of customer service and reliability are invaluable.

3b) All the humans involved have been pleasant and helpful and well-meaning, making the right decisions to keep me rolling one way or another – but somewhere along the line there is institutional inefficiency with things taking way too long to process.

4) There are features and there is marketing. ProPilot is something and nothing – together it’s a new marketing word for Level 2 autonomy but in reality it’s nothing more than adaptive cruise-con with lane-departure warnings and nudges, only good for motorways, and when it goes wrong you’re just as scuppered as when anything else goes awry. More notably, the electric seats missing from the Leaf’s specs table are the exact same electric seats you could’ve had in an ICE vehicle 10yr ago or more; ditto the sunglasses holder in the ceiling that isn’t there but has been standard for a while. Likewise the adaptive cruise-con is nothing new. These things are all worth 1 tick in the box on the spec-sheet, no more. Beware the marketing kool-aid; shop with a very level head.

 

Twilight

Some more tests of the Fuji X-T20 in low light conditions.

Summer has the worst daytime light for photography with harsh shadows and washed-out pale tones; however I love the night sky with its permanent twilight (at this latitude) giving cobalt blue sky with hints of the sun’s warmth just below the horizon.

Plus it’s more comfortable than winter astrophotography 😉

Three studies in cloud structure – nature’s abstract patterns and a tiny blob of light of a hamlet across Strathearn:

Continuing the anthropocene-influence theme, glorious blue, red and pale clouds in an orange-tinged sky against a tiny pylon breaking the horizon:

The Pylon

The Pylon

 

 

Waterfalls and Mountains

We spent Saturday afternoon driving around the Tay Forest Park – up to the Mains of Taymouth at Kenmore for lunch then along the south Loch Tay road to the Falls of Acharn – a comparatively steep climb up the side of the gorge and negligible water in the falls, but there was pleasant subtle light making the most of the colours on the surrounding rocks:

Nice rocks (typical Highland semi-pelite) covered with colourful beech leaves and green moss. Shame they’d forgot to turn the water on…

Next stop: just outside Ardeonaig there is a tiny layby where the view of the southern end of Loch Tay opens up. There was pleasant light on the sides of Ben Lawers too:

Still a favoured viewpoint right by the side of the South Loch Tay road – lovely soft mountainside illuminated by gentle light and shadow.

Driving further down the road to Killin, there was an awesome cloud inversion flowing around Ben More in the distance, outside Crianlarich – so I stopped at Lix Toll services and made a panorama of it:

Observant viewers will spot there’s even a tiny fragment of snow remaining toward the far left of the shot on Stob Binnein – not bad for the last week of June!

The final stop of the afternoon was at Edinample Falls along the South Loch Earn road – a small gorge but beautifully shaped with pleasant light through the surrounding trees and a decent amount of water flowing around the rocks.

An overview of the waterfalls at Edinample – lovely sunlight illuminating the rocks nearby

 

In Kinclaven

I was so awed at the sheer acreage of bluebells (harebells?) at Kinclaven woods on my first visit with friends, I went back a couple of days later with the parents as well. Photos happened. It was still awesome. Also cool – a lovely place to just wander through dappled light amongst the trees. Yay.

Lovely atmosphere:

Great light:

Around Here: testing the Fuji X-T20

A couple of weeks ago it occurred to me that, with a holiday looming and desires of taking lots of long timelapse photos of an evening, should I wish to take other scenes while timelapse was recording I’d be out of luck with just the one camera. And so on a whim I followed a friend’s advice and bought a second shooter, a Fuji X-T20.

It’s totally amazing – “the Little Camera that Can™” – personified. Diametrically opposite to everything I’ve become accustomed to with the Pentax K-1: custom user-modes do not encapsulate drive modes such as burst-rate, bracketing or intervalometers, just some rudimentary exposure (auto)-ISO settings and things; and the JPEGs are absolutely stunning, with targets defined within colour-space not by intended purpose (“landscape”, “portrait”) but rather by film-emulation.

It’s so good I’ve reworked my entire RAW-processing workflow such that images from both cameras now look like the Fuji’s out-of-camera JPEGs whilst emulating Fuji Provia slide film of old. Quite some drastic changes required over and above the default RawTherapee profile – most notably yellow-greens are dramatically deeper and greener and there’s a “Fuji red” going off. It’s nice to have a point of reference in colour-space, so I know what’s “normal” and where processing deviates from it.

Anyway. Some quick snaps taken one lunchtime stroll through nearby woods:

And my favourite of all, a partial 22º solar halo – the first photo of the walk:

Having just returned from the holiday that prompted the acquisition, it’s interesting just how fast it’s become my primary choice of camera if only for reasons of lighter-weight whilst travelling.

Recovery: Keil’s Den, Fife

Still feeling very under the weather from a bout of food poisoning, I spent a happy Sunday afternoon walking around Keil’s Den outside Lower Largo, Fife – recommended by the Woodland Trust as a site for seeing bluebells.

It was still a week or two early in the spring for bluebells, but there were a few in evidence, along with a few expanses of unmistakeable white wild garlic.

There’s something pleasantly restorative about a walk in the woods: something about the green hues, dappled light and shade, cool breezes under the trees. It works.

My favourite photo from the afternoon was this strange beech tree – a strong young stem well on its way to producing a new crown of foliage, growing from the remains of an old battered and eroded upright trunk:

Life from old – a young stem growing into a strong crown of foliage from the remains of a much-damaged eroded old tree trunk.

Spittal of Glenshee

I don’t remember much about the hotel in Spittal of Glenshee – I suspect I saw it a few times when passing by up the glen, but that’s about it. I didn’t have recourse or time to visit the area for a few years, during which time it burned down in 2014 – quite a transformation, leaving the land just fenced-off to decay.

Nice setting:

As an aside, a friend and I were recently nattering about the saturation slider and how there’s always a temptation to overdo it. I mentioned that some images seem to “resonate” at multiple spots across the saturation axis – maybe fully saturated like slide film of old, maybe flatter like colour neg film of old, maybe artistically desaturated, maybe full-on black&white. The above image seems to work at 3 degrees.

Funky ruins: