CR2RE Pipeline Reference Manual 1.6.7
Functions
Master Flatfield

This module provides algorithms to compute a master flatfield. Several methods are available to deal with different flatfield characteristics. More...

Functions

hdrl_parameter * hdrl_flat_parameter_create (cpl_size filter_size_x, cpl_size filter_size_y, hdrl_flat_method method)
 Creates FLAT Parameters object.
 
cpl_boolean hdrl_flat_parameter_check (const hdrl_parameter *self)
 Check that the parameter is a FLAT parameter.
 
cpl_size hdrl_flat_parameter_get_filter_size_x (const hdrl_parameter *p)
 Access the filter_size_x in the FLAT parameter.
 
cpl_size hdrl_flat_parameter_get_filter_size_y (const hdrl_parameter *p)
 Access the filter_size_y in the FLAT parameter.
 
hdrl_flat_method hdrl_flat_parameter_get_method (const hdrl_parameter *p)
 Access the method in the FLAT parameter.
 
cpl_parameterlist * hdrl_flat_parameter_create_parlist (const char *base_context, const char *prefix, const hdrl_parameter *defaults)
 Create a parameter list for the FLAT computation.
 
hdrl_parameter * hdrl_flat_parameter_parse_parlist (const cpl_parameterlist *parlist, const char *prefix)
 Parse a parameterlist to create input parameters for the FLAT.
 
cpl_error_code hdrl_flat_compute (hdrl_imagelist *hdrl_data, const cpl_mask *stat_mask, const hdrl_parameter *collapse_params, hdrl_parameter *flat_params, hdrl_image **master, cpl_image **contrib_map)
 compute high or low frequency master flat with median filtering
 

Detailed Description

This module provides algorithms to compute a master flatfield. Several methods are available to deal with different flatfield characteristics.

The routines in this module can be used to derive a high frequency or a low frequency master flatfield.

HIGH frequency algorithm:
The algorithm first smoothes the input images by a median filter and divides each input image through the smoothed image. The smoothed images is considered to be noiseless i.e. the relative error of the resulting images is the same as the one of the input image. Then all residual images are collapsed into a single master flatfield. The collapsing can be done with all methods currently implemented in hdrl. Moreover, it is also possible to give a static mask to the algorithm which e.g. allows the user to distinguish illuminated and not illuminated regions. In this case the smoothing procedure is done twice, once for the illuminated region and once for the blanked region. This ensures that the information of one region does not influence the other regions during the smoothing process.
LOW frequency algorithm:
The algorithm multiplicatively normalizes the input images by the median of the image to unity. A static mask can be provided to the algorithm in order to define the pixels that should be taken into account when computing the normalisation factor. This allows the user to normalize the flatfield e.g. only by the illuminated section. Then all normalized images are collapsed into a single master flatfield. The collapsing can be done with all methods currently implemented in hdrl. Finally, the master flatfield is smoothed by a median filter. The associated error of the final masterframe is the error derived via error propagation of the previous steps, i.e. the smoothing itself is considered noiseless.

The calculation is performed by calling the top-level function hdrl_flat_compute() and the parameters passed to this function can be created by calling hdrl_flat_parameter_create(). Additional one has to pass also the collapse parameter created e.g. via hdrl_collapse_mean_parameter_create(), ... Note that the function will overwrite the input imagelist in order to conserve memory. Its contents after the call are undefined and it must be deleted by the caller.

Function Documentation

◆ hdrl_flat_compute()

cpl_error_code hdrl_flat_compute ( hdrl_imagelist *  hdrl_data,
const cpl_mask *  stat_mask,
const hdrl_parameter *  collapse_params,
hdrl_parameter *  flat_params,
hdrl_image **  master,
cpl_image **  contrib_map 
)

compute high or low frequency master flat with median filtering

Parameters
hdrl_datainput flats, will be overwritten!
stat_maskinput mask to select the regions for statistics or smoothing
collapse_paramsparameter controlling the collapse algorithm
flat_paramsparameter controlling the flatfield algorithm
masterreturned masterflat
contrib_mapreturned contribution map
The algorithms are described in the master flatfield module documentation
Note
the function will overwrite the input imagelist in order to conserve memory. Its contents after the call are undefined and it must be deleted by the caller.

Definition at line 405 of file hdrl_flat.c.

References hdrl_image_create(), hdrl_image_delete(), hdrl_image_get_error(), hdrl_image_get_image(), hdrl_image_get_image_const(), hdrl_imagelist_collapse(), hdrl_imagelist_get(), and hdrl_imagelist_get_size().

◆ hdrl_flat_parameter_check()

cpl_boolean hdrl_flat_parameter_check ( const hdrl_parameter *  self)

Check that the parameter is a FLAT parameter.

Parameters
selfThe parameter to check
Returns
True or False

Definition at line 197 of file hdrl_flat.c.

◆ hdrl_flat_parameter_create()

hdrl_parameter * hdrl_flat_parameter_create ( cpl_size  filter_size_x,
cpl_size  filter_size_y,
hdrl_flat_method  method 
)

Creates FLAT Parameters object.

PRIVATE

Parameters
filter_size_xSmoothing filter size in x-direction
filter_size_ySmoothing filter size in y-direction
methodused method
Returns
The FLAT parameters object.
      It needs to be deallocated with hdrl_parameter_delete()
See also
hdrl_parameter_delete()
hdrl_flat_compute()

Definition at line 173 of file hdrl_flat.c.

References hdrl_parameter_delete().

Referenced by hdrl_flat_parameter_parse_parlist().

◆ hdrl_flat_parameter_create_parlist()

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

Create a parameter list for the FLAT 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 FLAT parameters:

  • base_context.prefix.filter_size_x
  • base_context.prefix.filter_size_y
  • base_context.prefix.method The CLI aliases omit the base_context.

Definition at line 258 of file hdrl_flat.c.

References hdrl_flat_parameter_get_filter_size_x(), hdrl_flat_parameter_get_filter_size_y(), hdrl_flat_parameter_get_method(), and hdrl_join_string().

◆ hdrl_flat_parameter_get_filter_size_x()

cpl_size hdrl_flat_parameter_get_filter_size_x ( const hdrl_parameter *  p)

Access the filter_size_x in the FLAT parameter.

Parameters
pThe FLAT parameter
Returns
The filter_size_x

Definition at line 209 of file hdrl_flat.c.

Referenced by hdrl_flat_parameter_create_parlist().

◆ hdrl_flat_parameter_get_filter_size_y()

cpl_size hdrl_flat_parameter_get_filter_size_y ( const hdrl_parameter *  p)

Access the filter_size_y in the FLAT parameter.

Parameters
pThe FLAT parameter
Returns
The filter_size_y

Definition at line 223 of file hdrl_flat.c.

Referenced by hdrl_flat_parameter_create_parlist().

◆ hdrl_flat_parameter_get_method()

hdrl_flat_method hdrl_flat_parameter_get_method ( const hdrl_parameter *  p)

Access the method in the FLAT parameter.

Parameters
pThe FLAT parameter
Returns
The method

Definition at line 237 of file hdrl_flat.c.

Referenced by hdrl_flat_parameter_create_parlist().

◆ hdrl_flat_parameter_parse_parlist()

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

Parse a parameterlist to create input parameters for the FLAT.

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

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

  • prefix.filter_size_x
  • prefix.filter_size_y
  • prefix.method

Definition at line 331 of file hdrl_flat.c.

References hdrl_flat_parameter_create(), and hdrl_join_string().