ifw-odp
2.0.0-alpha
|
#include <cpl.h>
Go to the source code of this file.
Macros | |
#define | clipm_priv_image_LOOP_GOOD_DATA_CONST(TYPE, IMSIZE_XY, WDWSIZE_XY, DATA_WDW, BADP_WDW, YACTION, XACTION, XACTION_ONLY_WITH_BPM) |
Loop over a pixel buffer, only regarding good pixels. More... | |
Functions | |
double | clipm_priv_image_get_mean_perimeter (const void *data, cpl_type type, double xc, double yc, double r, cpl_size xsize, cpl_size ysize, const cpl_binary *badp, cpl_size *nrpix) |
Average values in a buffer along a perimeter. More... | |
cpl_error_code | clipm_priv_image_estimate_fwhm_xy (const cpl_image *img, const double *xy_peakpos, double bg_level, double *out_xy_fwhm, double *out_xy_middle, double *out_xy_edge_sigma) |
Estimate the FWHM of an object separable in x and y. More... | |
cpl_error_code | clipm_priv_image_get_kappa_sigma (const cpl_image *img, const cpl_size window_xxyy[4], double kappa, double initial_limits[], int nmax_iterations, double *out_mean, double *out_sigma, double *out_kappasigma, cpl_size *out_nused, int *out_niterations) |
Determine mean and sigma by iteratively ignoring outliers. More... | |
double | clipm_priv_image_estimate_low_kappa_sigma (const cpl_image *image, const cpl_size window_xxyy[4], double kappa, double *out_sigma, cpl_size *out_nused) |
Force the iterative kappa-sigma clipping to converge against the dark. More... | |
cpl_error_code | clipm_priv_image_get_psf_sigma (const cpl_image *img, const cpl_size window_xxyy[4], const double *centre_xy, double bg_level, double cut_lower, double cut_upper, double *sigma_xy, double gain, double *centre_err_xy) |
Compute the sigma (RMS) of an object (i.e. the PSF). More... | |
cpl_error_code | clipm_priv_image_collapse (const cpl_image *image, const cpl_size window_xxyy[4], cpl_array **horizontal, cpl_array **vertical, cpl_array **x_weight_map, cpl_array **y_weight_map) |
Collapse an image (by averaging) in both dimensions. More... | |
cpl_size | clipm_priv_image_pixel_count_below (const cpl_image *img, const cpl_size window_xxyy[4], double limit, cpl_size *out_nbad) |
Count all the pixels (strictly) below a given limit. More... | |
cpl_image * | clipm_priv_image_get_sat (const cpl_image *image, const int window_xxyy[4], cpl_image **contrib_sat) |
cpl_image * | clipm_priv_image_conv_matrix (const cpl_image *input, const cpl_matrix *kernel, const cpl_size window_xxyy[4], int extend_bpm, int int2double) |
Convolve an image with a kernel stored in a matrix. More... | |
cpl_image * | clipm_priv_image_filter_lowpass (const cpl_image *image, const cpl_size window_xxyy[4], double sigma) |
Convolve an image with a gaussian bell curve. More... | |
double | clipm_priv_image_estimate_bg_in_region (const cpl_image *img, const cpl_size window_xxyy[4], double *out_sigma, cpl_size *out_nused) |
Estimate the background in a small image region. More... | |
double | clipm_priv_image_estimate_fwhm_round (const cpl_image *img, double x_peakpos, double y_peakpos, double bg_level) |
Estimate the FWHM of a round object. More... | |
#define clipm_priv_image_LOOP_GOOD_DATA_CONST | ( | TYPE, | |
IMSIZE_XY, | |||
WDWSIZE_XY, | |||
DATA_WDW, | |||
BADP_WDW, | |||
YACTION, | |||
XACTION, | |||
XACTION_ONLY_WITH_BPM | |||
) |
Loop over a pixel buffer, only regarding good pixels.
TYPE | C data type (e.g. int, float, double) |
IMSIZE_XY | Int buffer of size 2, containing the image size [x, y] |
WDWSIZE_XY | Int buffer of size 2, containing the window size |
DATA_WDW | Pointer to bad pixel mask data (window) |
BADP_WDW | Pointer to bad pixel mask data (window) |
YACTION | Action to perform first in each row |
XACTION | Action to always perform per pixel |
XACTION_ONLY_WITH_BPM | Action to perform only if a bad pixel mask is provided (for speed reasons) |
cpl_error_code clipm_priv_image_collapse | ( | const cpl_image * | image, |
const cpl_size | window_xxyy[4], | ||
cpl_array ** | horizontal, | ||
cpl_array ** | vertical, | ||
cpl_array ** | x_weight_map, | ||
cpl_array ** | y_weight_map | ||
) |
Collapse an image (by averaging) in both dimensions.
image | Input image |
window_xxyy | Window coordinate buffer of the form {xa, xb, ya, yb}, can be NULL |
horizontal | (Output) horizontal array of type CPL_TYPE_DOUBLE |
vertical | (Output) vertical array of type CPL_TYPE_DOUBLE |
x_weight_map | (Optional output) horizontal weighting map of type CPL_TYPE_INT |
y_weight_map | (Optional output) vertical weighting map of type CPL_TYPE_INT |
cpl_image* clipm_priv_image_conv_matrix | ( | const cpl_image * | input, |
const cpl_matrix * | kernel, | ||
const cpl_size | window_xxyy[4], | ||
int | extend_bpm, | ||
int | int2double | ||
) |
Convolve an image with a kernel stored in a matrix.
input | Input image |
kernel | Kernel |
window_xxyy | Coordinate buffer of the form {xa, xb, ya, yb}, can be NULL, minimum/maximum order is irrelevant |
extend_bpm | Flag whether to extend the bad pixel flag to the range of coverage of the kernel (incl. the image border), otherwise normalise to covered kernel weight |
int2double | Flag whether to convert integer to double (see below) |
double clipm_priv_image_estimate_bg_in_region | ( | const cpl_image * | img, |
const cpl_size | window_xxyy[4], | ||
double * | out_sigma, | ||
cpl_size * | out_nused | ||
) |
Estimate the background in a small image region.
img | Input image |
window_xxyy | Coordinate buffer of the form {xa, xb, ya, yb}, can be NULL, minimum/maximum order is irrelevant |
out_sigma | (Optional output) background sigma, can be NULL, returns -1.0 in the case of error |
out_nused | (Optional output) number of found background pixels, can be NULL, returns 0 in the case of error |
double clipm_priv_image_estimate_fwhm_round | ( | const cpl_image * | img, |
double | x_peakpos, | ||
double | y_peakpos, | ||
double | bg_level | ||
) |
Estimate the FWHM of a round object.
img | Input image |
x_peakpos | Horizontal peak position |
y_peakpos | Vertical peak position |
bg_level | Input background level to subtract |
cpl_error_code clipm_priv_image_estimate_fwhm_xy | ( | const cpl_image * | img, |
const double * | xy_peakpos, | ||
double | bg_level, | ||
double * | out_xy_fwhm, | ||
double * | out_xy_middle, | ||
double * | out_xy_edge_sigma | ||
) |
Estimate the FWHM of an object separable in x and y.
img | Input image |
xy_peakpos | Peak position (double buffer of length 2 [x, y]) |
bg_level | Input background level to subtract |
out_xy_fwhm | Output full-width-half-maximum (double buffer of length 2 [x, y]) |
out_xy_middle | (Optional output) middle position between left and right FWHM edges (double buffer of length 2 [x, y]), can be NULL |
out_xy_edge_sigma | (Optional output) sigma of the smoothing of the edge, if not measurable -1.0, see also below, (double buffer of length 2 [x, y]), can be NULL |
double clipm_priv_image_estimate_low_kappa_sigma | ( | const cpl_image * | image, |
const cpl_size | window_xxyy[4], | ||
double | kappa, | ||
double * | out_sigma, | ||
cpl_size * | out_nused | ||
) |
Force the iterative kappa-sigma clipping to converge against the dark.
image | Input image |
window_xxyy | Coordinate buffer of the form {x1a, x1b, y1a, y1b}, minimum/maximum order is irrelevant |
kappa | Kappa |
out_sigma | (Optional output) RMS of the estimated background -1.0 in the case of error |
out_nused | (Optional output) number of used pixels, 0 in the case of error |
cpl_image* clipm_priv_image_filter_lowpass | ( | const cpl_image * | image, |
const cpl_size | window_xxyy[4], | ||
double | sigma | ||
) |
Convolve an image with a gaussian bell curve.
image | Input image |
window_xxyy | Coordinate buffer of the form {xa, xb, ya, yb}, can be NULL, minimum/maximum order is irrelevant |
sigma | Sigma of the gaussian |
cpl_error_code clipm_priv_image_get_kappa_sigma | ( | const cpl_image * | img, |
const cpl_size | window_xxyy[4], | ||
double | kappa, | ||
double | initial_limits[], | ||
int | nmax_iterations, | ||
double * | out_mean, | ||
double * | out_sigma, | ||
double * | out_kappasigma, | ||
cpl_size * | out_nused, | ||
int * | out_niterations | ||
) |
Determine mean and sigma by iteratively ignoring outliers.
img | Input image |
window_xxyy | Coordinate buffer of the form {xa, xb, ya, yb}, can be NULL, minimum/maximum order is irrelevant |
kappa | Ignore (abs(value - mean) > kappa * sigma), must be >= 1.0 |
initial_limits | (Optional) double buffer of the form {l1, l2}, can be NULL, minimum/maximum order is irrelevant |
nmax_iterations | Maximum number of iterations, must be >= 0 |
out_mean | (Optional) mean, can be NULL |
out_sigma | (Optional) sigma, can be NULL |
out_kappasigma | (Optional) kappa * sigma, can be NULL |
out_nused | (Optional) number of remaining (used) pixels, can be NULL |
out_niterations | (Optional) number of performed iterations, can be NULL |
double clipm_priv_image_get_mean_perimeter | ( | const void * | data, |
cpl_type | type, | ||
double | xc, | ||
double | yc, | ||
double | r, | ||
cpl_size | xsize, | ||
cpl_size | ysize, | ||
const cpl_binary * | badp, | ||
cpl_size * | nrpix | ||
) |
Average values in a buffer along a perimeter.
data | Data buffer (unchecked) |
type | CPL data type |
xc | X centre |
yc | Y centre |
r | Radius |
xsize | X buffer size |
ysize | Y buffer size |
badp | (Optional) bad pixel buffer of type cpl_binary, can be NULL |
nrpix | (Optional output) number of averaged pixels |
cpl_error_code clipm_priv_image_get_psf_sigma | ( | const cpl_image * | img, |
const cpl_size | window_xxyy[4], | ||
const double * | centre_xy, | ||
double | bg_level, | ||
double | cut_lower, | ||
double | cut_upper, | ||
double * | sigma_xy, | ||
double | gain, | ||
double * | centre_err_xy | ||
) |
Compute the sigma (RMS) of an object (i.e. the PSF).
img | Input image |
window_xxyy | Coordinate buffer of the form {xa, xb, ya, yb}, can be NULL, minimum/maximum order is irrelevant |
centre_xy | Peak position (double buffer of length 2 [x, y]) |
bg_level | Input background level to subtract |
cut_lower | Lower limit for values to be taken into account |
cut_upper | Upper limit for values to be taken into account |
sigma_xy | (Output) Mandatory (double) buffer of size 2 to contain the barycentre position after success |
gain | (Optional) detector gain value (input), in unit "ADU / electron", required for the computation of centre_err_xy, will be ignored otherwise |
centre_err_xy | (Optional output) contains the centre error after success (double buffer of length 2 [x, y]), needs the gain to be set (!), can be NULL |
cpl_image* clipm_priv_image_get_sat | ( | const cpl_image * | image, |
const int | window_xxyy[4], | ||
cpl_image ** | contrib_sat | ||
) |
cpl_size clipm_priv_image_pixel_count_below | ( | const cpl_image * | img, |
const cpl_size | window_xxyy[4], | ||
double | limit, | ||
cpl_size * | out_nbad | ||
) |
Count all the pixels (strictly) below a given limit.
img | Input image |
window_xxyy | Coordinate buffer of the form {xa, xb, ya, yb}, can be NULL, minimum/maximum order is irrelevant |
limit | Limit |
out_nbad | (Optional output) number of bad pixels in image (window), returns -1 in the case of error |