Monday, October 21, 2013

Lighting specimens for focus stacking

This is the third of a series of posts about taking focus stacked images of insect specimens to illustrate identification guides. The first part was a general overview, and the second a description of the setup I use to acquire the stack. In this post I will cover lighting the specimen. The stacks that were shot for Britain's Hoverflies were lit using flash but, more recently, I have been using continuous lighting produced by three Yongnuo YN1410 LED panels. I will compare the results and discuss the pros and cons.

Yongnuo YN1410 LED video light with plain diffuser
Yongnuo produce quite a range of LED panels with anything up to 300 bright white LEDs. The more recent models have tended to be a bit thinner and lighter and to have rather more sophisticated brightness controls. Part of the reason I went for the YN1410 (which is an older, and probably superceded, model by now) is that it has a DC power socket. Many of the more recent units don't have this. They can be powered using 6 AA batteries or battery packs made by Pansonic or Sony for video cameras. The battery packs are expensive (quite a lot more than an LED panel!) and I didn't want to have to keep 18 AA batteries recharged! Instead, I bought a 60W, variable voltage DC power supply (panels need 7.2 - 9V) from Maplin and a 4-way splitter cable (I could only find 2-way or 4-way splitters!). This happily powers all three units for however long a session I want and means I don't need to cope with all that extra weight of batteries - which makes attaching and positioning them easier.

The LED panels have very simple controls: an on/off switch and a pair of buttons to increase or decrease the light output over 16 steps. They are quite well daylight balanced, but tends to be a little towards the blue side at max output (5800-6000K). I find that, with the camera set to auto white balance, I get very acceptable colour reproduction.The max light output of each panel is rated at 960 lumens. What is probably a more useful way to describe it is that, for the MP-E 65 macro at 1:1 reproduction ratio and f8, the exposure is around 1/60-1/80 second at ISO100.

Specimen lit with 3 x Yongnuo YN1410 panels
Hilara matrona (Empididae, Diptera) male. LED lighting.
100% crop

In the past I have used three flash guns: the two heads of my Canon MT-24 EX and the Yongnuo YN565EX as the third. These require some diffusion, so in the picture below, the MT-24 heads are fitted with plastic diffusers which roughly double the effective area whilst the 565 is fitted with a large, home made soft box. The flash exposure is manual and with the 565 set up as a slave controlled by the MT-24. For this particular shot, the MT-24 heads were both set to 1/16 power and the 565 to 1/64 power. This is best judged by taking test shots and assessing the image and histogram on the camera's rear LCD panel. (The articulated LCD screen of the Canon 60D really scores here. It makes it easy to view the screen without having to go through contortions to get down and directly behind the camera! Being young and bendy would probably be equally effective ...) For this sort of shot in the 1.5-2:1 range, the flash power require  is generally low. This has the advantage that the flashes recharge very quickly. At higher reproduction ratios, say 4-5:1 for shots parts of the animal, more flash power may be required. For things like tarsi details at 5:1 you may even need full power. In these cases the StackShot's programming will need adjusting to allow a longer pause between shots to allow the flashes time to recharge.

Three flash heads with diffusers. The YN565 has a large, home made diffuser head fitted.
Stronger specular highlights. Note those on the hind femur.
100% crop
Comparing the two images, the greater contrast and more pronounced specular highlights in the flash lit shot are obvious differences. More diffuse flash can be obtained by building a soft box around the specimen. This is especially necessary for more shiny and metallic specimens with strong specular highlights. One way I have often done this is to use plastazote sheets (ideally 6mm thick - the ones shown are thicker than I usually use!) to build a soft box around the specimen (note that, in this case, I didn't also use diffusers on the flash heads):

Plastazote softbox built around the specimen
Another idea is to use an expanded polystyrene vending machine cup (the sort of thing soup is sometimes sold in). Cut the bottom off, so you get a cone, narrowing outwards, and pin that to the backing sheet so that it surrounds the specimen.

Note that the MT-24 head is mounted on a small ball & socket head. I find these extremely useful for mounting lights and flashes. They can be bought quite cheaply off eBay.

Small ball & socket head, metal flash "cold-shoe" mount and standard 1/4 inch photo screw, all bought off eBay, are very useful for mounting lights.

Whilst all the stacks for Britain's Hoverflies were shot using flash, I have more recently almost entirely switched to using continuous lighting provided by the Yongnuo LED panels. I find that this approach solves a few niggles I had with using flash:
  • With flash, you need another light, such as desktop halogen lamp or an anglepoise lamp, to provide the light to to view the specimen for focussing and setting the start and end points. You then need to move that out of the way and move the flash heads into the correct position before you shoot.
  • You generally need several test shots to get the right flash exposure and to adjust the diffusion and flash head positions to manage specular highlights.
  • The exposure of successive flash shots can sometimes be a bit variable (probably an indication that the flashes did not have sufficient time to fully recharge between shots). This can impact on the quality of the finished image.
With continuous lighting, these are avoided. The main lighting for the shot is also used to focus and setup and, whilst you are focussing and setting up, you see shadows, highlights, etc. So everything is done in one operation and it is unusual to need more than one test shot to confirm the exposure. I have not found any detectable exposure variation between shots using the LED panels. All in all, faster and more convenient!

In the next post I will talk about software for processing the stacks.


Wednesday, October 16, 2013

Setup for focus stacking

This is the second of a series of posts about using focus stacking to photograph insect specimens to illustrate identification works. The first part is here and provides a general overview. In this post I want to describe the setup I use to acquire the stack of images:


Setup for taking focus stacks ofa specimen
The photo shows my Canon EOS 60D with the MP-E 65 macro lens mounted on a Stackshot motorised focussing rail. This is mounted on a homemade jig which allows me to position the specimen vertically on the back wall of the jig and slide it sideways and up and down to center it in the field of view. The specimen is lit using three Yongnuo YN1410 LED video lights which give a bright, daylight balanced white light (I will write a separate post about lighting).

 

The jig


The jig. The insets show the vertical slider without the specimen carrier in place (bottom left) and the way in which the three flash brackets, used  for mounting the lights, are attached (top right).

My home made jig is built mainly from MDF. The base consists of a 32x14cm piece of 18mm MDF and the back wall is 25cm high, also 18mm MDF. They are joined by a couple of right angled steel brackets. The vertical and horizontal sliders on the back wall and the tracks they run in are all built from 3mm MDF. Three "Kood straight flash brackets" (bought off eBay) are attached to the back wall. These are used to mount the lights. The flash shoe has been removed from each of these brackets and an 8mm diameter hole drilled through the bracket where the shoe was located. These fit over three captive bolts glued into a piece of 2x1 which is then screwed to the top of the back wall. The brackets are fixed to the bolts using a butterfly nut so that they can be angled as required and held in place simply by tightening the nut.
Underside of base
The base has a 6x14cm slot cut in it and a 3mm Aluminum plate (14x20cm) attached over the slot. The plate has a series of 6mm holes drilled along its centre line. The focussing rail is mounted using a standard 3/8 inch photographic screw (also purchased off eBay). The black strip down the middle is a piece of cycle inner tube glued on with contact adhesive and helps prevent the focus rail from rotating out of alignment too easily.

Specimen carrier

Specimen carrierMounting pin
The specimen carrier consists of a 20x8cm piece of 3mm MDF which acts as the horizontal slider on the back wall. A 7x12 sheet of 12mm plastazote is stuck to it using double sided carpet tape (I usually get plastazote sheets from Anglian Lepidopterists Supplies). The background consists of a piece of paper pinned to the plastazote. A mid-grey background was used for specimen photos in Britain's Hoverflies, but a plain white background is shown here. I often see backgrounds with a coloured gradient on photos online - this could easily be achieved by printing the desired gradient using an ink jet printer and then cutting out a suitable sized piece to pin to the specimen carrier.

The actual specimen is mounted on a plastazote stage on a long pin to get it well in front of the background so that stays completely out of focus. The plastazote stage into which the specimen's micro pin is mounted has been coloured blue using a standard highlighter pen. This makes the mount easy to mask out of the finished image because this florescent blue is not a colour that is likely to occur naturally! (I will talk about post processing the stacked images in a later post.)

The second sheet of 6mm plastazote pinned to the bottom of the specimen carrier simply acts as a reflector. It throws some light upwards and tends to fill in any shadows underneath the specimen arising from the fact that there is no light below the specimen in my setup (although there is no real reason why you could not mount a fourth light on the base of the jig, below the specimen, if required, to get really flat, all round illumination).

Stackshot

Stackshot focussing rail
Stackshot controller
The StackShot "focus stacking macro rail" is a wonderful piece of kit, but is not cheap! As far as I know, it is only available directly from Cognisys in the USA ($525 + carriage at the time of writing). Remember that you will also have to pay import duty and VAT to HM Revenue & Customs when you import it!

The focussing rail is driven by a stepping motor which is controlled by the programmable controller. There are many options, but I use the one where you set the start and end point (by driving the rail forward and backwards using the "Fwd" and "Back" buttons on the controller) and step size. I set the step size using a Depth of Field table for the MP-E 65mm macro lens. I choose a step size that is 30% less than the Depth of Field for the F-stop and reproduction ratio I have set on the lens. This gives some overlap of the parts that are in focus between shots which helps the stacking software to merge the shots successfully. So, if the chart says that the Depth of Field is 0.5mm for my chosen lens settings, I would set a step size of 0.35mm (0.7 * 0.5). The controller works out how many steps of that size are needed to travel from the selected start to end points. When you tell it to start shooting the stack, the controller moves the rail to the preset start position, fires the shutter, moves by one step of the selected size, fires the shutter, etc. until it arives at the preset end position.

There are many options to control how fast the rail moves and the length of time between operations. For example, you can set how long to pause between the rail arriving at the next position for a photo and the shutter being triggered (i.e. how long to allow for vibrations caused by the rail's movement to damp down). It can be very useful to modify these settings, for example, to make the time between shots longer to allow a flash to recharge (if you are using flash to expose the shots). It also has an option to trigger the shutter twice for each shot so that you can use mirror lock up (as I normally do).

In the next post I will consider the lighting and compare flash and continuous LED lights.

Tuesday, October 15, 2013

Photographing of insect specimens using focus stacking techniques

This is the first of a series of posts describing the methods I have used to photograph specimens of flies to illustrate "Britain's Hoverflies" and various identification keys using focus stacking.

Ceratinostoma ostiorum (Diptera, Scathophagidae), male. Focus stack of 25 shots taken in July 2013 at approx. 1.5x life size using Canon 60D with MP65 macro lens, processed using Zerene Stacker.

Why is focus stacking necessary?


When you look at an insect specimen through a microscope, you focus up and down and move the specimen around and what you "see" is a 3D model formed by your visual system - the combination of eye and brain. If you take a photograph of the same specimen at the same sort of magnification the resulting image is often rather disappointing! It fails to match your perceptions because, due to the limited depth of field, it is not all in focus. It is possible to increase the depth of field of a photo by decreasing the aperture of the lens (selecting a higher F-number) but, as the magnification you are trying to achieve increases, the depth of field available is simply not sufficient. It is not possible to decrease the aperture, and hence gain more depth of field, beyond certain limits because diffraction leads to unacceptable image degradation.

The way out is "focus stacking" - taking a series of photos (the "stack") at different focal points and merging the most focussed parts into a single, composite image that is in focus throughout. The result, like the one shown above, satisfyingly matches our perceptions of what the specimen ought to look like!

Whilst this technique has been known for a long time, the availability of computer hardware and image processing software that will do a good job in a reasonable amount of time and at a cost affordable to an amateur enthusiast is relatively recent development. Sufficiently powerful home-computers with enough memory have only become available and affordable over the past decade or so (say, since 2000).

My experiences of focus stacking


I have been interested in the technique for a long time. I first encountered it when I was a PhD student at Newcastle University (1975-78). At that time, the camera microscope and image capture setup cost something in the high tens to low hundreds of thousands of pounds and the processing software needed the resources of a university mainframe computer! In Dec 2002 I bought a Nikon Coolpix 4500 and used that, mounted on a binocular microscope, to capture focus stacks which were processed using software I wrote myself (called "DeepFocus") written with Delphi 7.

Sphaerophoria scripta (Diptera, Syrphidae). Focus stack of 14 images taken in April 2004 with Coolpix 4500 mounted on binocular microscope and processed using self-written "DeepFocus" software.

More recently, Roger Morris and I produced about 180 images of  hoverflies for the WildGuide "Britain's Hoverflies". Producing this number of images at the sort of quality required for publication in a book, was only really possible because I had developed better and faster techniques.

Melanostoma scalare (Diptera, Syrphidae), female head. Focus stack of 15 shots taken in April 2011 at approx 3x life size using Canon 60D with MP65 macro lens. Processed using Helicon Focus.
My latest projects are an update my key to the British Scathophagidae and a Field Studies Council fold-out identification card on Garden Hoverflies (still in preparation). For these, I have been shooting a series of whole-animal images.

In the next post I will describe the setup I have developed to acquire the stack of images.

Friday, October 04, 2013

Which SD card?

I have seen a number of forum posts recently along the lines of "Which SD card should I buy to go in my new camera?". In trying to write a reply to one of these, I quickly found myself confused by the plethora of acronyms and options out there!

The problem is that, as Secure Digital (SD) cards have evolved, they have picked up:
  • a series of different capacity ratings - the original SD (max 1Gb), followed by SDHC (High Capacity - max 32Gb) and now SDXC (eXtended Capacity - max 1Tb),
  • three different physical sizes - the original "standard" size (32x24mm), mini- (21.5x20mm) and micro- (15x11mm),
  • and a series of different write speeds. They were originally described as "xn" indicating how much faster they were than a CD drive e.g. "x24". This was replaced by "class" ratings (class 2, class 4, class 6 and class 10) which indicate their write speeds in Mega-bytes/second (so a "class 10" card can writes 10Mb/s) and now we have a new UHS (Ultra High Speed) rating system. UHS-1 writes up to 50Mb/s.
All of this makes for a very confusing array of options when you are trying to buy the right one for your camera!

For my Canon EOS 60D, the specification on Canon's web site states (under STORAGE):

  • Type: SD card, SDHC card or SDXC card

which is not tremendously helpful since it does not even state which physical size card is needed, let alone the speed to go for! I suppose we can assume (rightly as it turns out) that a standard sized card (32x24mm) is expected unless it says otherwise. If you search the support site, you can find "FAQ: What are the Compatible Memory Cards? (EOS 60D" (dated 4 Oct 2010), which says the following:
  • The camera does not come with a memory card for recording images. Please purchase it separately.
  • When shooting movies, use a large-capacity SD card rated SD Speed Class 6 "" or higher.
OK, I think I had already grasped the first point, but now we know it probably should be at least class 6. Searching through other reviews and comments, I gleaned that the current line up of DSLRs (at least from Canon) will support UHS-1 cards, but don't take advantage of the extra write speed they offer. So there is no point buying anything above a class 10 card (and generally, the faster the card the more expensive). The reason for going for a fast card is that you don't want to create a bottle neck if you are using the continuous shooting mode or recording HD video. You want the card to take whatever the camera's processors can throw at it! Class 10, it seems, fulfills this goal for the current generation of cameras.

The capacity you need comes down to the image size and quality you select (RAW and/or JPEG) and how many shots you think you may need to store before you get back to base and can download the images. I bought Sandisk extreme 16Gb cards which are rated class 10. I normally shoot RAW files and get around 540 photos on one of these card. I have very rarely filled up a card in a single day! These cards have met my needs admirably so far.

Postscript

Now I come to write about it, these numbers don't really add up! With an empty, formatted card, the camera shows a capacity of 539 shots. If I put the card in the card reader in my computer, go to Explorer, right-click on the card's drive letter and check its properties, it shows 15,911,354,386 bytes of frees space.

Here is the first, and well known rip off! In a computer's memory and filing system, a Kb is 1024 bytes. A Mb is 1024 Kb (1,048,576 bytes) and a Gb is 1024 Mb (1,073,741,824 bytes). But people who sell us storage, hard disks, storage cards, etc., use 1Mb = 1,000,000 bytes and 1Gb = 1,000,000,000 bytes. So a 16Gb card is offers 16,000,000,000 bytes of storage (not 16 x 1024 x 1024 x 1024 as you might hope!).

But I seem to be missing 16,000,000,000 - 15,911,354,386 bytes on the empty card - very close to 84Mb. This is presumably taken up the directory structures that formatting the card created. I am not too surprised by this, though it is perhaps a bit more than I would have anticipated.

I can easily see how big I expect a RAW file to be. I have a photo archive with several thousand of these stashed away in it (files with a .CR2 extension). If I shift-right click on my PhotoArchive directory and choose "Open command window here" (I am using Windows 8), I get a command prompt where I can enter the command:

dir *.cr2 /s

This will show me the RAW files it finds in that directory and all its subdirectories (the /S switch) and, at the end, a summary including the number of files and their total size in bytes. Dividing one by the other, I get the average size of a .CR2 file across this very large sample - which comes out at 24,209,182 bytes = 23Mb.

If I divide the free space on the SD card by the average size of a .CR2 file, I get an answer of 657. This is the approx number of files I would expect to be able to store. So why does the camera report only 539? That is rather a big difference. And I know from experience, when that displayed total decrements to zero it will say "Card full". Next time that happens, I must remember to check whether the computer still sees lots of free space.

Wednesday, October 02, 2013

Depth of field does not depend on the focal length of the lens

Many photographer believe that a wide angle (= short focal length) lens give more depth of field (DOF) than longer lenses. This is a misconception! For a given magnification the focal length of the lens does not effect the depth of field which is (almost) entirely determined by the aperture. The Wickipedia article on DOF gives the following formula to (approximately) calculate the DOF in close-up situations (i.e. where the distance to the subject is very much less that the hyperfocal distance):

\mathrm {DOF} \approx 2 N c \, \frac {m + 1} {m^2} \ where m is the magnification, N is the f-number and c is the circle of confusion.

For more information on circles of confusion see this Wickipedia article which gives a value of c = 0.018mm for the Canon APS-C sensor.

The following table and chart show the DOF in millimetres at various f-stops for reproduction ratios from quarter life size to twice life size calculated using this formula for the APS-C sensor:

I wanted to try and demonstrate this for talks I give on macro photography. What I came up with was to take a series of photos of a relatively small subject (an 18cm tall figure of an Uruk-hai from Lord of the Rings) using a series of different focal lengths, but moviing the camera so that the subject was kept at the same size in the viewfinder (hence maintaining the same reproduction ratio). Here is the setup:


The Uruk was placed, standing on a ruler, in the garden and a piece of string stretched from his middle across the garden. At each focal length, the camera was positioned with the lens aligned along the string to keep the same angle of view and then moved backwards and forwards until the Uruk was positioned in the same way in the viewfinder with his feet on the bottom of the frame and the top (active) focus point on his chest armour:

All the pictures were taken at f6.3. I used my Sigma 150-500mm to take pictures at 200, 300, 400 and 500mm, my 100mm macro and my 17-85mm zoom for 80, 50 and 35mm (I could not get close enough to achieve the same magnification and still focus at focal lengths below 35mm!).
400mm (at 5.8m)

200mm (at 3.2m)

100mm (at 1.7m)

50mm (at 90cm)

35mm (at 74cm)
Examining these images closely, focus extends from about the 34/34.5 to the 37cm mark on the ruler. The part of the ruler that is in sharp focus does not change as far as I can tell when examining the originals at 100%. The block of wood used to angle the ruler is clearly out of focus in all the shots. However, what is very clearly shown is the effect of focal length in changing the working distance and perspective. The same subject magnification was achieved at 5.8m away using the 400mm as at 74cm with the 35mm focal length. But, using the 400mm, there is very little of the background in shot, whilst at the other extreme there is a wide sweep of the background wall.

The effect of the focal length of the lens on the working distance for macro shots can be seen in the following shots. Here is the Uruk's lovely face at a reproduction ratio of 1:1:

1:1 shot of the Uruk-hai's face
And here are the 100mm macro and 65mm macro focused on his face at 1:1. Note the difference in working distance, how much closer you have to be using the 65mm (front of the lens just about touching his crossbow):
100mm macro focused on the face at 1:1

65mm macro focused on the face at 1:1




Tuesday, October 01, 2013

Yongnuo YN565EX flash

I have had a Yongnuo YN565 EX flashgun for over two years (purchase Aug 2011) and found it an excellent piece of kit. It is a Chinese-made copy of the Canon 580EX, its biggest advantage being that it is only a fraction of the cost (today on Amazon: YN565 EX - £80; 590EX - £375).

It closely resembles the Canon 580EX both physically and in the range of functions it offers, It makes you wonder how they get away with it! It lacks only two significant features of the Canon:
  • It can only act as a slave in a multiple flash wireless setup (the 580EX can be the master),
  • It lacks the high speed sync feature of the Canon. This allows the 580EX to be used as a fill-in flash at shutter speeds above the maximum flash sync speed offered by the camera (1/250 on Canon EOS 60D). This is done by producing a rapid sequence of lower powered flashes.
(The Yongnuo YN565EX II has been announced with both of these features added, but does not yet seem to be available - so I could not find a price.)

I have used it mainly in two situations: Firstly, as a background light when using the Canon MT-24 macro flash and secondly as a fill-in flash for bird photos from a hide.

Background light for macro-flash

One of the main criticisms of macro photos lit by flash is that they often have a very black background where the lighting from the flash does not reach. This can be tackled by using another flash to light the vegetation or whatever is immediately behind the main subject. The YN565EX, mounted on a tripod, and set up to be controlled wirelessly as a slave does this job nicely. I find that the infrared communication between master (Canon MT-24 twin macro-flash mounted on the camera) and the slave (the YN565EX) works well over the sort of range I normally work at - providing I  make sure that the red window on the front of the YN565EX faces towards the camera. Since the flash head tilts and swivels, this is not hard to achieve. The the ratio of power from the MT-24's two heads and the YN565EX can each be controlled from the camera's menu - so no fiddling abut with the Yongnuo's control panel is required once it is set up in slave mode (which is quite fiddly!). Generally, the power of the fill-in needs to be turned down (it can go down to 1/32 of full power) relative to the main light from the MT-24 heads, but this is best judged by taking some tests shots and checking them on the camera's LCD screen.

Fill-in for bird photos

I have used a hide in the garden both to photograph nesting birds coming in with food and, in winter, stuff coming to my feeders. Obviously, I tend to go for bright daylight conditions to get a fast shutter speed, but that often leads to quite harsh shadows. This can be tackled using an off camera fill-in flash to put a bit of light into the shadow areas. I use the YN565EX for this, mounted on a clamp on the ouside of the hide via a hot shoe extension cable. Again, I bought a Yongnuo made extension equivalent to the Canon OC-E3 (Yongnuo - £10; Canon OC-E3 - £60 - how does Canon justify these sort of prices for accessories!). Again, a bit of experimentation may be necessary, but a flash exposure compensation of -1 to -3EV is usually needed and this is simply dialled in on the back of the camera. So no need to be able to reach the flash once you are set up in the hide.

Robin at one of its favoured perches on the way in to feed young in nest. Sigma 150-500mm at 267mm, F5.6, 1/250, ISO400. Somewhat back-lit with fill-in flash from below-right. Camera in Tv mode with -3EV flash compensation.