Introducing CombineZ3

by Alan Hadley, UK

 
 

CombineZ3 is free software which I have developed to help with a long standing project of mine, photographing insects, and as such may be of use to anyone wishing to combine micro- or macro- photographs to obtain pictures with improved depth of focus.   It has rather strict requirements as regards the pictures but if these can be met the results are rather good.   The picture below is of the face of a 3 mm long Pteromalid wasp, it was taken down my microscope with the eyepiece removed using a webcam with no lens.   I took 37 pictures, turning the fine focus knob 10 divisions between shots, and combined them to make this picture.

You can of course process fewer photographs, say of a slide mount which is much thinner, or in this case 11 pictures of table salt crystals scattered on a slide.

If you use large photographs it takes longer to process them, and more pictures lead to a long wait for the results.   So I would suggest experimenting with say 640 by 480 pixel snaps, at least at first.  A lot of or large pictures may lead to excessive swapfile use if you don't have a lot of RAM on your computer, this also slows things down.   The input and output pictures must be in windows .BMP 24 bit format, I found a batch picture file format convertor on the web, but I expect many of the popular art programs will do this job for you too.

Try to keep the following points in mind when taking your pictures:-

CombineZ will not cope with every set of pictures you throw at it without you having to use some of the tools provided to correct its mistakes.   Pictures where out of focus parts of the scene tint neighbouring in focus areas with their colour are virtually impossible to get good results from.   When different parts of a picture come into focus in the same place at different times the program might select the wrong one you will have to correct for this by hand.   There is also a problem when contrasting areas come into and out of focus you might get a 'ghost' edge next to a real one which needs correcting.

I hope the problems outlined in the above paragraph don't put you off too much, there are many pictures in which they don't occur, and there are tools which are quite easy to use to correct most problems.

Here's a rough guide to the steps involved when using this program:-

1. Load your pictures.
2. Scan up and down through them to check brightness and tint, if necessary 'Balance' them.
3. Scan the frames again checking for correct alignment and size, if you need to use 'Resize All Frames' and/or 'Align All Frames' and/or 'Resize/Rotate/Move' and/or move the pictures about manually.
4. Produce a picture using 'Do It For Me', if appropriate try again using a different 'Edge Delta'.
5. Check the result and if necessary correct mistakes by painting the appropriate parts of the input frames onto the picture by hand.
6. Perform any post processing with the 'Special' functions i.e. 'Brighten' or 'Sharpen'.
7. Save the result.
This might sound a bit complicated, but in many cases not all of the steps are necessary.    There are many other options/routes you can follow to arrive at a finished picture, I tried to make the program as flexible as possible, I hope I didn't overdo it :-)

An example I put a drop of potassium permanganate solution on a slide and allowed it to dry:-

Then followed this sequence of steps,

1. Take several groups of 5 pictures

2. Convert to .BMP from .JPG

3. Load into CombineZ

4. Combine in groups of 5

5. Balance

6. Do it for me

7. Finish off

8. Save

9. Convert back to .JPG

To see examples including the original pictures visit my website.

If you are a user of  'Astrostack'=AS here is a comparison of program capabilities, it is in no way intended as a criticism of that program just a way of highlighting the features which make 'CombineZ'=CZ more suitable for microscopy.

The current version of AS is monochrome, CZ colour.

AS can handle more input and output file formats.

CZ is only just maturing i.e. there may still be bugs in it and I might change things if a better way of doing anything comes along.

AS is designed to take a set of frames which are all in focus but 'noisy' and average them together to reduce the noise, hence making the output picture sharper. You can also combine the pictures in other arithmetical ways.   The output picture never contains pixels directly copied from the inputs.   The result of this method as far as micro/macro photography is concerned is that results can be quite good if all inputs are almost in focus, if they are not you will have to sharpen the result a lot.

While CZ can use an averaging method to reduce noise and then sharpen the result, its operation is normally somewhat different.   It tries to find 'in focus' pixels in any of the inputs and then puts them in the output.   This direct transfer means there is no loss of detail due to combining with out of focus pixels and then sharpening the result.   Because of the difficulty of deciding which pixels are in focus, and because there might be more than one depth into the specimen which is in focus in the same place mistakes can occur so there are ways for you to correct these by hand.

AS can auto align frames with each other but cannot alter their size or rotate them.

CZ also has an auto align function but because it is difficult to align pictures in which only tiny parts are in focus it will often not work so there are other ways to align them.   You can also alter the size of and rotate your input frames to make them coincide.   This aligning business is important to obtain the best results from your inputs but may not be necessary with thin subjects.

The AS web site says deconvolution is on the way, CZ does not use deconvolution to sharpen images but has a function which will sharpen pixels in the Z i.e. depth direction and tends to unmix neighbouring pixels this is not far removed from deconvolution.

While you can do post processing tasks in any art program, CZ can handle some of these for you with some advantages because the original data is in memory, these tasks include sharpening and adjusting colour tint.

I have had a quick look at the demo version of the new commercial program 'Micro Focus' which works in a similar way to CZ without the ability to edit any mistakes at the pixel level.   The results it produces with the more advanced methods (which you can't try in the demo) may or may not be better than CombineZ but I think CZ scores on the ability to edit the output.   This program seems to work faster but does some processing as pictures are loaded and you only get a small square of in focus picture in the demo version.   The handling of files is a bit more slick than CZ's method.

A printable quick reference guide, some examples and the executable CombineZ3.exe can be found on my website:-

http://www.hadleyweb.pwp.blueyonder.co.uk/CombineZ/combinez.htm

The examples and pictures on the site were produced by CombineZ or CombineZ2 but the operation of CombineZ3 is the same although 'Do it for Me' now produces better results and there are 'Undo' functions and one or two other improvements.

All comments to the author Comments to the author sent via our contacts page quoting page url plus : ('ahadley','')">Alan Hadley are welcomed.
 
 
 
 

Microscopy UK Front Page
Micscape Magazine
Article Library


© Microscopy UK or their contributors.

Published in the December 2002 edition of Micscape Magazine.

Please report any Web problems or offer general comments to the Micscape Editor.

Micscape is the on-line monthly magazine of the Microscopy UK web
site at Microscopy-UK.



© Onview.net Ltd, Microscopy-UK, and all contributors 1995 onwards. All rights reserved. Main site is at www.microscopy-uk.org.uk with full mirror at www.microscopy-uk.net.