Semi-automated image acquisition

My installation allows (finally) to take precise captures automatically in order to generate gigapixel panoramas.

It is composed of 5 crucial elements:

  • the micrometer stage to control the microscope
  • the electronic board that manages the stage
  • the firmware of the electronic board
  • the control and automation software for image capture
  • the image composition software to generate the panoramas


3D render of the micrometric stage.

The motorized stage consists simply of a SEMY60-AC micrometric stage coupled to two stepper motors.

This kind of stage can (could) be found for about 30 euros, and its characteristics are the following:

Table size: 60 x 60mm
Load resistance: 44.1N
Stroke: ± 6.5 mm
Accuracy: 0.01mm
Parallelism: 30μm
Parallelism in motion: 20μm
True Straightness: 3μm

Z coupling

Quite simple to realize but nevertheless important, it is necessary to couple the knob to adjust the height (Z) with a motor to control the focus from the computer.


The firmware is what makes the hardware usable by connecting it to a computer.

It is coded in C, and recognizes a very simple protocol composed of the following messages:

SX: Start motor X
SY: Start motor Y
SZ: Start motor Z

EX: Turn off motor X
EY: Turn off motor Y
EZ: Turn off motor Z

MX pos [speed]: Relative movement in X
MY pos [speed]: Relative movement in Y
MZ pos [speed]: Relative movement in Z

PX pos [speed]: Absolute positioning in X
PY pos [speed]: Absolute positioning in Y
PZ pos [speed]: Absolute positioning in Z

POS: Get the current position

HOME: Move to the origin
FAN speed: Set the fan speed
SPD speed: Set the speed of movement

It also has safeguards to prevent you from moving outside the defined area.

Computer control

My software is able to retrieve the video stream from the camera, and control the microscope stage with keys or in an automated way.

Features of the software:

  • Color correction / Histogram / Exposure
  • Stage movements and focus control
  • Motors control and positioning
  • Automatic minimap and tile grid
  • Zmap to automate focus
  • Chromatic aberration correction module
  • Automated scanline acquisition module
  • Image capture with intelligent file naming
  • Localized capture (cropped area)
  • Post-acquisition computer sleep mode

Color correction

Color correction uses a LUT generated specifically for the light source used (a 4 watts LED).

It is also possible to display an RGB histogram to select the best exposure.

Without correction (left) - With correction (right)


It is possible to define an arbitrary number of focus points. The software will then be able to interpolate the Z value according to the current position, thus allowing a completely clean panorama.

4 points zmap visualized on the minimap.

Generally, 4 points (one per corner) are sufficient if the die has not been damaged.

Acquisition Routine

The acquisition is done as follows.

  1. Turn on the microscope and HOME.
  2. Place the chip to be observed in the light beam. We try to place it relatively straight.
  3. Open the minimap in the software, and move the microscope until you find a corner of the chip.
  4. We focus and define a Z point
  5. We repeat for each of the 4 corners of the chip
  6. We define on the minimap the area we want to capture
  7. Check if the focus is ok on some strategic points (ex: center)
  8. Start the automatic capture and wait

Demo of the acquisition process.

Chromatic aberration correction

The chromatic aberration correction module will automatically take 3 shots (one for each channel) with different focus, depending on the lens used, and then recompose the final image.

Without correction (left) - With correction (right)

The blue channel is particularly affected.

Composition of the final image

I used to compose my panorama using external software (ICE or hugin), but several limitations quickly made their use too tedious to create gigapixel panoramas.

My installation allows to generate a series of tiles, very well aligned to the displacement grid defined in the software.

It is then possible to stitch these tiles by coding an algorithm that will paste them one by one and by correcting the offset error between an image and its neighbors.

The algorithm works very well, is much faster than hugin/ICE, and has a cache system to be able to recalculate some parts without starting from scratch.

Final generation of the panorama using the editor.

If some tiles are misplaced, it is possible to reposition them manually in the panorama editor.


  • Fast automatic placement
  • Slow automatic placement (more precise, for corner cases)
  • Tiles placement visualization
  • Errors detection (heatmap)
  • Manual placement for unsolvable problems
  • Line/Column/Combined modes
  • Dynamic margins
  • Tile cursor to move from a tile to another with the keyboard
  • Show only the line/column assotiated to the selected tile
  • Multiple zoom levels
  • Cache system for tiles thumbnails
  • Import/Export computed offsets
  • Recompute area (usefull if an area was blurry so we can recapture it)
  • Fast .tga export that supports gigapixel images