AeroBOS: Software-Defined Optical Gas Leak Visualization

Tagline: Exploring how ordinary cameras and Background-Oriented Schlieren techniques can reveal gas-induced refractive disturbances through computer vision.

Inspiration

Fugitive gas emissions, including methane and volatile organic compounds (VOCs), contribute to climate change, while certain gas releases can create serious fire, explosion, or exposure hazards in industrial environments. Sulfur hexafluoride (SF₆), used in electrical equipment and other specialized applications, is also a potent greenhouse gas.

Detecting these emissions early is an important challenge for refineries, chemical plants, biogas facilities, and pipeline infrastructure.

Conventional surveillance cameras cannot directly identify most colorless gases. Specialized optical gas imaging (OGI) cameras can visualize certain gas plumes by detecting infrared absorption within appropriate spectral bands, but their acquisition and deployment costs can limit the number of locations monitored.

We asked ourselves:

Could ordinary cameras, combined with computational imaging and optical-flow analysis, reveal visual disturbances associated with gas plumes under suitable experimental conditions?

That question inspired AeroBOS.

AeroBOS explores Background-Oriented Schlieren (BOS), an optical technique that detects apparent image displacements caused by refractive-index variations along the light path. By combining this physical principle with computer vision, image processing, and a browser-based interface, the project investigates a lower-cost approach to visualizing plume-like disturbances.

Our objective is to make optical-flow-based gas visualization accessible for experimentation, research, and future industrial evaluation.

What It Does

AeroBOS is a software-based image-processing pipeline that analyzes video for spatially varying image displacements and visualizes patterns that may be consistent with refractive disturbances.

It combines dense optical flow, spatial divergence, regularized Fourier-domain processing, plume-like region segmentation, and annotated video output.

Key Features

  1. Background-Oriented Schlieren Analysis

AeroBOS compares a reference image with a subsequent frame to estimate apparent image displacement.

Dense optical flow is used to estimate horizontal and vertical displacement fields. Spatial derivatives of these fields help identify localized patterns that may be associated with refractive disturbances.

The effectiveness of this approach depends on factors such as background texture, camera stability, lighting conditions, viewing geometry, and the strength of the refractive disturbance.

  1. Fourier-Domain Field Reconstruction

The system calculates the spatial divergence of the estimated displacement field and processes it using a regularized Fourier-domain operator.

This produces a scalar diagnostic field for visualization.

The resulting field should not automatically be interpreted as a direct measurement of gas concentration or optical path difference. Such an interpretation requires a physically justified forward model, appropriate calibration, and validation against reference measurements.

  1. Plume Visualization

AeroBOS applies adaptive thresholding and morphological image-processing operations to identify regions of interest.

Detected regions can be displayed as false-color overlays on the original video, helping users investigate changes across successive frames.

The visualization is intended to highlight candidate refractive disturbances rather than conclusively identify a particular gas.

  1. Quantitative Image-Space Metrics

For segmented regions, AeroBOS can calculate image-space properties such as:

Region area in pixels. Region centroid. Apparent boundary expansion or contraction. Changes in region area over time. Estimated displacement-field statistics.

Converting these measurements into physical quantities, such as square metres or kilograms per hour, requires additional calibration and validated physical models.

  1. Interactive Web Interface

The Streamlit interface provides a convenient way to upload a video, adjust processing parameters, and compare the original footage with its annotated output.

The interface is designed to make experimentation accessible without requiring users to interact directly with the underlying processing modules.

  1. Offline Processing

The core image-processing pipeline is designed to operate locally using Python, OpenCV, and NumPy.

Once the software and its dependencies are installed, video analysis does not inherently require cloud APIs or an internet connection.

Processing speed depends on video resolution, hardware capabilities, algorithm settings, and implementation details.

How We Built It

AeroBOS is organized into modular components that separate optical-flow estimation, mathematical processing, region analysis, video generation, and user interaction.

  1. Optical Physics and Mathematical Foundation

Background-Oriented Schlieren is based on the relationship between spatial variations in refractive index and the apparent displacement of background features viewed through a refractive disturbance.

For a gas mixture under suitable conditions, refractive index can be approximated using a Gladstone–Dale-type relation:

[ n-1 \approx K\rho ]

where:

(n) is the refractive index. (K) is the Gladstone–Dale coefficient for the relevant material and conditions. (\rho) is the density.

For mixtures, the effective refractivity depends on composition, wavelength, pressure, temperature, and the properties of the constituent gases.

Consequently, the refractivity of a methane-containing plume cannot generally be inferred from a universal methane coefficient without accounting for the surrounding air and the measurement conditions.

Under the paraxial approximation, a simplified expression for the angular deflection of a light ray is:

[ \boldsymbol{\varepsilon}(x,y) \approx \frac{1}{n_0} \int \nabla_{\perp} n(x,y,z),dz ]

where (n_0) is a reference refractive index and the integral follows the optical path.

The apparent displacement on an image sensor depends on the optical geometry, camera configuration, and background distance.

In BOS, image displacement is therefore a measured optical effect, not a direct gas-concentration measurement.

  1. Optical Flow and Spatial Divergence

AeroBOS estimates an image-displacement field:

[ \mathbf{d}(x,y)= \begin{bmatrix} u(x,y)\ v(x,y) \end{bmatrix} ]

where (u) and (v) represent horizontal and vertical image displacement, typically expressed in pixels.

The spatial divergence is:

\frac{\partial u}{\partial x} + \frac{\partial v}{\partial y} ]

This quantity describes the local expansion or contraction of the estimated image-displacement field.

It can help highlight spatially varying image motion. However, divergence is not uniquely attributable to gas-induced refraction: depth variation, perspective, moving background objects, camera motion, lighting changes, and optical-flow errors can also produce nonzero values.

For this reason, AeroBOS treats divergence as an image-analysis signal that requires contextual interpretation.

  1. Regularized Fourier-Domain Processing

The system applies Fourier-domain processing to the divergence field to generate a diagnostic scalar field.

A Poisson equation has the general form:

[ \nabla^2\Phi(x,y)=f(x,y) ]

where (\Phi) is the unknown scalar field and (f) is the source term.

In continuous Fourier space, the Laplacian corresponds to multiplication by:

[ -(k_x^2+k_y^2) ]

Therefore, away from zero frequency:

-\frac{\widehat{f}(k_x,k_y)} {k_x^2+k_y^2} ]

A regularized inverse can be written as:

-\frac{\widehat{f}} {k_x^2+k_y^2+\lambda} ]

where (\lambda>0) controls regularization.

The precise operator must match the discretization used by the implementation. If a discrete five-point Laplacian is used, its eigenvalues should be used instead of the continuous Laplacian symbol.

The zero-frequency component also requires explicit treatment because the Laplacian cannot determine the absolute constant offset of the solution.

Important physical limitation: Recovering optical path difference from an image-displacement field requires the correct BOS forward model and geometric scaling. Applying a Poisson inverse to divergence alone does not automatically reconstruct a physically calibrated optical path difference.

AeroBOS therefore treats the output as a diagnostic field unless that physical reconstruction has been independently established.

  1. Plume Region Analysis

The region-analysis module processes the scalar diagnostic field to identify candidate areas of interest.

The workflow can include:

Statistical thresholding. Morphological opening and closing. Connected-component or contour analysis. Minimum-region-area filtering. False-color visualization. Overlay blending with the original image.

Thresholds and morphological parameters can be adjusted to suit different image conditions.

These operations identify image regions according to their numerical characteristics; they do not independently confirm the presence or identity of a gas.

  1. Software Architecture

The project is organized around the following modules:

aerobos/bos_core.py

Performs dense optical-flow estimation, calculates spatial divergence, and applies regularized Fourier-domain processing.

aerobos/plume_metrics.py

Processes the diagnostic field, segments candidate regions, calculates image-space metrics, and creates annotated visualizations.

aerobos/synthetic_sample.py

Generates synthetic video sequences with textured backgrounds and prescribed image displacements for testing the processing pipeline.

Synthetic sequences are useful for evaluating numerical behavior and known image transformations. They do not, by themselves, establish performance on real gas leaks.

apps/process_video.py

Provides a command-line workflow for processing video and generating annotated output.

apps/app.py

Provides the Streamlit interface for video upload, parameter adjustment, and comparison of original and processed footage.

  1. Core Processing Workflow

The processing pipeline follows this sequence:

Load a reference frame and a subsequent frame. Convert frames to an appropriate image representation. Estimate dense optical flow. Calculate the spatial divergence of the displacement field. Apply the configured regularized Fourier-domain operator. Segment candidate regions using statistical thresholds and morphological operations. Calculate image-space metrics. Generate an annotated frame. Encode and display the processed video.

The exact physical interpretation of the output depends on the implemented model, calibration, and validation procedure.

Challenges We Addressed

  1. Detecting Small Image Displacements

BOS depends on measuring apparent shifts in background features, which may be small relative to the image resolution.

Dense optical-flow algorithms can estimate subpixel displacement under suitable image conditions, but their accuracy is affected by texture, noise, illumination changes, motion magnitude, and algorithm settings.

AeroBOS uses optical-flow analysis and configurable image processing to investigate these effects.

  1. Handling Fourier-Domain Singularities

The zero-frequency component of a Poisson inversion cannot be determined through the Laplacian alone.

The implementation therefore needs explicit handling of the DC component and appropriate regularization.

The discrete operator, boundary assumptions, and frequency-domain convention must remain mathematically consistent.

  1. Separating Candidate Disturbances from Unwanted Motion

Camera vibration, changing illumination, background movement, and optical-flow artifacts can all generate misleading displacement patterns.

Spatial divergence may suppress some uniform translational motion, but it does not eliminate every camera-motion artifact.

Additional stabilization, background-motion estimation, temporal consistency checks, and controlled experiments can improve reliability.

  1. Interpreting Segmented Regions

Thresholding may identify regions caused by noise, shadows, or other visual changes.

AeroBOS uses region filtering and visualization to help users inspect these patterns, but additional evidence is necessary before classifying a region as a gas plume.

Accomplishments We Are Proud Of An Accessible Computational Imaging Pipeline

AeroBOS combines optical-flow estimation, spatial analysis, Fourier-domain processing, and visualization in a modular software architecture.

An Interactive Analysis Interface

The Streamlit application is designed to let users upload videos, adjust parameters, and compare source footage with annotated results.

Offline Processing

The core pipeline can be run locally without relying on external AI APIs or cloud inference services.

Reproducible Synthetic Testing

Synthetic image sequences with known displacements can be used to assess whether the numerical pipeline responds appropriately to controlled image changes.

A Foundation for Low-Cost Optical Research

The project provides a framework for investigating whether low-cost imaging equipment can detect useful refractive signatures under controlled conditions.

AeroBOS is a research prototype, not a validated replacement for certified industrial gas-detection equipment.

Any quantitative claims about accuracy, processing speed, leak detection, or cost reduction should be supported by reproducible test results.

What We Learned

  1. Optical Flow Is a Measurement Tool, Not a Gas Detector

Image displacement can reveal changes in apparent scene geometry, but the cause of those changes must be established independently.

  1. Physical Models Require Calibration

A mathematical transformation does not automatically produce a physically meaningful measurement.

Geometric scaling, camera calibration, material properties, and environmental conditions are essential when converting image-space observations into physical quantities.

  1. Synthetic Tests and Real-World Validation Serve Different Purposes

Synthetic data can test known displacements and numerical behavior.

Real-world validation requires controlled experiments, appropriate reference instruments, representative environmental conditions, and clearly defined evaluation metrics.

  1. Good Visualization Improves Interpretability

Annotated video, region boundaries, and synchronized playback help users inspect the processing results and understand where the algorithm identifies candidate disturbances.

What's Next for AeroBOS?

  1. Controlled Gas-Leak Experiments

We plan to evaluate the pipeline using controlled experiments with safe test conditions and appropriate reference instrumentation.

The objective is to determine the smallest reliably detectable disturbance under different backgrounds, viewing geometries, and environmental conditions.

  1. Camera Calibration and Physical Reconstruction

Future work will investigate the geometric relationship between refractive deflection, background displacement, camera parameters, and optical path differences.

This is a prerequisite for defensible physical interpretation of the reconstructed field.

  1. Robust Camera-Motion Compensation

We plan to investigate global-motion estimation, image stabilization, and temporal consistency checks to reduce false detections caused by vibration and camera movement.

  1. Embedded Deployment

The pipeline could be evaluated on compact edge-computing platforms to determine whether its processing requirements are compatible with remote monitoring applications.

Performance will need to be measured on the target hardware rather than extrapolated from a desktop computer.

  1. Multi-Camera Imaging

Multiple camera views may provide additional information about the spatial structure of refractive disturbances.

However, recovering three-dimensional gas distributions would require suitable imaging geometry, calibration, and a validated reconstruction model.

  1. Industrial Integration

Future research may investigate integration with industrial monitoring systems for advisory alerts and operator review.

Any connection to safety-critical control systems would require independent validation, appropriate fail-safe design, and compliance with applicable industrial safety requirements.

AeroBOS should not autonomously trigger emergency shutdown valves based solely on unvalidated image-processing output.

Why AeroBOS Matters

AeroBOS investigates a practical question at the intersection of computational imaging, optical physics, and industrial monitoring:

Can ordinary cameras provide useful information about refractive disturbances that may be associated with gas releases?

By combining Background-Oriented Schlieren concepts with computer vision and interactive visualization, the project provides a foundation for investigating this possibility.

Our long-term goal is to develop a low-cost, experimentally validated monitoring approach that complements established industrial gas-detection technologies where its capabilities and limitations are well understood.

Built With

  • background-oriented-schlieren-(bos)
  • climate-tech
  • computer-vision
  • edge
  • environmental-monitoring
  • fft
  • gas-leak-detection
  • image-processing
  • industrial-safety
  • numpy
  • opencv
  • optical-flow
  • python
  • scientific-computing
  • streamlit
Share this project:

Updates

Submission history