Stacking, starting from the ground

A forum to ask questions, post setups, and generally discuss anything having to do with photomacrography and photomicroscopy.

Moderators: rjlittlefield, ChrisR, Chris S., Pau

ChrisR
Site Admin
Posts: 8668
Joined: Sat Mar 14, 2009 3:58 am
Location: Near London, UK

Stacking, starting from the ground

Post by ChrisR »

There are too many questions here – any comment on any of them would be welcome!
I’ve read a lot here and elsewhere and I’m ready to have a go at stacking, but I lack the optimum hardware. So I have some questions which are aimed at getting a reasonable result without trying too many blind alleys which won’t work at all.

Lets assume I’m using a 50mm lens at 5x magnification, around f5.6.

I realise it’s best to move the camera and lens together (equivalent to moving the subject), but of course it’s possible to get a stack moving just the lens, or just the camera body (the “rear standard” if it were a plate camera). Doing any of those alters the magnification, and some are easier to achieve than others.

1)
The depth of field will be a little less than 0.2 mm, so I assume I’d have to move the subject (relatively) about 0.1mm or less per snap. It would be much easier to move the camera body, where the equivalent movement would be 0.5mm. Would the magnification change be a problem?

2)
With DOF 0.2mm, would it matter if the steps were uneven, if they were all less than say 2/3rds of that. My knobs aren’t calibrated! I can give them tiny tweaks and keep a count so I know the average.

3)
I imagine my rig isn’t as solid as it could be. Single-fixing-point bellows I bought secondhand 30 years ago. Ignoring possibilities of movement during exposure, what about small lateral movements between frames. Would they get realigned by any of the free/cheap software? I have PS CS4 and have downloaded CombineZP but not even run it yet, Helicon would be possible, as would I guess, Rik’s product :wink: . Which would be most straightforward to start off with? I don’t anticipate wrestling with overlapping bug’s eye-hairs for a while yet.

4)
If I need, say, 30 images, will my 3-4 year old PC with 1GB do the necessary in times under 10 minutes?

5)
If I reduce each file’s size by taking more compressed jpegs, will the artefacts confuse the software?

6)
An option I have is to use 6(ish) Mpixel DX instead of 12 Mp FX, which would of course move the hardware. Apart from reducing file size, as I understand it using DX would give me more DOF, and not affect IQ, which I must admit feels odd.

I’ve read partial answers to some of these questions, but all the terms are so common it’s hard to search on them, and I can’t remember all I might, so I do apologise in advance for that.

lauriek
Posts: 2402
Joined: Sun Nov 25, 2007 6:57 am
Location: South East UK
Contact:

Post by lauriek »

Yes you can move the rear standard to adjust the magnification as you go, to maintain perspective of the subject, but in another thread on here (sorry cannot find now!) Rik mentioned that the steps used would have to vary through the stack to maintain any kind of consistency in the stepping, which would be tricky to achieve.

1) I'm not sure why you think you can move the camera 0.5mm if you have 0.2mm dof. You would want to move either the camera or the subject by less than your DOF.

2) No as long as the steps are at least small enough it shouldn't matter if they vary a little. However if you do one step too large you might end up with a thin oof slice in your final image so go under rather than over in terms of focus step...

3) Depends on just how much movement. When my rig was a bit dodgy I had varied success. However I'm pretty sure Zerene does better alignment than CZP I was using before, in terms of slight rotational movement anyway.

4) Not sure, I suspect it might take a bit longer. What's the spec of your PC? If speed is important then I think you might want Helicon. Zerene does have a batch processing feature so you can batch up a bunch of stacks to run say overnight. Personally output quality is more important to me than speed...

5) Possibly, also the JPEGs will need to be uncompressed to a 24bit bitmap to be 'viewed' or stacked anyway, so I don't think you'd save as much time as you might be thinking - a bit of time on loading the files is all..

6) Not sure what cameras you are talking about here, what are these?

rjlittlefield
Site Admin
Posts: 23564
Joined: Tue Aug 01, 2006 8:34 am
Location: Richland, Washington State, USA
Contact:

Post by rjlittlefield »

Adding to what lauriek has written (by the original numbers):

1. Laurie, ChrisR is talking about leaving the lens fixed in position and moving only the camera. At 5:1, the plane of focus moves a lot less than the camera does. It's just basic 1/f = 1/i + 1/o.

But when you plug in the numbers, you'll find that the relationship is not nearly as simple as 5:1. It's more like 25:1 (magnification squared).

To use ChrisR's situation, f=50, i=60, o=300. Moving the camera by 0.5 mm makes o=300.5, giving i=59.98. In other words, moving the camera by 0.5 mm moves the focus plane by only 0.02 mm. To make the focus plane move by 0.1 mm, say to i=59.9, you have to make o=302.5 -- move the camera by 2.5 mm.

Obviously this allows quite fine control of the focus plane position by moving the camera. The difficulty is that if you want to change the focus plane by very much, you need to move the camera a lot. The approach works fine, but run the numbers first to see what's going to happen -- it's a bit surprising.

3. Lateral movements and scale changes are not a problem. Any of the software packages will work fine, to the level of detail that you'll care about when you're just getting started.

4. 30 images in 10 minutes on a 3-4 year old PC sounds on the edge. If that's critical, your best shot is Helicon Focus. They have a free trial period, it's very easy to use, and for most subjects it gives a pretty good result straight out of the box. You should also be using your DX in this case, since processing time goes up with more pixels.

5. Using more compressed jpegs will not speed up the processing enough to matter. On the other hand, at 5:1, jpeg compression artifacts probably aren't going to matter either. That's because nothing in your images will be sharp enough to see them.

Almost all of my high magnification images are shot with lowest-quality jpegs on a 6.3 Mpixel Canon 300D. That's motivated not by processing time, but rather by time for the camera to write images to its memory card. If I use high-quality jpegs, then it gets slower to shoot the stack, but the stacked composites don't get any better. Shooting raw would be best of all (mostly for shadow detail), but that's agonizingly slow with that 5 year old camera. The tradeoffs would be entirely different with a newer one.

6. The relationship between formats DX (24x16 mm) and FX (36x24 mm) is hard to understand in detail. In brief, it's exactly the opposite of what you wrote. For high magnification stacking applications, they will have the same DOF and the same resolved detail, when you set up to give the same field width in the subject plane. Of course the magnification on sensor will have to be 50% higher to do this with the FX. Given the same fabrication technology, a larger sensor will give less noise, at the cost of requiring a longer exposure or more light. I don't know if this is true for the particular cameras that you have, because the sensor technologies may be different also.

--Rik

ChrisR
Site Admin
Posts: 8668
Joined: Sat Mar 14, 2009 3:58 am
Location: Near London, UK

Post by ChrisR »

That's because nothing in your images will be sharp enough to see them.
OI, :evil: give us a chance!
Seriously, I'm not sure why you say that.

Camera is a Nikon D700, so I can switch to the smaller format with a loss of a lot of pixels.

Regarding the format change, I've read several places (and understood at the time) that a smaller sensor works out to give you more DOF than a bigger one. The more I think about it the more confusing it is, but I did decide that to give a print with a picture of a given object a given size, ie after enlargement from the sensor, that was true. A square law wins out over a linear relationship somewhere in there. It's quite likely that I'm forgetting something else though.

You're right of course about the numbers, Rik. I've forgotten how to differentiate product over sum :oops:

HF seems to be well worth the money for the single-user product, though I might try Photoshop first because I'm generally familiar with it.

The London suburban Garden is singularly devoid of fauna at this time of year it seems. Even a few drosera are going hungry. I took a tick off the cat but after a day in the salad drawer that doesn't look very cheerful either.
Still, I'm running out of excuses.

rjlittlefield
Site Admin
Posts: 23564
Joined: Tue Aug 01, 2006 8:34 am
Location: Richland, Washington State, USA
Contact:

Post by rjlittlefield »

ChrisR wrote:
That's because nothing in your images will be sharp enough to see them.
OI, :evil: give us a chance!
Seriously, I'm not sure why you say that.
Well, gee, I didn't mean to sound insulting. :?

It's just very challenging to get optics that are good enough to present pixel-level detail at 5X. The problem is diffraction. At 5X, your nominal f/5.6 lens will be operating at effective f/33.6 (multiply by m+1), and f/33 even on a FX-sized sensor isn't very sharp. If you're talking 5X onto an DX-sized sensor, the problem is even worse. See http://www.cambridgeincolour.com/tutori ... graphy.htm for some explanation. To get pixel-level detail at 5X, you're going to need a good macro lens that can work well at a wider aperture.
Regarding the format change, I've read several places (and understood at the time) that a smaller sensor works out to give you more DOF than a bigger one. The more I think about it the more confusing it is, but I did decide that to give a print with a picture of a given object a given size, ie after enlargement from the sensor, that was true. A square law wins out over a linear relationship somewhere in there. It's quite likely that I'm forgetting something else though.
It depends on what you hold constant. Assuming same field of view etc, DOF depends only on the aperture diameter, measured in mm and not f-number. A lot of times people will hold f-number constant, in which case a smaller sensor gives more DOF because it works with a shorter lens, which has a smaller aperture at the same f-number. Thinking in terms of the aperture diameter instead of f-number makes the analysis simpler.

See http://www.photomacrography.net/forum/v ... php?t=4108 . The back-and-forth discussion gets a bit confusing in places, but if you slog your way through the whole thread everything may eventually become clear.

--Rik

ChrisR
Site Admin
Posts: 8668
Joined: Sat Mar 14, 2009 3:58 am
Location: Near London, UK

Post by ChrisR »

AT last I found a use for Excel - never used it before.
Stepping through the target at 0.2mm slices gives this, (for a "thin" lens of course)
Image

Moving camera and lens together would have only changed the Mag
from 4.84 to 5.17

Moving the lens alone ... I'll do later

rjlittlefield
Site Admin
Posts: 23564
Joined: Tue Aug 01, 2006 8:34 am
Location: Richland, Washington State, USA
Contact:

Post by rjlittlefield »

Yep, that looks about right.

One quibble about the labeling: "object" and "image" are reversed from standard optics usage.

About Excel... I use it several times every day, to do one or another calculation like this. I also teach algebra at the local university. I force my students to use Excel to check their answers (plug in numbers and see if the symbols work!) and also to solve problems that algebra simply cannot do. I ask at the beginning of each semester what the students already know about spreadsheet programs. Most of them have never used a spreadsheet in a class before, and fully half of them are unaware that spreadsheet programs can do arithmetic! Apparently most people use spreadsheets just as tables to hold stuff that is typed in. :?

--Rik

ChrisR
Site Admin
Posts: 8668
Joined: Sat Mar 14, 2009 3:58 am
Location: Near London, UK

Post by ChrisR »

"object" and "image" are reversed
Yes I just noticed - I thought you might get there first! :roll: :D

I've just done the thing for moving the lens , so that the sensor to focus plane decrements by 0.2mm each time. Made it solve a quadratic for each one, but I don't like the look of the result so I may have done something wrong, and it's nearly 1am so it can wait!
(It's coming out that the image distance goes down by 0.208mm every time - can't be right surely?).

The other day I watched as a fellow needed a calculator for 14 x 10, and another grabbed his manual to find 13 x 5. Depressing, isn't it!
Last edited by ChrisR on Thu Jun 13, 2013 1:11 pm, edited 1 time in total.

rjlittlefield
Site Admin
Posts: 23564
Joined: Tue Aug 01, 2006 8:34 am
Location: Richland, Washington State, USA
Contact:

Post by rjlittlefield »

You have me beat with the 14 x 10.

I did once have a student haul out a cell phone to compute 6 x 20, but that's a harder problem.

The funny thing is, that student turned out to have a remarkably good grasp of what the numbers meant and how to work with them to get a useful result.

It's just that he needed a calculator to do the arithmetic.

I feel a lot better about that than I do about the students who can do arithmetic just fine, but don't have a clue what the numbers mean or how to use them.

Regarding your "0.208 mm every time", I think you have the right result. As a crosscheck, I did it by simply changing o by fixed 0.2, then calculating i = 1/(1/f-1/o). To get the position of the focal plane with respect to the fixed camera, I compute i' = o+i. Then I look at the change in i'. The number I get is that when o changes by 0.2, i' changes by 0.1920 at 5X. That number is almost but not quite constant. From o = 290 to 310, the change in i' only varies from 0.1913 to 0.1926.

A more refined crosscheck shows that changing o by 0.20834 is what's needed to get i' changing by 0.2 at 5X, and stepping by that constant amount changes i' by values between 0.1933 and 0.2006 (again, for o between 290 and 310). The required value for change in o comes from Excel's "Goal Seek" function, by the way -- no quadratic formula required.

If you really want to hurt your head, try the same calculation at 1X and see what happens.

--Rik

Edit: to add the "more refined crosscheck".

ChrisR
Site Admin
Posts: 8668
Joined: Sat Mar 14, 2009 3:58 am
Location: Near London, UK

Post by ChrisR »

I meet a lot of folk far more eloquent than me with bent metal, a blowlamp or a camera, so I don't really mind if they can't add up :wink:

I let Excel diisplay more figures, and behold, the differences are there, after the 208 .
I included the third table just for completeness, though note that the "Object Distance" doesn't reallly change , because the Object is the plane of focus which moves with the lens and sensor. I put it in to give an idea of how magnification changes, even though it's the fuzzy parts of the image.

Ignore the fact that some columns are red, that's what Excel is doing with negative numbers, s'all.

Three ways to get 0.2mm slices:
f=50mm, Magnification around 5.
Image
Last edited by ChrisR on Mon Jan 11, 2010 5:42 pm, edited 2 times in total.

ChrisR
Site Admin
Posts: 8668
Joined: Sat Mar 14, 2009 3:58 am
Location: Near London, UK

Post by ChrisR »

However good my optics are, Professor Abbé's blob will splat about 9 of my pixels, so I'm down to 1.35Mpixels. May as well use a cellphone stack!
Last edited by ChrisR on Sun Jul 05, 2009 1:42 pm, edited 1 time in total.

rjlittlefield
Site Admin
Posts: 23564
Joined: Tue Aug 01, 2006 8:34 am
Location: Richland, Washington State, USA
Contact:

Post by rjlittlefield »

Comments in a couple of unrelated areas...

1. You can partly work around diffraction by using a microscope objective instead of a conventional macro lens. This doesn't change the basic issue, but it does let you run at a wider effective aperture. For example a 10X NA 0.30 objective is roughly equivalent to an unusually well corrected 16 mm FL, f/1.5 macro lens. But I don't know any place to buy such a macro lens at any price, while the microscope objective can be found for around $100 if you wait a while.

2. That last column in your table is relevant even though it's for the out-of-focus parts.

To avoid radial smearing, all images in the stack have to be converted to a common scale even in the out-of-focus areas. Consider a detail that is equally sharp in two adjacent frames. You're showing a change in magnification of roughly 0.4% (0.004) from frame to frame. If that detail is at frame center, no problem. But if it's at frame edge, say 1000 pixels out, then it'll move 4 pixels from one frame to the next.

At higher magnifications and wider apertures, say 10X at NA 0.3, the scale change from frame to frame is so small that it can be ignored. But at lower magnifications and smaller apertures it has to be considered. That's why all of the stacking programs can do re-alignment.

The scale change can be reduced by using a longer lens. It can be reduced all the way to zero by using strange optics called "telecentric on the object side". That's a useful technique for stack-and-stitch with deep subjects (example HERE), but otherwise it's not worth the trouble.

--Rik

ChrisR
Site Admin
Posts: 8668
Joined: Sat Mar 14, 2009 3:58 am
Location: Near London, UK

Post by ChrisR »

1. SUch a microscope objective is proving very elusive! If anyone knows of a CFN 0.3 10X, please let me know!

Somebody must have tried using lenses designed for CCTV, such as this, 12mm f0.8

I read of someone trying a Ciné lens and being surprised it worked reasonably.
They go down of course, to a couple of mm, where the Working Distance would be a bit short I expect. Is the problem simply one of lens quality? Surely there must be good ones?
I discovered that the lens in my webcam is about 3mm so of course that's been removed and shoved through a cardboard disc . DOF and WD too small to use.
(That's where I came in, after finding what I thought would be just the job, that Leitz ELWD scope lens !)

Stitching is another technique I want to have a go at, having seen this :shock: effort on an Renaissance ceiling.
If I had a proper job I could buy one of Nikon's new shift lenses, just to play with..

-----
Another beginner's stacking question:

Many lenses exhibit deep field curvature, giving a annulus in focus. Am I right in thinking that any such ring of apparent clarity will in all likelihood be ridden with every known aberration, so the lens should be avoided?
I have such a lens, a Nikkor 35mm F2, somewhere (long lost). It's an awful lens, not suitable for anything vaguely flat.

ChrisR
Site Admin
Posts: 8668
Joined: Sat Mar 14, 2009 3:58 am
Location: Near London, UK

Post by ChrisR »

And too as well,
:?: :?: :?:
does it matter whether you go forwards or backwards, and
does it matter if some pics are out of sequence?

I mean, one could go through the eyes, etc at sharper aperture, then cover background foliage at a bigger step with a smaller aperture to get more DOF. Exposure compensated of course.

I still haven't got over the mechanics well enough to try it :roll:

rjlittlefield
Site Admin
Posts: 23564
Joined: Tue Aug 01, 2006 8:34 am
Location: Richland, Washington State, USA
Contact:

Post by rjlittlefield »

Forwards versus backwards is a minor difference in most cases. Generally it is safest to start with whichever end has the smallest field of view, so that all the other images will cover the whole area when they get rescaled. If you start with the end that has the largest field of view, then the others only cover part of the area when they get rescaled. That produces streaky margins, which of course can be cropped off, but in rare cases it can also degrade the accuracy of alignment.

Note that the smallest field of view can be either the foremost or the rearmost frame, depending on how you did the focusing. For example in your excellent table several posts above here, the plane at 62 mm shows magnification >5 if you focus by moving the lens, but <5 if you focus by moving the subject or the lens & sensor together.

It is not a good idea to have frames out of sequence. Most of the software packages work by aligning frames 1 and 2, then 2 and 3, then 3 and 4, and so on. This works well when sequential frames are very similar. But if say frames 2 and 4 were adjacent focus planes, while frame 3 is very much different, then it can happen that this stepwise alignment leaves 2 and 4 not fitted well with each other, resulting in echos or streaks. Sometimes it works, sometimes it doesn't.

Changing the aperture as you suggest should work fine. I have seen it done a couple of times, tested it myself a couple more. No apparent problems in those few cases, but it's not a lot of experience. Theoretically everything should be fine, it's just that practice and theory don't always turn out the same.

--Rik

Post Reply Previous topicNext topic