|
CR2RE Pipeline Reference Manual 1.6.7
|
This module contains functions to derive and subtract a master-fringe image. More...
Functions | |
| cpl_error_code | hdrl_fringe_compute (hdrl_imagelist *ilist_fringe, const cpl_imagelist *ilist_obj, const cpl_mask *stat_mask, const hdrl_parameter *collapse_params, hdrl_image **master, cpl_image **contrib_map, cpl_table **qctable) |
| Calculates the master fringe and contribution map based on the. | |
| cpl_error_code | hdrl_fringe_correct (hdrl_imagelist *ilist_fringe, const cpl_imagelist *ilist_obj, const cpl_mask *stat_mask, const hdrl_image *masterfringe, cpl_table **qctable) |
| Scales and subtracts the master fringe from the images. | |
This module contains functions to derive and subtract a master-fringe image.
For the master-fringe estimation, the algorithm model the pixel intensity distribution in a given image as a mixture of two Gaussian distributions, whose means are the background and the fringe amplitudes, respectively:
Thus the density function 
![\[
f(x) = c_1\,e^{ -\frac{(x-\mu_1)^2}{2\sigma_1^2} }
+ c_2\,e^{ -\frac{(x-\mu_2)^2}{2\sigma_2^2} }.
\]](form_21.png)
The means 


The parameters of the two Gaussian components are estimated from the density function of the pixel intensities by a nonlinear least squares fit algorithm. The algorithm requires as its input an estimated density function. Such an estimate is calculated in a preprocessing step as a truncated Hermite series:
![\[
f(x) \approx \sum_{n=0}^p \; c_n h_n\left(\frac{x - \mu}{\sigma}\right),
\]](form_25.png)
where 
![\[
h_n(x) = {\pi}^{-\frac14} \,
2^{-\frac{n}{2}} (n!)^{-\frac12} \, (\-1)^n \, e^{\frac{x^2\!\!}{2}} \,
\frac{d^n}{dx^n}\left( e^{-x^2} \right),
\]](form_27.png)





![\[
c_n = \frac1{\sigma N}\; \sum_{i=1}^N h_n\left(\frac{I_i - \mu}{\sigma}\right),
\]](form_33.png)
where the summation extends over all pixel intensities 


The following image shows a truncated Hermite series and its approximation by a Gaussian mixture.
For the master-fringe subtraction the algorithm computes fringe amplitudes for each individual image by a least squares fit of a linear combination of the estimated master-fringe and a constant background. Specifically, the 

![\[
F_{i} = a_{i}F + b_{i},
\]](form_39.png)
where 



| cpl_error_code hdrl_fringe_compute | ( | hdrl_imagelist * | ilist_fringe, |
| const cpl_imagelist * | ilist_obj, | ||
| const cpl_mask * | stat_mask, | ||
| const hdrl_parameter * | collapse_params, | ||
| hdrl_image ** | master, | ||
| cpl_image ** | contrib_map, | ||
| cpl_table ** | qctable | ||
| ) |
Calculates the master fringe and contribution map based on the.
Gaussian mixture model.
| ilist_fringe | Image list from where to extract the fringes |
| ilist_obj | Masks with the objects of the single images (or NULL) |
| stat_mask | Static mask (or NULL) |
| collapse_params | parameter controlling the collapse algorithm |
| master | returned master fringe map |
| contrib_map | returned contribution map of the master fringe map |
| qctable | returned table containing quality control information (or NULL) |
The function calculates the master fringe and contribution maps of a list of (dithered) images. The background and fringe level are estimated as the mean values of a Gaussian mixture model to the image histogram. The histogram is approximated by a Hermite series before fitting the mixture model, in order to avoid possible problems with bin sizes.
The masks exclude the regions where the fringe is weak, and are essential for an accurate estimation of noisy images. The masks can be used to remove objects and bad regions from the fit as well: The algorithm combines the bad pixel map (from ilist_fringe), the object mask (from ilist_obj), and static mask (stat_mask) for the fringe computation itself, but uses only the combined bad pixel map and object mask for the final collapsing. This ensures that the master fringe is also calculated in regions excluded by the static mask.
Definition at line 160 of file hdrl_fringe.c.
References hdrl_image_div_scalar(), hdrl_image_get_image_const(), hdrl_image_get_mask(), hdrl_image_get_size_x(), hdrl_image_get_size_y(), hdrl_image_reject_from_mask(), hdrl_image_sub_scalar(), hdrl_imagelist_collapse(), hdrl_imagelist_get(), hdrl_imagelist_get_const(), and hdrl_imagelist_get_size().
| cpl_error_code hdrl_fringe_correct | ( | hdrl_imagelist * | ilist_fringe, |
| const cpl_imagelist * | ilist_obj, | ||
| const cpl_mask * | stat_mask, | ||
| const hdrl_image * | masterfringe, | ||
| cpl_table ** | qctable | ||
| ) |
Scales and subtracts the master fringe from the images.
| ilist_fringe | Image list from where to subtract the master fringe |
| ilist_obj | Masks with the objects of the single images (or NULL) |
| stat_mask | Static mask (or NULL) |
| masterfringe | master fringe to scale and subtract |
| qctable | table containing quality control information (or NULL) |
The function subtracts a fringe correction image (master) from a set of input images (ilist_fringe). The amplitude of the fringes is computed for each input image and used to properly rescale the correction image before subtraction.
The masks exclude the regions where the fringe is weak, and are essential for an accurate scaling estimation of noisy images. The algorithm combines the bad pixel map (from ilist_fringe), the object mask (from ilist_obj), and static mask (stat_mask) for the scaling computation of the master fringe, but only uses the bad pixel map when subtracting the master-fringe. The object mask and static mask are ignored in this step. This ensures that the master fringe is properly subtracted (with error propagation) in all regions not affected by the bad pixel mask.
Definition at line 346 of file hdrl_fringe.c.
References hdrl_image_delete(), hdrl_image_duplicate(), hdrl_image_get_image_const(), hdrl_image_get_mask(), hdrl_image_get_size_x(), hdrl_image_get_size_y(), hdrl_image_mul_scalar(), hdrl_image_sub_image(), hdrl_imagelist_get(), hdrl_imagelist_get_const(), and hdrl_imagelist_get_size().