3

Using Photoshop, I can take a burst of nearly identical exposures, "stack" them automatically aligning, and use the median stacking mode. This reduces shot noise and is something approximating a longer exposure from multiple short exposures.

Are there tools (stand-alone or PS/LR plug-ins) that are specialized at doing a better job? I suppose astrophotograhy has advanced tools for similar purposes. Problems I see include

  • sub-pixel mis-alignment between the shots
  • dumb per-pixel combining function
  • no integration with overall noise reduction

for a shot that's less than 100% pixel sharp due to shallow depth of field and the performance of the lens at large aperture, shot noise should stand out in a frequency or wavelet analysis. A shot combining function that looks at a kernel rather than a single pixel might make use of this.

I see periodic questions of "is there a way...". I have "a way", as specified by other posts on this SE. I'm wondering is there a better way, newer specialized tools or new goodies in Adobe's new 2015 editions, other raw processing tools, or cross-over from astrophotograhy?

  • 1
    I use a combination of the align_image_stack program, ImageMagick and ImageJ. E.g. to remove outliers and reduce the noise, you can first compute the maximum and minimum of the stack using ImageMagick and then take the average where you give the Maximum and Minium negative weights. In case of 6 images the weights would then by 1/4 for all the 6 remapped images and -1/4 for the Max and Min images. This is superior to taking the median because the standard deviation of the median is always more than that of average, so you get better noise reduction while still removing the outliers. – Count Iblis Jul 20 '15 at 20:30
  • I've seen how Median removes outliers but doesn't combine the remaining exposures but hopefully chooses a small error, while the Mean can be skewed by outliers esp in a small stack. So, I grasp what you're saying, but I don't follow the details. Is there a fleshed out instruction somewhere I could read? – JDługosz Jul 20 '15 at 22:15
  • I'll try to write up the details, I don't think there is a website explaining specifically this process in detail, what I've encountered on the web are explanations of how to do this when taking the median or just the plain average (in which case the outliers are not removed). – Count Iblis Jul 21 '15 at 16:24
  • On further reflection, I understand what you mean by weighed mean. But what commands acheive that? And can variations work for small number of samples, like 3? – JDługosz Jul 21 '15 at 22:43
  • With the method I've now described in my answer, with 3 images it would be the same as the media, except that it is then the median of the gray values of each color channel separately while the median command you can use with IamgeMagick will pick the the pixels of that image that has the median luminosity value. The latter option is better if you have only a few images as it will prevent unnatural color changes due to picking gray values for the different color channels from different pcitures. – Count Iblis Jul 22 '15 at 5:10
4

I use the following programs to do work involving image stacking.

  • The free of charge Hugin panorama stitcher uses the executable "align_image_stack" program, this program can be copied to some directory and be use as a standalone command-line program.

  • The free of charge ImageMagick program.

  • The free of charge ImageJ program

  • The free of charge Bioformats package for ImageJ needed to open LZH compressed TIFF files

My favorite way of removing outliers and removing the noise works as follows. I move the image files, say, im1.tif im2.tif etc. to a directory where I have put the executable "align_image_stack". There I open a command prompt and give the command:

align_image_stack -a al -C -t 0.3 -c 20 im1.tif im2.tif im3.tif im4.tif im5.tif im6.tif ...

The option -a sets the prefix, the choice "al" means that the remapped files will be al0000.tif, al0001.tif etc. The -C command will cause the remapped files to be cropped to the same size. The -t 0.3 sets the tolerance of the maximum allowed deviation of the control points the program will use for alignment, 0.3 means 0.3 pixels distance (default value is 3 if you don't give this command).

The lowercase -c command allows you to set the number of control points per sector of the image, the default value is 8, if you choose 20 you end up with hundreds of control points in total, usually this works very good. Finally you specify the files, the alignment is done in the sequence you specify (this can be important for HDR alignment, in that case you don't want to put the darkest image next to the brightest).

It can happen that the automatic alignment doesn't work well, in that case you can add the option -p test.pto. If you then start the Hugin program you can open the test.pto file and check out the control points, modify them and use the Hugin program to do alignment and remapping. In case you have a large number of files in the stack, there can be a small gradual drift in alignment and then you should use the Hugin program and add control point linking images that are far away from each other in the sequence.

The next step is to use the remapped files to remove the noise and outliers. The best way to proceed is to first normalize the images to have exactly the same exposure. The camera exposure changes in discrete steps due to changes in lighting which creates complications if we want to use the minimum and maximum to remove marginal outliers. To correctly normalize the exposures, you can transform to linear colorspace using ImageMagick. You open a command prompt and give the command:

convert al0000.tif -colorspace RGB lin0.tif

and you do that for all the files. Then you can open these files using ImageJ. If you start ImageJ, go to the plugins menu and click on the bioformats imprter, you can open the files lin0.tif, lin1.tif etc. You need to remove the alpha channel, you do that by selecting the 4th channel of each image and then in the image menu, you go to "stacks" and select "delete slice". The images will then become visible, this is due to ImageJ not handling alpha channels correctly. Then, in the Analyze menu you can select measure. Before you do that you can use the "set measurement..." to select all the items that you want to measure (mean, standard deviation modal value, median etc. etc.)

By measuring the average brightness values you can calculate by what factor you should normalize each picture. You then implement that by choosing in the "process" menu the option "math" and then you select multiply or divide.

If you are done, you save the images (not using BioFormats but by selecting the "file" tab in the menu and hitting "save"). Then because ImageJ does not handle channels and layers correctly in this case when dealing with LZH compressed tiff images, you'll have the different channels appearing as different layers. You can easily correct for that using ImageMagick by giving the command:

convert lin0.tif -combine lin0.tif

To remove the outliers, you compute images containing the maximum and minimum gray values in the stack. To compute the maximum, you give the command:

convert lin*.tif -evaluate-sequence Max mx.tif

To compute the minimum, you give the command:

convert lin*.tif -evaluate-sequence Max mn.tif

Then, you want to compute the average of the files such that for each point in the images you are calculating the average but with leaving out the minimum and the maximum. This is equivalent to summing up all the files lin*.tif and subtracting from that mx.tif and mn.tif and then dividing the result by the number n of files minus 2. If we put 1/(n-2) = w, then the following ImageMagick command needs to be given:

convert lin*.tif mx.tif mn,.tif -poly "w,1,w,1,w,1,......-w,1,-w,1" avl.tif

So, you give each of the lin*.tif files a weight of w, while the files mx.tif and mn,tif get a weight of -w, the "1" in the command sets the power to 1, as we're not going to raise the gray values to any power here.

Finally, you need to transform av.tif back to sRGB, you do that by giving the command:

convert avl.tif -set colorspace RGB -colorspace sRGB av.tif

So, you need to first tell ImageJ that avl is a linear colorspace image and then you can tell it to convert it to sRGB and store the result in av.tif.

| improve this answer | |
  • I see: find min and max into separate images first, then use -poly. Is imagej only being used to normalize the exposure? – JDługosz Jul 22 '15 at 5:06
  • Yes, you could perhaps do away with ImageJ if you have alternative means to normalize the exposure. I find it useful to have ImageJ as a computational tool, you can make a selection in the image and then the measurement function will apply to only the selection. You can divide images and then do measurement on the ratio. Noise can be measured using the standard deviation. – Count Iblis Jul 22 '15 at 5:19
  • The burst shots I've looked at use identical exposure for each. I suppose it could shift if I squeeze off multiple bursrts rather than holding the button down. – JDługosz Jul 22 '15 at 6:48
  • @JDługosz Yes, if the exposures are approximately the same, then there is little risk in skipping the normalization step. – Count Iblis Jul 23 '15 at 3:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.