Prima Homepage
Generating C++ Modules
User Manual
The Command Shell
Running Imalab
Plugin Process
Pixels and Images
Interactive selection
Graphics: plots, profiles
Image file I/O
Image display
Connectivity Analysis
Image Processing(1)
Gaussian operators
Technical Documentation
Creating New Modules
Tutorial Download


Computing and Analyzing Difference Images

The diff-plugin demonstrates the functionalities of the segmentation module .

Processing Steps

The binary difference image between the current image and the reference image is computed, and run-length encoded (class RLEImage). The reference image is the n-th image preceding the current image, as specified by the variable ref-delta.

Connectivity analysis is then carried out on the difference image, yielding a list of regions, sorted by size.

Display Step

The difference image is displayed in screen position 1. For each connected region (larger than min-size), we display

  • the x-y-bounding box, color orange
  • the center of gravity
  • the first point encountered during image scan

Speeding up the computation.

The difference computation samples the images according to the variables x-step, y-step. Tuning these values, you can trad speed for quality. A region is guaranteed to be found if its extension is greater than the sample step.

Globals and Modifiable Parameters

The following parameters can be consulted and modified during experimentation:

  • x-step horizontal sampling step
  • y-step
  • thresh1 Threshold for red channel
  • thresh2 Threshold for difference
  • ref-delta distance to reference image
  • min-rsize minimum region size
  • connexity 0 means 4-connexity, 1 is 8-connexity

In order to modify one of the first 4 parameters, use the function:


The following global variables reflect the current state of the program:

  • imaref
  • rle
  • imgrefs
  • region-list
  • region-list0