Two-dimensional constant false alarm rate (CFAR) detector

**Library:**Phased Array System Toolbox / Detection

The 2-D CFAR Detector block implements a constant
false-alarm rate detector for two dimensional image data. A detection
is declared when an image cell value exceeds a threshold. To maintain
a constant false alarm-rate, the threshold is set to a multiple of
the image noise power. The detector estimates noise power from neighboring
cells surrounding the cell-under-test *(CUT)* using
one of three cell averaging methods, or an order statistics method.
The cell-averaging methods are cell-averaging (CA), greatest-of cell
averaging (GOCA), or smallest-of cell averaging (SOCA).

For each test cell, the detector:

estimates the noise statistic from the cell values in the training band surrounding the CUT cell.

computes the threshold by multiplying the noise estimate by the threshold factor.

compares the CUT cell value to the threshold to determine whether a target is present or absent. If the value is greater than the threshold, a target is present.

CFAR 2-D requires an estimate of the noise power. Noise power
is computed from cells that are assumed not to contain any target
signal. These cells are the *training cells*.
Training cells form a band around the cell-under-test (CUT) cell but
may be separated from the CUT cell by a guard band. The detection
threshold is computed by multiplying the noise power by the threshold
factor.

For GOCA and SOCA averaging, the noise power is derived from the mean value of one of the left or right halves of the training cell region.

Because the number of columns in the training region is odd, the cells in the middle column are assigned equally to either the left or right half.

When using the order-statistic method, the rank cannot be larger
than the number of cells in the training cell region, *N _{train}*.
You can compute

*N*is the number of training band columns._{TC}*N*is the number of training band rows._{TR}*N*is the number of guard band columns._{GC}*N*is the number of guard band rows._{GR}

The total number of cells in the combined training
region, guard region, and CUT cell is *N _{total} =
(2N_{TC} + 2N_{GC} + 1)(2N_{TR}+
2N_{GR} + 1)*.

The total number of cells in the combined guard region and CUT
cell is *N _{guard} =
(2N_{GC} + 1)(2N_{GR} + 1)*.

The number of training cells is *N _{train} =
N_{total} – N_{guard}*.

By construction, the number of training cells is always even.
Therefore, to implement a median filter, you can choose a rank of *N _{train}/2* or