Skip to content

Local Rx detector

Cédric Traizet requested to merge local_rx_detector into develop


Functor and application for local Rx score computation


In OTB there is a LocalRxDetectorFilter that computes local Rx score on an input hyperspectral image.

Also, there is currently no application that computes local Rx score in OTB. This MR also introduces this application.

Local Rx detection is an expensive operation. It requires, for each pixel, the estimation of the correlation matrix of the pixels in the neighborhood and its inversion. The computational complexity of the algorithm is of order O(N*L^3) [1], where N is the number of pixels in the image and L the number of bands. Nevertheless, I think this algorithm has its place in OTB, as it is one of the most used algorithm for hyperspectral anomaly detection. The need for this application has been expressed in #1530 (closed).

At the moment the application only computes the score and outputs it. It does not apply a threshold on the computed score to detect anomalies. As thresholding can be done with BandMath, I don't think that this application needs to do it.

This Merge Request also removes the LocalRxDetectorNonThreadFilter and its test, why do we have this in OTB anyway ?

local Rx functor:

The local Rx score computation can be computed on each pixel using its neighboring pixels, therefore the filter can be replaced by a FunctorImageFilter using a functor taking a neighborhhod as input. This merge request introduces this functor.

Because of the bug in FunctorImageFilter in #1802 (closed), we can't be replace the filter by a functor yet. In this MR the LocalRxDetectorFilter has not been removed, and the version using a functorImageFilter has been implemented.

The result are identical between the LocalRxDetectorFilter and the FunctorImageFilter except on image border : the LocalRxDetectorFilter does not compute score on borders (using a ImageBoundaryFacesCalculator) and the FunctorImageFilter computes score on border using a ZeroFluxNeumannBoundaryCondition.


[1]: Zhao, Chunhui & Wang, Yulei & Qi, Bin & Wang, Jia. (2015). Global and Local Real-Time Anomaly Detectors for Hyperspectral Remote Sensing Imagery. Remote Sensing. 7. 3966-3985. 10.3390/rs70403966.

Implementation Details

Classes and files

New file otbLocalRxDetection.cxx where the new application is implemented.


A new application has been created : LocalRxDetection, it has the following parameters :

  • in : input multi-channel image
  • out: output image
  • ir : InternalRadius
  • er : ExternalRadius
  • ram : ram parameter (int).


a test has been added for the LocalRxDetection application.

Additional notes



The copyright owner is CNES and has signed the ORFEO ToolBox Contributor License Agreement.

Check before merging:

  • All discussions are resolved
  • At least 2 👍 votes from core developers, no 👎 vote.
  • The feature branch is (reasonably) up-to-date with the base branch
  • Dashboard is green
  • Copyright owner has signed the ORFEO ToolBox Contributor License Agreement
Edited by Cédric Traizet

Merge request reports