www.photomacrography.net :: View topic - Fast Stacker (Arduino based automated focus stacking rail)
www.photomacrography.net Forum Index
An online community dedicated to the practices of photomacrography, close-up and macro photography, and photomicrography.
Photomacrography Front Page Amateurmicrography Front Page
Old Forums/Galleries
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Fast Stacker (Arduino based automated focus stacking rail)
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8, 9  Next
 
Post new topic   Reply to topic    www.photomacrography.net Forum Index -> Equipment Discussions
View previous topic :: View next topic  
Author Message
nsomnius



Joined: 25 Nov 2015
Posts: 14
Location: Berkeley, California

PostPosted: Tue Mar 08, 2016 12:08 pm    Post subject: Reply with quote

Excellent, thank you.
Back to top
View user's profile Send private message
pulsar123



Joined: 12 Jun 2015
Posts: 126

PostPosted: Tue Mar 08, 2016 1:45 pm    Post subject: Reply with quote

In other news: I am lucky to work for a large university! I discovered that we had a real entomologist on campus, and finally today I had a chat with the guy. He's also into macro photography (quite obviously), but not focus stacking. And then he was really nice to let me borrow two boxes of pinned insects (a few dozens of them; >20 different species) for my stacking experiments. That should keep me busy for a while Smile

Also, I am converging to a stacking software workflow which is purely based on free open source software (dcraw, Hugin: align_image_stack + enfuse, ImageMagick) and it looks like I am converging to results I like much more than what I managed to get with Zerene Stacker, without manual retouching. If it is all good I will post a tutorial here.
Back to top
View user's profile Send private message
rjlittlefield
Site Admin


Joined: 01 Aug 2006
Posts: 18095
Location: Richland, Washington State, USA

PostPosted: Tue Mar 08, 2016 2:37 pm    Post subject: Reply with quote

pulsar123 wrote:
If it is all good I will post a tutorial here.

That would be very helpful. At the highest level, the description "align_image_stack + enfuse" is a good summary of the PMax algorithm, so I will be very interested to see in more detail what you're doing to improve the result.

--Rik
Back to top
View user's profile Send private message Visit poster's website
pulsar123



Joined: 12 Jun 2015
Posts: 126

PostPosted: Tue Mar 08, 2016 5:19 pm    Post subject: Reply with quote

rjlittlefield wrote:
pulsar123 wrote:
If it is all good I will post a tutorial here.

That would be very helpful. At the highest level, the description "align_image_stack + enfuse" is a good summary of the PMax algorithm, so I will be very interested to see in more detail what you're doing to improve the result.

--Rik


enfuse provide many advanced settings which zerene doesn't have (AFAIK). It looks I need "--gray-projector=l-star" and a large value (like 31) for "--contrast-window-size" to both get a decent contrast and sharpness and minimize ugly artifacts around bright features. I'll do more testing to know for sure.

I also like dcraw over Adobe etc. in part because it is command line (so very easy to make a part of a single script which will do the whole processing), but also because it can be used to automatically remove all hot pixels, using a dark frame for the reference. I just need to find the way to recover coordinates of the brightest pixels in a dark frame (probably using ImageMagick), and then provide the list to dcraw as deadpixels.txt. In my stacked shots I can only see artifacts from just a handful of the brightest hot pixels, so identifying say 10 brightest pixels in a dark frame should be sufficient.
Back to top
View user's profile Send private message
pulsar123



Joined: 12 Jun 2015
Posts: 126

PostPosted: Thu Mar 10, 2016 1:24 pm    Post subject: Reply with quote

I actually have to step back here - after numerous attempts, I couldn't produce great results (much better than with Zerene) with open source software. The cases where I sort of solved the glowing halo issue happened to have other significant issues (lack of contrast for certain spatial frequences).

And that's probably not surprizing: OOF halos from bright elements are large, much larger than the contrast detection window, and basically become a part of the picture.

The only correct method to remove the halos (and also increase sharpness at all scales) seems to be 3D deconvolution using an experimentally measured 3D PSF (point spread function) for my system (camera + lens). This is what apparently all microscopic scientists do for their research (in biology etc.).

It has significant challenges:
- noise has to be dealt with, as deconvolution is very sensitive to it;
- it is technically challenging to measure the 3D PSF experimentally (you need a point light source - much smaller than the wavelength of the light, and complete darkness for the background);
- one needs very large RAM to properly deconvolve the whole stack in 3D: 45 GB of RAM to fit both 250shots x 90MB (15 Mpixels x 48 bit color) stack + same size PSF. Or only 1/3 of this (more manageable 15GB) if you do one color (r, g, b) at a time.

Anyone here tried to do this? The results can be quite spectacular. I played a bitwith the demo version of SmartDeblur program (http://smartdeblur.net/index.html) which is one of the few programs which attempt to do "blind deconvolution" - trying simultaneously to recover the underlying (and unknown) PSF and sharpen the image using that PSF. It is only 2D, and obviously can't do perfect job because of that, but after a few attempts to use it to a focus stacked photo I got some interesting results. How much more if I had the actual 3D PSF!

Also there is a hope that one can construct a 2D version of the experimental 3D PSF which can be used to deconvolve the end product - the stacked photo. Presumably one can apply the same focus stacking algorithm to the 3D PSF to get a 2D version of PSF. If this approach works at least partially as well as the full 3D approach, this could be a very interesting compromise, as it'll require much less memory (and time) to carry out.

I am thinking of trying to estimate my 3D PSF by shooting a stack of a reflection of a bare flash from a tiny metal ball (removed from a ball pen) glued to a piece of black paper and placed inside cylinder made of that paper (with the ball inside the cylinder). The microscope objective (attached to the camera) can move back and forth inside the other - open - end of the cylinder. Then one can make a small hole half away in the cylinder, and place an external flash ~2-3m away in the way that its light would reach the metal ball through the small hole. Finally, one can place a disk of black paper on the camera around the objective's base, to eliminate any light from reaching the metal ball from the open end of the cylinder. Something like this:

artificial_star by First Last, on Flickr

This could be interesting - if done properly, I should be able to see the Airy diffraction disk from this artificial star (flash reflected in the ball). This could be an ultimate test of the resolving power of my objective and the stability of my rail, in addition to providing me with experimental 3D PSF.

Of course 3D PSF at the frame edges will be different from the one at the center, but my hope is that the central PSF can still do a reasonable deconvolution job at the edges.
Back to top
View user's profile Send private message
g4lab



Joined: 23 May 2008
Posts: 1424

PostPosted: Fri Mar 11, 2016 2:17 am    Post subject: Reply with quote

You should look up:

http://www.drjohnruss.com/

http://www.reindeergraphics.com/index.html

They have Photoshop plug-ins that do a variety of deconvolution tricks.
Whether they will be useful for your purposes I cannot guess.
Back to top
View user's profile Send private message
pulsar123



Joined: 12 Jun 2015
Posts: 126

PostPosted: Fri Mar 11, 2016 9:58 am    Post subject: Reply with quote

g4lab wrote:
You should look up:

http://www.drjohnruss.com/

http://www.reindeergraphics.com/index.html

They have Photoshop plug-ins that do a variety of deconvolution tricks.
Whether they will be useful for your purposes I cannot guess.


Thanks for the links, but the first one provide a PS plugin which doesn't show up inside my PS5 (probably some incompatibility). The second page's download links are broken (I'm getting 404 error).
Back to top
View user's profile Send private message
g4lab



Joined: 23 May 2008
Posts: 1424

PostPosted: Fri Mar 11, 2016 11:11 am    Post subject: Reply with quote

In one of his books he (Dr. Russ)makes the source code available for most of those plug ins but you have to compile them yourself. But iirc there is a CD so you don't have to type them in.
http://www.amazon.com/Introduction-Image-Processing-Analysis-John/dp/0849370736/ref=sr_1_1?s=books&ie=UTF8&qid=1447416687&sr=1-1&keywords=introduction+to+image+processing+and+analysis
Try calling them. The owner of Reindeer Graphics is Dr. Russ' son, a PhD software engineer.
Back to top
View user's profile Send private message
rjlittlefield
Site Admin


Joined: 01 Aug 2006
Posts: 18095
Location: Richland, Washington State, USA

PostPosted: Fri Mar 11, 2016 12:43 pm    Post subject: Reply with quote

pulsar123 wrote:
I actually have to step back here - after numerous attempts, I couldn't produce great results (much better than with Zerene) with open source software. The cases where I sort of solved the glowing halo issue happened to have other significant issues (lack of contrast for certain spatial frequences).

That's disappointing. I had great hopes that some of the wide range of options available in enfuse would turn out to give a big improvement. But that still might be a fruitful path for experiment, since it is far simpler to run experiments by driving enfuse than by programming that same math from scratch.

Quote:
The only correct method to remove the halos (and also increase sharpness at all scales) seems to be 3D deconvolution using an experimentally measured 3D PSF (point spread function) for my system (camera + lens). This is what apparently all microscopic scientists do for their research (in biology etc.).


It has significant challenges...

One additional challenge is that with opaque subjects, the geometry of the subject will affect which parts of the 3D PSF actually contributed to the captured images. This makes the deconvolution process even more complicated than it is with transparent subjects.

I think it's peripheral to your application, but you might want to take a look at 3D Deconvolution or Not on Fluorescence Stack. The discussion as it evolves on pages 2 and 3 of the thread is interesting, and Charles Krebs' results at http://www.photomacrography.net/forum/viewtopic.php?p=134954#134954 may be especially thought-provoking.

--Rik
Back to top
View user's profile Send private message Visit poster's website
pulsar123



Joined: 12 Jun 2015
Posts: 126

PostPosted: Fri Mar 11, 2016 1:56 pm    Post subject: Reply with quote

I actually still prefer the look of enfuse vs. Zerene, even before any PP (deconvolution and sharpening). Be the judge:

Zerene vs. Enfuse by First Last, on Flickr

- Top: Zerene DMap
- Middle: Zerene PMax
- Bottom: Enfuse

I like the Enfuse result better, because it is sharper without too much noise. It does create other artifacts (halos around bright details), but apparently there are some ways to deal with it. And DMap has terrible artifacts in my tests.

And this is what I get after applying Smart deBlur (Auto PSF):

deblur by First Last, on Flickr

Top is Zerene Pmax, bottom is Enfuse. Even after sharpening Enfuse is almost noise free, whereas Pmax is pretty noisy.

So Enfuse does look interesting, it just needs more tinkering.
Back to top
View user's profile Send private message
rjlittlefield
Site Admin


Joined: 01 Aug 2006
Posts: 18095
Location: Richland, Washington State, USA

PostPosted: Fri Mar 11, 2016 2:40 pm    Post subject: Reply with quote

Excellent -- thanks for the further information.

In your DMap result, what attracts my attention is a lot of fine blotches in what should be uniform areas. That's typically caused by a combination of small radius setting and a contrast threshold that is set too low, causing decisions to be dominated by image noise rather than actual detail. Depth map methods in general tend to have trouble with halos around edges and bristles, but the blotches that I see here look like they're caused by inappropriate parameter settings. (One of the very nice things about PMax versus DMap is that there are no settings to go wrong.)

--Rik
Back to top
View user's profile Send private message Visit poster's website
nsomnius



Joined: 25 Nov 2015
Posts: 14
Location: Berkeley, California

PostPosted: Fri Mar 11, 2016 2:57 pm    Post subject: Reply with quote

Sadly, Reindeer Graphics seem to have stopped developing their software, a long time ago at that. The last time it worked in Photoshop was many versions ago, CS2 possibly. Optipix had a Power Median tool that was amazing for removing power lines and things.

In talking about deconvolution sharpening, are you referring to Richardson-Lucy Deconvolution? If not, I think that's worth a try as well. I know that Raw Therapee (free) offers it as an option as well as the not so free Maxim DL. Probably others I don't know about.
Back to top
View user's profile Send private message
pulsar123



Joined: 12 Jun 2015
Posts: 126

PostPosted: Fri Mar 11, 2016 3:06 pm    Post subject: Reply with quote

There are many options for vanila deconvolution; I am specifically interested in "blind deconvolution" which is apparently a rare beast, at least in free software.

I just stumbled across this reasearcher-written software (only Windows, so will try it when I get home):

http://www.deconvolve.net/index.html

Anyone tried it? They claim blind deconvolution support for 2D and 3D (bright field - so it is focus stacking as far as I understand), including spatially variable.
Back to top
View user's profile Send private message
JH



Joined: 09 Mar 2013
Posts: 906
Location: Vallentuna, Stockholm, Sweden

PostPosted: Sat Mar 12, 2016 2:27 am    Post subject: Reply with quote

pulsar123 wrote:
Pmax is pretty noisy

You have solved this with the use of another program. For me that - for a lot of reasons - prefer Zerene Stacker I usually handle noise before stacking with PMax. Low ISO, good lighting helps and sometimes gives me almost noiseless pictures to begin with. When I convert my raw files to tiff or jpg before stacking I do not sharpen the single pictures at all and most of the times I check at high magnification if I have to reduce noise further before converting.
When sharpening the picture I have come to like the easiness of adobe smart sharpen. Here is an example of what I usually do.

http://www.photomacrography.net/forum/viewtopic.php?p=157470#157470

Regards J├Ârgen
Back to top
View user's profile Send private message Visit poster's website
pulsar123



Joined: 12 Jun 2015
Posts: 126

PostPosted: Sat Mar 12, 2016 1:34 pm    Post subject: Reply with quote

^ Thanks, looks good, though I see quite a bit of large scale fuzziness - something I am struggling with myself, and something I hope a proper 3D PSF would fix. I also make sure there's no sharpening before focus stacking, as from my tests this results in better outcome.

Here is a new example: my Arduino rail with 5um steps, 310 shots, Canon electronic shutter (with Magic Lantern + my rail control for the external flash). Two-stage stacking (first stage: 23 frame slabs with 30% overlap), all done with open source (align_image_stack + enfuse), 3-scale sharpening at the end with ImageMagick:

Fly at 10:1 by First Last, on Flickr

This is from the box of pinned insects I got from our University entomologist. The eyes are totally dry, correct? Is there a way to bring them to life without some rare chemicals, and without distroying the specimen? Perhaps spraying with water (I have very fine cold water "steam" sprayer)?

I am still not happy with the result - I've seen sharper looking photos made at the same magnification, with the same objective. Ans this is not a small scale blur (so e.g. my rail is not to blame), it is more of the large-scale "haloness", due to the long wings of the PSF.

Here is another idea on how to measure 3D PSF experimentally: I can buy a very small laser-drilled pinhole online, 100um or perhaps even smaller. Then I can place a flash behind, and shoot a stack of the pinhole with my macro lens. Of course it is much larger than the light wavelength, but this is a well defined target - circular with a known diameter and sharp boundary - should be fairly easy to recover the true 3D PSF with blind deconvolution software?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    www.photomacrography.net Forum Index -> Equipment Discussions All times are GMT - 7 Hours
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8, 9  Next
Page 8 of 9

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group