• site home
  • blog home
  • galleries
  • contact
  • underwater
  • the bleeding edge

the last word

Photography meets digital computer technology. Photography wins -- most of the time.

You are here: Home / The Last Word / Mitigating subject motion in slit scan images

Mitigating subject motion in slit scan images

August 25, 2014 JimK Leave a Comment

As many of you know, I’ve been doing slit scans of plants, and I’ve been struggling with image artifacts due to subject motion. In the past few days I’ve been working on a Matlab program to deal with the artifacts and at the same time assemble several images into a complete, visually seamless composite.

In this post, I’ll walk through what the program does, and how it does it. The reason for posting this level of detail is not mainly to help out the photographers who are doing the same kind on photography — I figure that they’re thin on the ground — but to give those of you with some programming skills the kinds of things that you could do that might help your own photography by allowing you to do things that you can’t do in Photoshop and automate things that you have to do manually in Ps.

The files that form the basis for the final image are 14 in number, each one a 58176×6000 pixel TIFF produced by a Betterlight SUper 6K scanning back. Each file represents about 45 minutes total exposure. The program optionally performs median filtering on the images with a kernel that’s 128 pixels in the time direction and 1 pixel in the other one, reduces the number of pixels in the time direction by a factor of 16 using an algorithm calculated to average out noise, assembles all the images into one, then performs more median filtering. It writes out all the individual files and a series of composite ones with varying amounts of median filtering.

The first part of the program is just housekeeping, setting up file names and a few constants:

matlabhousekeeping

Median filtering is a computationally-intensive operation for large extents, and Matlab’s implementation does no parallelization, at least if you don’t have the parallel processing toolkit. Using 128×1 extents on the original files took a long time and, although it removed most of the artifacts, it didn’t get them all. So I was pleased to find that using a 8×1 extent on the files that had been compressed by a factor of 16 in the time dimension produced substantially the same results. I left the median filtering in the program, but made it optional, and turned that option off.

The way I compress the files in the time dimension is through repeated applications of bilinear interpolation, reducing the size of teh file by a factor of two at each step. The program next sets up a array of image sizes:

imagesizes

Then I read in the files, rotate them if necessary (Betterlight and Matlab don’t always see eye to eye on orientation), and (the first time around) set up the image container that will receive the composite image.

forloop1

 

Then I do the median filtering if it’s desired:

medfilt1

Then I do the successive resamplings and write out the files:

resample

Finally (for this for loop, anyway), I put the squeezed files into the composite container:

assemble

All that’s left is to do various amounts of median filtering and write out the filtered composite files:

finalmed1

There are short-duration disturbances due to wind, and longer ones that are caused by insects crawling around on the leaves of the plant. I thought at first that I’d have to pick between different extents of median filtering depending on what was going on minute to minute. However, I was pleasantly surprised to find that there was no perceptible degradation to the image sharpness even when using extents of 512 (!) pixels.

Here’s a insect-driven (slow) artifact with an extent of 32×1:

med32

It’s softened, but still ugly.

With an extent of 64×1, it looks like this:

med64

Almost all gone.

Doubling the extent again to 128, we get this:

med128

A hair better.

It looks like this operation is not going to require any hand tweaking, at least for the succulent pictures.

Success here has emboldened me to go back to subjects whose motion had stymied me in the past, like trees with blowing branches. More to come.

 

The Last Word

← Traveling with Sony alpha 7’s Downsampling and averaging →

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

May 2025
S M T W T F S
 123
45678910
11121314151617
18192021222324
25262728293031
« Apr    

Articles

  • About
    • Patents and papers about color
    • Who am I?
  • How to…
    • Backing up photographic images
    • How to change email providers
    • How to shoot slanted edge images for me
  • Lens screening testing
    • Equipment and Software
    • Examples
      • Bad and OK 200-600 at 600
      • Excellent 180-400 zoom
      • Fair 14-30mm zoom
      • Good 100-200 mm MF zoom
      • Good 100-400 zoom
      • Good 100mm lens on P1 P45+
      • Good 120mm MF lens
      • Good 18mm FF lens
      • Good 24-105 mm FF lens
      • Good 24-70 FF zoom
      • Good 35 mm FF lens
      • Good 35-70 MF lens
      • Good 60 mm lens on IQ3-100
      • Good 63 mm MF lens
      • Good 65 mm FF lens
      • Good 85 mm FF lens
      • Good and bad 25mm FF lenses
      • Good zoom at 24 mm
      • Marginal 18mm lens
      • Marginal 35mm FF lens
      • Mildly problematic 55 mm FF lens
      • OK 16-35mm zoom
      • OK 60mm lens on P1 P45+
      • OK Sony 600mm f/4
      • Pretty good 16-35 FF zoom
      • Pretty good 90mm FF lens
      • Problematic 400 mm FF lens
      • Tilted 20 mm f/1.8 FF lens
      • Tilted 30 mm MF lens
      • Tilted 50 mm FF lens
      • Two 15mm FF lenses
    • Found a problem – now what?
    • Goals for this test
    • Minimum target distances
      • MFT
      • APS-C
      • Full frame
      • Small medium format
    • Printable Siemens Star targets
    • Target size on sensor
      • MFT
      • APS-C
      • Full frame
      • Small medium format
    • Test instructions — postproduction
    • Test instructions — reading the images
    • Test instructions – capture
    • Theory of the test
    • What’s wrong with conventional lens screening?
  • Previsualization heresy
  • Privacy Policy
  • Recommended photographic web sites
  • Using in-camera histograms for ETTR
    • Acknowledgments
    • Why ETTR?
    • Normal in-camera histograms
    • Image processing for in-camera histograms
    • Making the in-camera histogram closely represent the raw histogram
    • Shortcuts to UniWB
    • Preparing for monitor-based UniWB
    • A one-step UniWB procedure
    • The math behind the one-step method
    • Iteration using Newton’s Method

Category List

Recent Comments

  • JimK on Goldilocks and the three flashes
  • DC Wedding Photographer on Goldilocks and the three flashes
  • Wedding Photographer in DC on The 16-Bit Fallacy: Why More Isn’t Always Better in Medium Format Cameras
  • JimK on Fujifilm GFX 100S II precision
  • Renjie Zhu on Fujifilm GFX 100S II precision
  • JimK on Fuji 20-35/4 landscape field curvature at 23mm vs 23/4 GF
  • Ivo de Man on Fuji 20-35/4 landscape field curvature at 23mm vs 23/4 GF
  • JimK on Fuji 20-35/4 landscape field curvature at 23mm vs 23/4 GF
  • JimK on Fuji 20-35/4 landscape field curvature at 23mm vs 23/4 GF
  • Ivo de Man on Fuji 20-35/4 landscape field curvature at 23mm vs 23/4 GF

Archives

Copyright © 2025 · Daily Dish Pro On Genesis Framework · WordPress · Log in

Unless otherwise noted, all images copyright Jim Kasson.