Dual energy X-ray image processing software
We develop software that turns the "raw" data of an X-ray detector into an informative image with material discrimination — from the acquisition of lines from the detector to a real-time color image on the operator's screen. At its core is multi-energy (dual energy) processing, which makes it possible to distinguish organics, inorganics and metals.
What dual energy is and why it is needed
An ordinary X-ray image shows only the degree of radiation attenuation — it is hard to tell apart, for example, a thick layer of plastic from a thin piece of metal. The dual energy method (two-energy, and in its extended form multi-energy) measures attenuation in several energy ranges simultaneously. By comparing the material's response to "soft" and "hard" radiation, the software estimates the substance's effective atomic number (Zeff) and density.
This makes it possible to:
- classify materials and highlight them by color — organic, inorganic, metal;
- more reliably detect threats and prohibited items in security screening tasks;
- improve recognition quality by working with several energy channels and several scanning angles.
We implement both the classic two-energy approach and more complex multi-energy schemes — for maximum information yield from the image.
Capabilities of our software
Image acquisition and assembly
- Real-time acquisition of image lines from the detector with buffering.
- Assembly of a two-dimensional image from a sequence of lines, taking the scanning direction into account.
- Support for presampling to stabilize the detector.
- Cropping of service pixels, generation of a unique ID for each scan.
Detector calibration
- Offset calibration — compensation of the detector's dark current.
- Gain calibration — equalization of pixel sensitivity (by mean, minimum, maximum or target value).
- Independent calibration of each energy channel and each scanning angle.
- Calibration on the detector (on-board) or in the software (off-board), with the coefficients loaded into the detector system.
Image processing and enhancement
- Dynamic range management (DRM) — adjustment of the black, white and mid points, individual gamma for each energy channel and angle.
- Sharpening filters and an unsharp mask with adjustable radius, amplitude and threshold — applied to the luminance channel.
- Stepwise correction of brightness, contrast and gamma controlled via "hotkeys".
Color coding and material discrimination
- Colorization that distinguishes materials by effective atomic number (Zeff): organic / inorganic / metal.
- More than 15 color modes: standard security screening palette, grayscale, organic/inorganic emphasis, Zeff palettes, pseudo color, liquid mode.
- Material filters (material stripping) — hiding/highlighting of substance classes.
- Modular colorization architecture: the core, written in pure C++ (with no dependency on the GUI), is provided as a pluggable module (DLL/SO) with a C-compatible ABI — modes and palettes are extended without reworking the main software.
→ Details below in the "How colorization works" section.
Real-time visualization
- Hardware acceleration on modern OpenGL (programmable pipeline).
- Zooming, panning, fit-to-window, fast navigation across regions.
- Support for one or two monitors (one angle per monitor or a combined view).
- Histograms for the energy channels and the LAB components.
Archive and operator workstation
- Automatic saving of scans with metadata, maintaining an image database.
- Event and error log, equipment telemetry.
- Role separation (operator / administrator).
Solution architecture
A typical processing pipeline looks like this:
- Detector
- line acquisition
- frame assembly
- calibrationoffset · gain
- DRM
- filteringsharpening · unsharp
- colorizationdual energy
- OpenGL visualization
- archive
Each stage is configured through processing profiles that the operator can switch on the fly. Heavy operations are moved to separate threads, and rendering is accelerated by the GPU — this ensures real-time operation even at high conveyor speeds.
How colorization works: from two energies to a color image
Colorization in X-ray inspection is not "coloring for the sake of beauty" but a way to show the operator what each object is made of. We have our own colorization engine that turns two "raw" energy channels into a color image, where color encodes the material type and brightness encodes density and thickness. Below is how this process is built. The depth of work here is precisely our expertise: most integrators take colorization as a "black box", whereas we master it at the algorithm level.
Step 1. Material classification by two energies
The input consists of two values for each pixel — high-energy (High Energy, HE) and low-energy (Low Energy, LE). Their ratio depends on the substance's effective atomic number (Zeff): light elements (organics) and heavy ones (metals) attenuate "soft" and "hard" radiation differently.
The engine uses a two-dimensional classification table (LUT) 1024×1024: a pair of (LE, HE) values addresses a cell where the material class has been written in advance. Classification of each pixel is performed in a single memory access — fast and deterministic, which is critical for real time. Materials are split into groups:
- organics — light elements (explosives and narcotics, plastics, food, wood, fabrics);
- inorganics and mixtures — substances intermediate in composition;
- metals and heavy materials;
- background/air and impenetrable zones (overly dense areas) — highlighted separately; impenetrable areas are optionally marked in red.
Step 2. Forming the brightness (grayscale) channel
In parallel, a brightness channel is built that reflects density and thickness:
- HE/LE fusion — the channels are combined with a weight that depends on the degree of penetration, in order to preserve detail in both light and dense areas.
- Tone curves (8 modes) — logarithmic (strong/weak), linear and exponential, with two saturation thresholds; chosen according to the nature of the load.
- Absorption gamma correction — 51 steps (−25…+25) for fine-tuning contrast by density.
- Penetration modes — Standard, High Penetration, Low Penetration, Slice — to "punch through" dense objects or, conversely, to bring out detail in light ones.
- Dynamic brightness (Shadow) — automatic or manual adaptation for each frame.
For performance, these transformations are composed into a single end-to-end LUT: instead of several passes over the image, a single pass is performed — and this is what enables real-time operation.
Step 3. Color modes (palettes)
The material class and brightness are combined and displayed through the selected palette. The supported set of modes (easily extensible):
| Mode | Purpose |
|---|---|
| Material Color (standard) | Classic security screening palette: orange — organics, green — mixtures, blue — metal/inorganics |
| Grey | Colorless grayscale — maximum detail and penetration |
| Organic Single / Single+ (OS / OS+) | Emphasis on organics, suppression of the rest |
| Material / Inorganic Single (MS / MS+) | Emphasis on inorganics and metals |
| Zeff 7 / 8 / 9 | Palettes with different effective atomic number thresholds |
| Pseudo Color 1–6 | Pseudo-color schemes to increase visual contrast |
| Liquid | Mode for liquid analysis |
Step 4. Material filters (material stripping)
The operator can "remove" entire classes of materials from the image to focus on threats:
- All materials;
- Organics only / Inorganics only;
- Hide organics / Hide inorganics (organic / inorganic stripping) — only the class of interest remains against the background.
Image enhancement
On top of colorization, the following are applied:
- Edge enhancement (modified Laplacian) — sharp contours of objects;
- Super Enhance — local contrast enhancement;
- Super Penetration — processing of dark (dense) zones, algorithmically optimized down to linear O(W·H) complexity.
Real time: line-by-line processing
The engine works in two modes:
- full-frame — for static scans and the archive;
- streaming (line-by-line) — data is processed as columns arrive from the line-scan detector. Edge enhancement uses a sliding window of three columns with a delay of just one column — on the order of 1.7 ms at 600 columns/s. This is exactly what provides a "live" image on the moving conveyor.
Engine architecture
The colorization core is pure C++17 with no dependency on the GUI (Qt is not required). This makes it possible to embed the engine both into the desktop operator software and into server/sorting pipelines (see X-ray transmission sorting XRT). The output is a ready ARGB frame; the set of color modes and palettes is extended without changing the calling code.
Technology stack
- C++ (high-performance processing core), modular DLL/SO with
extern "C"ABI. - OpenGL with a programmable pipeline for visualization.
- Qt for the operator interface.
- Cross-platform: Windows and Linux.
- Thread-safe architecture for parallel processing of multiple images.
X-ray material sorting (XRT)
The same principle of separating materials by density and effective atomic number is the foundation of X-ray transmission sorting (XRT, X-Ray Transmission). Unlike security screening, the image is not shown to the operator but analyzed automatically: the software classifies each object on the belt in real time and issues commands to the ejection mechanisms. This is how the tasks of sorting waste, ore and minerals, scrap and recyclables are solved.
→ Details on a separate page: X-ray material sorting (XRT)
Where it is used
- Security screening X-ray scanners — hand luggage, baggage, cargo.
- X-ray transmission sorting (XRT) — sorting of waste, ore, scrap and recyclables.
- Industrial X-ray inspection — defect detection, fill control.
- Food inspection — foreign-body (metal, glass, stone, bone) and fill control in food.
Related services
- X-ray transmission sorting (XRT) — automated application of the same material discrimination for sorting.
- Integration of X-ray detectors — the data source for processing.
- X-ray system controllers — control of the generator and conveyor, synchronized with processing.
- Automatic detection & object recognition (AI) — automatic threat, foreign-body and defect detection on the image.
Let's assess your image processing task together
Tell us which detector and generator you work with and which materials you need to distinguish — we'll propose a processing pipeline and colorization modes for your task.