CR2RE Pipeline Reference Manual 1.6.10
Functions
Fixed pattern noise detection

Algorithms to compute fixed pattern noise on a single image. More...

Functions

cpl_error_code hdrl_fpn_compute (cpl_image *img_in, const cpl_mask *mask_in, const cpl_size dc_mask_x, const cpl_size dc_mask_y, cpl_image **power_spectrum, double *std, double *std_mad)
 Algorithms to compute fixed pattern noise on a single image.
 

Detailed Description

Algorithms to compute fixed pattern noise on a single image.

The routine in this module can be used to detect fixed pattern noise in an image. The algorithm first computes the power spectrum of the image using the Fast Fourier Transform (FFT) as follows:

\begin{eqnarray*}
        fft         & = & FFT\_2D(\ img\ ) \\
        power\_spec & = & abs(\ fft\ )^2
 \end{eqnarray*}

Then it computes the standard deviation (std) and the mad-based std of the power_spectrum excluding the masked region. For this the user can provide an optional mask or use the dc_mask_x and dc_mask_y function parameter to create one on the fly. The mask created on the fly will start at pixel (1,1) and extend in both direction up to (dc_mask_x, dc_mask_y).

Note
The power spectrum contains the DC component (the DC term is the 0 Hz term and is equivalent to the average of all the samples in the window) in pixel (1,1)
The mask created on the fly and the optional mask are combined and are both taken into account.

Function Documentation

◆ hdrl_fpn_compute()

cpl_error_code hdrl_fpn_compute ( cpl_image *  img_in,
const cpl_mask *  mask_in,
const cpl_size  dc_mask_x,
const cpl_size  dc_mask_y,
cpl_image **  power_spectrum,
double *  std,
double *  std_mad 
)

Algorithms to compute fixed pattern noise on a single image.

Parameters
img_ininput cpl image (bad pixels are not allowed)
mask_inoptional input cpl mask applied to the power spectrum (or NULL).
dc_mask_xx-pixel window (>= 1) to discard DC component starting form pixel (1, 1)
dc_mask_yy-pixel window (>= 1) to discard DC component starting from pixel (1, 1)
power_spectrumoutput power spectrum image with associated mask.
stdoutput standard deviation of the power spectrum
std_madoutput standard deviation of the power spectrum based on the MAD

The function detects fixed pattern noise on the image (img_in). The algorithm first computes the power spectrum (power_spectrum) of the image using the Fast Fourier Transform (FFT) as follows:

\begin{eqnarray*}
        fft         & = & FFT\_2D(\ img\ ) \\
        power\_spec & = & abs(\ fft\ )^2
 \end{eqnarray*}

Then it computes the standard deviation (std) and the mad-based std (std_mad) of the power_spectrum excluding the masked region. For this the user can provide an optional mask or use the dc_mask_x and dc_mask_y function parameter to create one on the fly. The mask created on the fly will start at pixel (1,1) and extend in both direction up to (dc_mask_x, dc_mask_y).

Note
The power spectrum contains the DC component (the DC term is the 0 Hz term and is equivalent to the average of all the samples in the window) in pixel (1,1)
The mask created on the fly by setting dc_mask_x and dc_mask_y and the optional mask (mask_in) are combined and are both taken into account when calculating (std) and (mad_std).
The final mask used to derive (std) and (mad_std) is attached to the (power_spectrum) image as normal cpl_mask and can be retrieved by using the cpl function cpl_image_get_bpm(power_spectrum)

Possible cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT If img_in is NULL
  • CPL_ERROR_ILLEGAL_INPUT If dc_mask_x < 1 or dc_mask_y < 1
  • CPL_ERROR_ILLEGAL_INPUT If the power_spectrum is NOT NULL
  • CPL_ERROR_ILLEGAL_INPUT If img_in contains bad pixels
  • CPL_ERROR_INCOMPATIBLE_INPUT If mask NOT NULL and size(mask) != size(img_in)

Definition at line 113 of file hdrl_fpn.c.