Thursday, August 22, 2013

Focus stacking cont'd.

A picture I made today by method 2 explained further on
Focus stacking (FS) is like 3D scanning. In such, human or other parts are scanned and images of virtual slices of the object are created at discrete positions along an imaginary axis. Software solutions could be further used to blend the obtained slice images into high resolution 3D virtual objects in which experts navigate to establish medical diagnoses or other useful 'stuff'. In FS, we similarly shoot a number of photographs of the same object, and like in traditional scanners, the frames are only sharp (and useful) on discrete planes perpendicular to the lens axis. Each such frame has a very shallow depth of field (DOF) that spreads incrementally in front and on the back of the focus plane. Shallow DOF is typical in macro photography where FS is mainly used for. Next, FS software maps out the blurred (out-of-focus) areas in each of the frames, and only keeps the sharp parts. By finally blending the latter together, a razor sharp photograph is obtained with a 'humongous' DOF (almost spectacular compared to conventional photography).

There are two ways to focus a camera on the aforementioned focus planes (incidentally, those same planes are parallel to the camera's CCD capturing element plane, if you haven't guessed it yet):

1. Keep the camera immovable on a steady tripod, pointing at the object, and use the lens ring to focus and shoot frames on a number of equally spread imaginary planes across the lens axis of the camera.

2. You focus at one extreme of the object (say, its front end), and then micro-displace the camera at new focus plane positions, for a discrete number of incremental steps, at which points you obviously shoot subsequent new frames, until you reach the object's other extreme (say, its back end).


I added those arrows on the 454's knob for better control
After all is said and done, (a) I still don't know which of the two methods yields better results, (b) whether indeed better results can be obtained by one of the two methods, and (c) what would be the reasons for possible differences in quality. If there are any differences, they must be the consequence of the blur/sharp region mapping algorithms used in the FS apps, right? I can only say that I tried both methods and found that the two of them equally yield great results. I should probably do a formal test with them, and systematically compare the results in a more formal manner. Until that is done, one thing I found to be true however:

To systematically focus on those incremental planes by precision turning of the focus ring, one does need indeed to tether the camera to a computer and control it with a dedicated app (like Helicon Remote). It's virtually impossible to obtain similar increments between focus planes by manually turning the focus ring. If you can manage to do it, then you're a champ. Also, the measurement scales typically depicted on focus rings are not terribly accurate to be used for such micro adjustments. For all practical reasons, only computers could manage this precision focusing properly. So, for method 1 you really need to tether your camera to a computer and control the shoot with an app. Furthermore, most people own cameras that are not readily supportable by the available tethering software (eg. Helicon Remote). So, you could really be left out in the cold...


Manfrotto 454 Micrometric Positioning Sliding Plate
To do 2 is much simpler. You mount a micro-positioning sliding plate like the one shown here on the head of your tripod, and then mount your camera on the sliding plate. After you focus your camera on one extreme of the object, and shoot a first frame, you slide the camera forwards (or backwards, depending which extreme you shot first) at regular increments by carefully turning the finger-tip control for precise micro movements; I used three entire revolutions of the knob in a few tests I did. It turned out to be fine. The larger the increments the less frames you'll have to shoot, obviously.

In other words, method 2 only requires you to invest in a sliding plate (plenty of solutions for a few bucks, less than 100 anyways) and any camera of your liking, without bothering about availability of tethering control apps. The FS you can eventually do with any dedicated app (available from free, via shareware, and a few good commercial solutions like Photoshop and Helicon).


Camera setup for shooting the coins
Of course, in case you have the proper gear supported by solutions like Helicon's, it's a much simpler and far more fine-tuned experience as you control everything from the computer, including all detail camera settings and shooting parameters. At the same time you can maintain the camera really amovible vis-à-vis the object and avoid the need for frame alignment later. Indeed, even using the sliding plate described above, a remote control to trigger the camera release button, and a super steady tripod like the 055XPROB I use, the resulting frames may still need to be further precision aligned for perfect results. The FS apps I use, Photoshop and Helicon Focus, are able to perform such alignments, but the lesser the need the better the result. I think...

Tuesday, August 20, 2013

Helicon Focus vs. Photoshop focus stacking

To clear things up beforehand, this is not an exhaustive comparison of the two as it would defeat the purpose. It's only about focus stacking, for which Helicon Focus is actually made, whereas for Photoshop it's only one of thousands of functionalities it otherwise offers. I'll only share my experience on the results of focus stacking based on a series of frames shot with my 5D Mark III and the Canon 100mm macro lens. The meerkat is a present I got on my latest b-day. The shots were programmed with Helicon Remote tethered to the 5D. I received Remote together with Helicon Focus Pro on an one year user license. The Photoshop is part of my Creative Suite 6 Academic Edition.

Helicon has plenty of functions and parameters to both, shoot pictures and post-process them. I used mostly its default settings. To understand how Helicon Remote works, you define the closest focus point, then the farthest, and it calculates the number of shots needed for best results between the two extremes, as well as the interval between two consecutive focus points. You can preview the results live (for Canon gear it can also show actual Depth of Field - DOF) and you can define the manual settings for exposure and speed, as well as the ISO setting, with their direct visual effect shown on your computer monitor. An additional Remote bonus is the ability to bracket exposure up to 15 different points and define the shooting parameters for each one of them individually (if you got the patience and know what you're doing, that is). I applied Exposure Bracketing for this demonstration and defined 4 bracket points with 1/3 diaphragm distance between them. Once all my shots were done (4 for Exposure bracketing for 9 focus points in all, that is 36 frames in total), I loaded them in Helicon Focus for post-processing and let Helicon do the rest. In honesty, I have no idea how they do HDR first and focus stacking next, I couldn't find anywhere where they explain that particular detail, so I asked them by email yesterday, but received no reaction yet... They seem to process all the frames at once. The combined result for HDR/FS out of Helicon Focus is shown on the left on the picture above (click for larger view). That of Photoshop is shown on the right.

Returning to Photoshop with the original 36 source files, I created 9 HDR files first with the Photoshop HDR function, whom I then combined via the Photoshop focus stacking (edit blend layers) function into a final shot. I'm not getting into details how to do this in Photoshop as the net is loaded with reviews and videos about this. Here I'm only comparing results.

The two final images, one from Helicon and one from Photoshop, I then opened in Lightroom and only corrected them for color balance by picking a gray spot in the meerkat's nose. The resulting pictures were combined together on a common canvas in Photoshop, and texts and arrows added subsequently in Voila. This could have been done in thousand different ways but that's how I did it. It's not important anyways.

As for the results...

Photoshop is far superior than Focus but it takes longer and is more complex to handle (unless one somehow automates the batch process in a script). Focus didn't quite handle the HDR effect properly, appeared less sharp, its color balance maybe appearing more pleasing to the eye at first sight, but in reality the Photoshop color balance is more correct as I compare my impression of the image with the real thing next to me as I write this. Worst of all though, the Focus stacking post-processing created this awful stain artefact on the meerkat face and blouse that is probably due to the processing algorithms, whereas the Photoshop rendering result is almost impeccable. It's also sharper and the HDR effect shows excellent dynamic with proper detail in both the dark and highlighted areas.

I can't stress enough how useful the Helicon Remote is though. This is an excellent tool that curiously enough they don't charge you for but offer it along Focus itself. I tried Focus without Remote and my results were appalling. You just can't get the right frames to blend without serious artefacts unless you use Remote. For them it's a necessity, for us it's a bonus. I had to pay for an annual subscription for Focus, but having seen what Photoshop does, I'll only use the Helicon Remote now to shoot the pictures and subsequently do the HDR and stacking within Photoshop. Kinda peculiar conclusion, but that's what I think. The fact that Photoshop didn't create the stain alone was good enough for me to abandon Focus for this FS purpose.

To be fair to Helicon, I am a novice in using Focus, and maybe there are tricks and hints and points to pay attention to, because of the stacking algorithms they use, to avoid the problems I had. But, problem is, I got no time to waste trying to find out. Photoshop does the job by design without 'special' hints and tricks, so why bother? Software Packages should perform as specified and not by wishful thinking... And do it simply without fuss, even for geeks like myself...

UPDATE: I'll be damned. Just moments after I posted that, I received the following email by Helicon Support. Enjoy:
--------------------------------------

Dear *******,
You have received an answer to your message (***********) from our support.
=================================================
No, Helicon Focus can only focus merge stack, at least in current version. So I would suggest to focus stack each exposure and then merge it HDR. Or, merge to HDR first and then focus stack. In the latter case please select HDR with global, not local operator. Otherwise artefacts on the resulting image are possible.
=================================================
Best regards,
Stas Yatsenko
Helicon Help Desk
http://support.heliconfilter.com
------------------------------------
You received this email as a registered user of one of the Helicon Soft Products.

--------------------------------------
So, it's either a huge coincidence or the guys at Helicon are continuously checking whatever is written about their products, real time! I am impressed! So, it was the HDR factor that brought about the stain on the Helicon result, then. Now you know. This of course changes the entire situation. I'll have to try what the say and come back to you. I'll use Focus with the Photoshop combined HDR files and then compare the two. More work. What else to do during summer anyways?

UPDATE 2: Here is the result, as promised, of focus stacking in Helicon Focus of the HDR files resulting from Photoshop. Eventually Focus didn't create the aforementioned artefact stains either. The problem was with Helicon's lack of information about combined focus and exposure bracketing. What a difference a proper Help file makes?! Actually, there's not much noticeable difference between the two after all.  In that case, maybe Focus is a more preferable solution to some folks because of the simplicity of use, and the many configuration parameters they provide. As for me, I dunno. I might use both just in case one is offering me better results than the other. For HDR related and exposure bracketing source files, I think I'll go Photoshop for the entire workflow from the start. For plain vanilla FS without HDR though, and since Photoshop takes somewhat longer, I might try Focus first, and if I don't like the result, try Photoshop next... Keep busy, in other words...


UPDATE 3: In posts like this one needs to be extremely fair and accurate. I therefore performed another test based on same source files again from another subject shoot (31 focus points in total), without exposure bracketing this time, to get HDR out of the way, that is. The result is shown here below. Click for a larger view. I have printed 'Fail' on the points where one method performed worse than the other. In this example Helicon Focus wins hands down. Like I said, one needs to try both methods in each individual case and keep the best results. Unless one is an expert on FS algorithms and, by simple inspection of the source files, one is capable of predicting which of the two methods will perform better... I'm not able to do that, not yet...