CR2RE Pipeline Reference Manual 1.6.8
Functions
Bad Pixel Mask 3D Computation

Algorithms to detect bad pixels on a stack of identical images like e.g. bias images. More...

Functions

hdrl_parameter * hdrl_bpm_3d_parameter_create (double kappa_low, double kappa_high, hdrl_bpm_3d_method method)
 Creates BPM Parameters object for the imagelist method.
 
cpl_error_code hdrl_bpm_3d_parameter_verify (const hdrl_parameter *param)
 Verify basic correctness of the BPM_3D parameters.
 
cpl_boolean hdrl_bpm_3d_parameter_check (const hdrl_parameter *self)
 Check that the parameter is a BPM_3D parameter.
 
double hdrl_bpm_3d_parameter_get_kappa_low (const hdrl_parameter *p)
 Access the kappa_low in the BPM_3D parameter.
 
double hdrl_bpm_3d_parameter_get_kappa_high (const hdrl_parameter *p)
 Access the kappa_high in the BPM_3D parameter.
 
hdrl_bpm_3d_method hdrl_bpm_3d_parameter_get_method (const hdrl_parameter *p)
 Access the method in the BPM_3D parameter.
 
cpl_parameterlist * hdrl_bpm_3d_parameter_create_parlist (const char *base_context, const char *prefix, const hdrl_parameter *defaults)
 Create a parameter list for the BPM_3D computation.
 
hdrl_parameter * hdrl_bpm_3d_parameter_parse_parlist (const cpl_parameterlist *parlist, const char *prefix)
 Parse a parameterlist to create input parameters for the BPM_3D.
 
cpl_imagelist * hdrl_bpm_3d_compute (const hdrl_imagelist *imglist, const hdrl_parameter *params)
 detect bad pixels on a stack of identical images
 

Detailed Description

Algorithms to detect bad pixels on a stack of identical images like e.g. bias images.

The routines in this module can be used to detect bad pixels on a stack of identical images like bias or dark images. The algorithm first collapses the stack of images by using the median in order to generate a master-image. Then it subtracts the master image from each individual image and derives the bad pixels on the residual-images by thresholding, i.e. all pixels exceeding the threshold are considered as bad. Please note, that the algorithm assumes that the mean level of the different images is the same, if this is not the case, the master-image as described above will be biased.

The calculation is performed by calling the top-level function hdrl_bpm_3d_compute() and the parameters passed to this function can be created by calling hdrl_bpm_3d_parameter_create().

Function Documentation

◆ hdrl_bpm_3d_compute()

cpl_imagelist * hdrl_bpm_3d_compute ( const hdrl_imagelist *  imglist,
const hdrl_parameter *  params 
)

detect bad pixels on a stack of identical images

Parameters
imglistinput hdrl imagelist
paramsBPM_3D computation parameters
Returns
cpl_imagelist where the newly rejected pixels are marked as unity.

The algorithm first collapses the stack of images by using the median to generate a master-image. Then it subtracts the master image from each individual image and derives the bad pixels on the residual-images by thresholding, i.e. all pixels strictly exceeding the threshold are considered as bad.

Three methods are currently available to derive the bad pixels on the residual images and can be set when creating the BPM_3D parameter via hdrl_bpm_3d_parameter_create():

  • method = HDRL_BPM_3D_THRESHOLD_ABSOLUTE: It uses kappa_low and kappa_high as absolute threshold
  • method = HDRL_BPM_3D_THRESHOLD_RELATIVE: It scales the measured rms on the residual-image with kappa_low and kappa_high and uses it as threshold. For the rms a properly scaled Median Absolute Deviation (MAD) is used.
  • method = HDRL_BPM_3D_THRESHOLD_ERROR: It scales the propagated error of each individual pixel with kappa_low and kappa_high and uses it as threshold.
Note
We assume that the images are already scaled outside this routine, i.e. their absolute levels match.

For a Gaussian distribution the Median Absolute Deviation (MAD) is a robust and consistent estimate of the Standard Deviation (STD) in the sense that the STD is approximately K * MAD, where K is a constant equal to approximately 1.4826

Definition at line 409 of file hdrl_bpm_3d.c.

References hdrl_bpm_3d_parameter_verify(), hdrl_collapse_median_parameter_create(), hdrl_image_delete(), hdrl_image_get_image(), hdrl_image_get_mask(), hdrl_image_get_pixel(), hdrl_image_get_size_x(), hdrl_image_get_size_y(), hdrl_image_sub_image_create(), hdrl_imagelist_collapse(), hdrl_imagelist_get(), hdrl_imagelist_get_const(), hdrl_imagelist_get_size(), hdrl_imagelist_new(), hdrl_imagelist_set(), hdrl_imagelist_unset(), and hdrl_parameter_delete().

◆ hdrl_bpm_3d_parameter_check()

cpl_boolean hdrl_bpm_3d_parameter_check ( const hdrl_parameter *  self)

Check that the parameter is a BPM_3D parameter.

Parameters
selfThe parameter to check
Returns
True or False

Definition at line 170 of file hdrl_bpm_3d.c.

Referenced by hdrl_bpm_3d_parameter_create_parlist(), and hdrl_bpm_3d_parameter_verify().

◆ hdrl_bpm_3d_parameter_create()

hdrl_parameter * hdrl_bpm_3d_parameter_create ( double  kappa_low,
double  kappa_high,
hdrl_bpm_3d_method  method 
)

Creates BPM Parameters object for the imagelist method.

Parameters
kappa_lowLow kappa factor for thresholding algorithm
kappa_highHigh kappa factor for thresholding algorithm
methodused method
Returns
The BPM_3D parameters object.
      It needs to be deallocated with hdrl_parameter_delete()
See also
hdrl_parameter_delete()
hdrl_bpm_3d_compute()

Definition at line 108 of file hdrl_bpm_3d.c.

Referenced by hdrl_bpm_3d_parameter_parse_parlist().

◆ hdrl_bpm_3d_parameter_create_parlist()

cpl_parameterlist * hdrl_bpm_3d_parameter_create_parlist ( const char *  base_context,
const char *  prefix,
const hdrl_parameter *  defaults 
)

Create a parameter list for the BPM_3D computation.

Parameters
base_contextbase context of parameter (e.g. recipe name)
prefixprefix of parameter, may be empty string
defaultsdefault values

Creates a parameterlist with the BPM_3D parameters:

  • base_context.prefix.kappa_low
  • base_context.prefix.kappa_high
  • base_context.prefix.method The CLI aliases omit the base_context.

Definition at line 231 of file hdrl_bpm_3d.c.

References hdrl_bpm_3d_parameter_check(), hdrl_bpm_3d_parameter_get_kappa_high(), hdrl_bpm_3d_parameter_get_kappa_low(), hdrl_bpm_3d_parameter_get_method(), and hdrl_join_string().

◆ hdrl_bpm_3d_parameter_get_kappa_high()

double hdrl_bpm_3d_parameter_get_kappa_high ( const hdrl_parameter *  p)

Access the kappa_high in the BPM_3D parameter.

Parameters
pThe BPM_3D parameter
Returns
The kappa_high

Definition at line 196 of file hdrl_bpm_3d.c.

Referenced by hdrl_bpm_3d_parameter_create_parlist().

◆ hdrl_bpm_3d_parameter_get_kappa_low()

double hdrl_bpm_3d_parameter_get_kappa_low ( const hdrl_parameter *  p)

Access the kappa_low in the BPM_3D parameter.

Parameters
pThe BPM_3D parameter
Returns
The kappa_low

Definition at line 182 of file hdrl_bpm_3d.c.

Referenced by hdrl_bpm_3d_parameter_create_parlist().

◆ hdrl_bpm_3d_parameter_get_method()

hdrl_bpm_3d_method hdrl_bpm_3d_parameter_get_method ( const hdrl_parameter *  p)

Access the method in the BPM_3D parameter.

Parameters
pThe BPM_3D parameter
Returns
The method

Definition at line 210 of file hdrl_bpm_3d.c.

Referenced by hdrl_bpm_3d_parameter_create_parlist().

◆ hdrl_bpm_3d_parameter_parse_parlist()

hdrl_parameter * hdrl_bpm_3d_parameter_parse_parlist ( const cpl_parameterlist *  parlist,
const char *  prefix 
)

Parse a parameterlist to create input parameters for the BPM_3D.

Parameters
parlistparameter list to parse
prefixprefix of parameter name
Returns
Input parameters for the BPM_3D computation

Reads a parameterlist in order to create BPM image parameters. Expects a parameterlist containing:

  • prefix.kappa_low
  • prefix.kappa_high
  • prefix.method

Definition at line 314 of file hdrl_bpm_3d.c.

References hdrl_bpm_3d_parameter_create(), and hdrl_join_string().

◆ hdrl_bpm_3d_parameter_verify()

cpl_error_code hdrl_bpm_3d_parameter_verify ( const hdrl_parameter *  param)

Verify basic correctness of the BPM_3D parameters.

Parameters
paramBPM image parameters
Returns
CPL_ERROR_NONE if everything is ok, an error code otherwise

Definition at line 128 of file hdrl_bpm_3d.c.

References hdrl_bpm_3d_parameter_check().

Referenced by hdrl_bpm_3d_compute().