CR2RE Pipeline Reference Manual 1.6.8
Functions
Bad Pixel Utilities

Functions

cpl_imagelist * hdrl_bpm_filter_list (const cpl_imagelist *inlist, cpl_size kernel_nx, cpl_size kernel_ny, cpl_filter_mode filter)
 Wrapper around hdrl_bpm_filter() to filter list of images.
 
cpl_mask * hdrl_bpm_filter (const cpl_mask *input_mask, cpl_size kernel_nx, cpl_size kernel_ny, cpl_filter_mode filter)
 Allows the growing and shrinking of bad pixel masks. It can be used to e.g. set pixels to bad if the pixel is surrounded by other bad pixels.
 
cpl_mask * hdrl_bpm_to_mask (const cpl_image *bpm, uint64_t selection)
 convert bad pixel information mask to a cpl_mask
 
cpl_image * hdrl_mask_to_bpm (const cpl_mask *mask, uint64_t flag)
 convert cpl_mask to bad pixel information mask
 
cpl_error_code hdrl_set_masks_on_imagelist (cpl_imagelist *list, cpl_mask **masks)
 apply array of masks to an image list
 
cpl_error_code hdrl_join_mask_on_imagelist (cpl_imagelist *list, cpl_mask *new_mask, cpl_mask ***pold_mask)
 join mask with existing masks in an imagelist
 

Detailed Description

Function Documentation

◆ hdrl_bpm_filter()

cpl_mask * hdrl_bpm_filter ( const cpl_mask *  input_mask,
cpl_size  kernel_nx,
cpl_size  kernel_ny,
cpl_filter_mode  filter 
)

Allows the growing and shrinking of bad pixel masks. It can be used to e.g. set pixels to bad if the pixel is surrounded by other bad pixels.

Parameters
input_maskinput mask
kernel_nxsize in x-direction of the filtering kernel
kernel_nysize in y-direction of the filtering kernel
filterfilter modes as defined in cpl - see below Supported modes: CPL_FILTER_EROSION, CPL_FILTER_DILATION, CPL_FILTER_OPENING, CPL_FILTER_CLOSING

The returned mask must be deallocated using cpl_mask_delete(). The algorithm assumes, that all pixels outside the mask are good, i.e. it enlarges the mask by the kernel size and marks this border as good. It applies on the enlarged mask the operation and extract the original-size mask at the very end.

Definition at line 121 of file hdrl_bpm_utils.c.

Referenced by hdrl_bpm_filter_list().

◆ hdrl_bpm_filter_list()

cpl_imagelist * hdrl_bpm_filter_list ( const cpl_imagelist *  inlist,
cpl_size  kernel_nx,
cpl_size  kernel_ny,
cpl_filter_mode  filter 
)

Wrapper around hdrl_bpm_filter() to filter list of images.

Parameters
inlistinput image list
kernel_nxsize in x-direction of the filtering kernel
kernel_nysize in y-direction of the filtering kernel
filterfilter modes as defined in cpl
Returns
The filtered image list
See also
hdrl_bpm_filter()

Definition at line 63 of file hdrl_bpm_utils.c.

References hdrl_bpm_filter().

◆ hdrl_bpm_to_mask()

cpl_mask * hdrl_bpm_to_mask ( const cpl_image *  bpm,
uint64_t  selection 
)

convert bad pixel information mask to a cpl_mask

Parameters
bpminteger image containing the bad pixel information
selectionbit-mask selecting which values to set to bad
Returns
cpl_mask
Note
as cpl only supports 32 bit integer images the top 32 bit of the selection mask must be zero

Definition at line 192 of file hdrl_bpm_utils.c.

◆ hdrl_join_mask_on_imagelist()

cpl_error_code hdrl_join_mask_on_imagelist ( cpl_imagelist *  list,
cpl_mask *  new_mask,
cpl_mask ***  pold_mask 
)

join mask with existing masks in an imagelist

Parameters
listimagelist where the new mask should be joined on
new_masknew mask joined with the masks in the images
pold_maskpointer to array pointer to store a copy of the original masks, array and masks contained in it must be deleted by the user, may be NULL in which case no copy is stored
See also
hdrl_set_masks_on_imagelist

Definition at line 292 of file hdrl_bpm_utils.c.

◆ hdrl_mask_to_bpm()

cpl_image * hdrl_mask_to_bpm ( const cpl_mask *  mask,
uint64_t  flag 
)

convert cpl_mask to bad pixel information mask

Parameters
maskcpl_mask to be converted
flagbit-mask selecting which values to set the bad pixels to
Returns
integer cpl_image
Note
as cpl only supports 32 bit integer images the top 32 bit of the selection mask must be zero

Definition at line 221 of file hdrl_bpm_utils.c.

◆ hdrl_set_masks_on_imagelist()

cpl_error_code hdrl_set_masks_on_imagelist ( cpl_imagelist *  list,
cpl_mask **  masks 
)

apply array of masks to an image list

Parameters
listimage list where the masks should be applied
masksarray of masks, must have same length as the image list

already existing masks will be overwritten can be used to re-apply the original mask array returned by hdrl_join_mask_on_imagelist

Example:

cpl_mask ** orig_masks;
// change mask to get partial statistics from the list
hdrl_join_mask_on_imagelist(list, echelle_mask, &orig_masks);
stats = get_stats_from_echelle_orders();
// restore original mask
hdrl_set_masks_on_imagelist(list, orig_masks);
// free memory
for (i = 0; i < cpl_imagelist_get_size(list); i++) {
cpl_mask_free(orig_masks[i]);
}
cpl_free(orig_masks);
cpl_error_code hdrl_join_mask_on_imagelist(cpl_imagelist *list, cpl_mask *new_mask, cpl_mask ***pold_mask)
join mask with existing masks in an imagelist
cpl_error_code hdrl_set_masks_on_imagelist(cpl_imagelist *list, cpl_mask **masks)
apply array of masks to an image list

Definition at line 263 of file hdrl_bpm_utils.c.