Functions | |
cpl_error_code | cpl_image_abs (cpl_image *image) |
Take the absolute value of an image. | |
cpl_image * | cpl_image_abs_create (const cpl_image *image_in) |
Take the absolute value of an image. | |
cpl_error_code | cpl_image_add (cpl_image *im1, const cpl_image *im2) |
Add two images, store the result in the first image. | |
cpl_image * | cpl_image_add_create (const cpl_image *image1, const cpl_image *image2) |
Add two images. | |
cpl_error_code | cpl_image_add_scalar (cpl_image *image, double addend) |
Elementwise addition of a scalar to an image. | |
cpl_image * | cpl_image_add_scalar_create (const cpl_image *image, double addend) |
Create a new image by elementwise addition of a scalar to an image. | |
cpl_image * | cpl_image_average_create (const cpl_image *image_1, const cpl_image *image_2) |
Build the average of two images. | |
cpl_image * | cpl_image_collapse_create (const cpl_image *self, int direction) |
Collapse an image along its rows or columns. | |
cpl_image * | cpl_image_collapse_median_create (const cpl_image *in, int direction, int discard_lo, int discard_hi) |
Collapse an image along its rows and columns, with filtering. | |
cpl_image * | cpl_image_collapse_window_create (const cpl_image *self, int llx, int lly, int urx, int ury, int direction) |
Collapse an image region along its rows or columns. | |
cpl_error_code | cpl_image_copy (cpl_image *im1, const cpl_image *im2, int xpos, int ypos) |
Copy one image into another. | |
cpl_error_code | cpl_image_divide (cpl_image *im1, const cpl_image *im2) |
Divide two images, store the result in the first image. | |
cpl_image * | cpl_image_divide_create (const cpl_image *image1, const cpl_image *image2) |
Divide two images. | |
cpl_error_code | cpl_image_divide_scalar (cpl_image *image, double divisor) |
Elementwise division of an image with a scalar. | |
cpl_image * | cpl_image_divide_scalar_create (const cpl_image *image, double divisor) |
Create a new image by elementwise division of an image with a scalar. | |
cpl_error_code | cpl_image_exponential (cpl_image *image, double base) |
Compute the elementwise exponential of the image. | |
cpl_image * | cpl_image_exponential_create (const cpl_image *image, double base) |
Create a new image by elementwise exponentiation of an image. | |
cpl_image * | cpl_image_extract (const cpl_image *in, int llx, int lly, int urx, int ury) |
Extract a rectangular zone from an image into another image. | |
cpl_error_code | cpl_image_fft (cpl_image *real, cpl_image *imaginary, unsigned mode) |
Fast Fourier Transform an image. | |
cpl_error_code | cpl_image_fit_gaussian (const cpl_image *im, int xpos, int ypos, int size, double *norm, double *xcen, double *ycen, double *sig_x, double *sig_y, double *fwhm_x, double *fwhm_y) |
Apply a gaussian fit on an image sub window. | |
cpl_error_code | cpl_image_flip (cpl_image *im, int angle) |
Flip an image on a given miror line. | |
cpl_error_code | cpl_image_get_fwhm (const cpl_image *in, int xpos, int ypos, double *fwhm_x, double *fwhm_y) |
Compute FWHM values in x and y for an object. | |
cpl_error_code | cpl_image_logarithm (cpl_image *image, double base) |
Compute the elementwise logarithm of the image. | |
cpl_image * | cpl_image_logarithm_create (const cpl_image *image, double base) |
Create a new image by taking the elementwise logarithm of an image. | |
cpl_error_code | cpl_image_move (cpl_image *im, int nb_cut, const int *new_pos) |
Reorganize the pixels in an image. | |
cpl_error_code | cpl_image_multiply (cpl_image *im1, const cpl_image *im2) |
Multiply two images, store the result in the first image. | |
cpl_image * | cpl_image_multiply_create (const cpl_image *image1, const cpl_image *image2) |
Multiply two images. | |
cpl_error_code | cpl_image_multiply_scalar (cpl_image *image, double factor) |
Elementwise multiplication of an image with a scalar. | |
cpl_image * | cpl_image_multiply_scalar_create (const cpl_image *image, double factor) |
Create a new image by multiplication of a scalar and an image. | |
cpl_error_code | cpl_image_normalise (cpl_image *image, cpl_norm mode) |
Normalise pixels in an image. | |
cpl_image * | cpl_image_normalise_create (const cpl_image *image_in, cpl_norm mode) |
Create a new normalised image from an existing image. | |
cpl_error_code | cpl_image_power (cpl_image *image, double exponent) |
Compute the elementwise power of the image. | |
cpl_image * | cpl_image_power_create (const cpl_image *image, double exponent) |
Create a new image by elementwise raising of an image to a power. | |
cpl_error_code | cpl_image_shift (cpl_image *self, int dx, int dy) |
Shift an image by integer offsets. | |
cpl_error_code | cpl_image_subtract (cpl_image *im1, const cpl_image *im2) |
Subtract two images, store the result in the first image. | |
cpl_image * | cpl_image_subtract_create (const cpl_image *image1, const cpl_image *image2) |
Subtract two images. | |
cpl_error_code | cpl_image_subtract_scalar (cpl_image *image, double subtrahend) |
Elementwise subtraction of a scalar from an image. | |
cpl_image * | cpl_image_subtract_scalar_create (const cpl_image *image, double subtrahend) |
Create an image by elementwise subtraction of a scalar from an image. | |
cpl_error_code | cpl_image_threshold (cpl_image *image_in, double lo_cut, double hi_cut, double assign_lo_cut, double assign_hi_cut) |
Threshold an image to a given interval. | |
cpl_error_code | cpl_image_turn (cpl_image *self, int rot) |
Rotate an image by a multiple of 90 degrees counterclockwise. | |
cpl_vector * | cpl_vector_new_from_image_column (const cpl_image *image_in, int pos) |
Extract a column from an image. | |
cpl_vector * | cpl_vector_new_from_image_row (const cpl_image *image_in, int pos) |
Extract a row from an image. |
#include "cpl_image_basic.h"
cpl_error_code cpl_image_abs | ( | cpl_image * | image | ) |
Take the absolute value of an image.
image | Image to be modified in place |
Possible _cpl_error_code_ set in this function:
cpl_image* cpl_image_abs_create | ( | const cpl_image * | image_in | ) |
Take the absolute value of an image.
image_in | Image operand. |
cpl_error_code cpl_image_add | ( | cpl_image * | im1, | |
const cpl_image * | im2 | |||
) |
Add two images, store the result in the first image.
im1 | first operand. | |
im2 | second operand. |
The bad pixels map of the first image becomes the union of the bad pixels maps of the input images.
Possible _cpl_error_code_ set in this function:
cpl_image* cpl_image_add_create | ( | const cpl_image * | image1, | |
const cpl_image * | image2 | |||
) |
Add two images.
image1 | first operand | |
image2 | second operand |
The bad pixels map of the result is the union of the bad pixels maps of the input images.
Possible _cpl_error_code_ set in this function:
cpl_error_code cpl_image_add_scalar | ( | cpl_image * | image, | |
double | addend | |||
) |
Elementwise addition of a scalar to an image.
image | Image to be modified in place. | |
addend | Number to add |
The operation is always performed in double precision, with a final cast of the result to the target image type.
Images can be CPL_TYPE_INT, CPL_TYPE_FLOAT, CPL_TYPE_DOUBLE.
Possible _cpl_error_code_ set in this function:
cpl_image* cpl_image_add_scalar_create | ( | const cpl_image * | image, | |
double | addend | |||
) |
Create a new image by elementwise addition of a scalar to an image.
image | Image to add | |
addend | Number to add |
cpl_image* cpl_image_average_create | ( | const cpl_image * | image_1, | |
const cpl_image * | image_2 | |||
) |
Build the average of two images.
image_1 | First image operand. | |
image_2 | Second image operand. |
Possible _cpl_error_code_ set in this function:
cpl_image* cpl_image_collapse_create | ( | const cpl_image * | self, | |
int | direction | |||
) |
Collapse an image along its rows or columns.
self | Image to collapse. | |
direction | Collapsing direction. |
Collapse along y: p7 p8 p9 Input image is a 3x3 image containing 9 pixels. p4 p5 p6 The output is an image containing one row with p1 p2 p3 3 pixels A, B, C, where: ---------- A B C A = p1+p4+p7 B = p2+p5+p8 C = p3+p6+p9 If p7 is a bad pixel, A = (p1+p4)*3/2. If p1, p4, p7 are bad, A is flagged as bad.
Provide the collapsing direction as an int. Give 0 to collapse along y (sum of rows) and get an image with a single row in output, or give 1 to collapse along x (sym of columns) to get an image with a single column in output. Only the good pixels are collapsed. Images can be CPL_TYPE_INT, CPL_TYPE_FLOAT or CPL_TYPE_DOUBLE. The returned image must be deallocated using cpl_image_delete().
Possible _cpl_error_code_ set in this function:
cpl_image* cpl_image_collapse_median_create | ( | const cpl_image * | in, | |
int | direction, | |||
int | discard_lo, | |||
int | discard_hi | |||
) |
Collapse an image along its rows and columns, with filtering.
in | Input image. | |
direction | Collapsing direction. | |
discard_lo | Low rejection parameter. | |
discard_hi | High rejection parameter. |
Possible _cpl_error_code_ set in this function:
cpl_image* cpl_image_collapse_window_create | ( | const cpl_image * | self, | |
int | llx, | |||
int | lly, | |||
int | urx, | |||
int | ury, | |||
int | direction | |||
) |
Collapse an image region along its rows or columns.
self | Image to collapse. | |
llx | lower left x coord. | |
lly | lower left y coord | |
urx | upper right x coord | |
ury | upper right y coord | |
direction | Collapsing direction. |
Possible _cpl_error_code_ set in this function:
cpl_error_code cpl_image_copy | ( | cpl_image * | im1, | |
const cpl_image * | im2, | |||
int | xpos, | |||
int | ypos | |||
) |
Copy one image into another.
im1 | the image in which im2 is inserted | |
im2 | the inserted image | |
xpos | the x pixel position in im1 where the lower left pixel of im2 should go (from 1 to the x size of im1) | |
ypos | the y pixel position in im1 where the lower left pixel of im2 should go (from 1 to the y size of im1) |
The two input images must be of the same type, namely one of CPL_TYPE_INT, CPL_TYPE_FLOAT, CPL_TYPE_DOUBLE.
Possible _cpl_error_code_ set in this function:
cpl_error_code cpl_image_divide | ( | cpl_image * | im1, | |
const cpl_image * | im2 | |||
) |
Divide two images, store the result in the first image.
im1 | first operand. | |
im2 | second operand. |
cpl_image* cpl_image_divide_create | ( | const cpl_image * | image1, | |
const cpl_image * | image2 | |||
) |
Divide two images.
image1 | first operand | |
image2 | second operand |
cpl_image_divide() The result of division with a zero-valued pixel is marked as a bad pixel.
cpl_error_code cpl_image_divide_scalar | ( | cpl_image * | image, | |
double | divisor | |||
) |
Elementwise division of an image with a scalar.
image | Image to be modified in place. | |
divisor | Non-zero number to divide with |
Images can be CPL_TYPE_INT, CPL_TYPE_FLOAT, CPL_TYPE_DOUBLE.
If divisor is zero, the image is not modified (and an error is returned).
Possible _cpl_error_code_ set in this function:
cpl_image* cpl_image_divide_scalar_create | ( | const cpl_image * | image, | |
double | divisor | |||
) |
Create a new image by elementwise division of an image with a scalar.
image | Image to divide | |
divisor | Non-zero number to divide with |
cpl_error_code cpl_image_exponential | ( | cpl_image * | image, | |
double | base | |||
) |
Compute the elementwise exponential of the image.
image | Image to be modified in place. | |
base | Base of the exponential. |
Images can be CPL_TYPE_INT, CPL_TYPE_FLOAT or CPL_TYPE_DOUBLE.
If the base is zero all pixels must be positive and if the base is negative all pixels must be integer, otherwise a cpl_error_code is returned and the image is unmodified.
Possible _cpl_error_code_ set in this function:
cpl_image* cpl_image_exponential_create | ( | const cpl_image * | image, | |
double | base | |||
) |
Create a new image by elementwise exponentiation of an image.
image | Image to exponentiate | |
base | Base of the exponential |
cpl_image* cpl_image_extract | ( | const cpl_image * | in, | |
int | llx, | |||
int | lly, | |||
int | urx, | |||
int | ury | |||
) |
Extract a rectangular zone from an image into another image.
in | Input image | |
llx | Lower left X coordinate | |
lly | Lower left Y coordinate | |
urx | Upper right X coordinate | |
ury | Upper right Y coordinate |
Coordinates must be provided in the FITS convention: lower left corner of the image is at (1,1), x increasing from left to right, y increasing from bottom to top. Images can be CPL_TYPE_INT, CPL_TYPE_FLOAT or CPL_TYPE_DOUBLE.
Possible _cpl_error_code_ set in this function:
cpl_error_code cpl_image_fft | ( | cpl_image * | real, | |
cpl_image * | imaginary, | |||
unsigned | mode | |||
) |
Fast Fourier Transform an image.
real | The image real part to be transformed in place | |
imaginary | The image imaginary part to be transformed in place | |
mode | The desired FFT options (combined with bitwise or) |
If the second passed image is NULL, the resulting imaginary part cannot be returned. This can be useful if the input is real and the output is known to also be real. But if the output has a significant imaginary part, you might want to pass a 0-valued image as the second parameter.
Any rejected pixel us used as if it were a good pixel.
The image must be square with a size that is a power of two.
These are the supported FFT modes: CPL_FFT_DEFAULT: Default, forward FFT transform CPL_FFT_INVERSE: Inverse FFT transform CPL_FFT_UNNORMALIZED: Do not normalize (with N*N for N-by-N image) on inverse. Has no effect on forward transform. CPL_FFT_SWAP_HALVES: Swap the four quadrants of the result image.
Possible _cpl_error_code_ set in this function:
cpl_error_code cpl_image_fit_gaussian | ( | const cpl_image * | im, | |
int | xpos, | |||
int | ypos, | |||
int | size, | |||
double * | norm, | |||
double * | xcen, | |||
double * | ycen, | |||
double * | sig_x, | |||
double * | sig_y, | |||
double * | fwhm_x, | |||
double * | fwhm_y | |||
) |
Apply a gaussian fit on an image sub window.
im | the input image | |
xpos | the x position of the center (1 for the first pixel) | |
ypos | the y position of the center (1 for the first pixel) | |
size | the window size in pixels, at least 4 | |
norm | the norm of the gaussian or NULL | |
xcen | the x center of the gaussian or NULL | |
ycen | the y center of the gaussian or NULL | |
sig_x | the sigma in x of the gaussian or NULL | |
sig_y | the sigma in y of the gaussian or NULL | |
fwhm_x | the FHHM in x or NULL | |
fwhm_y | the FHHM in y or NULL |
f(x, y) = (norm/(2*pi*sig_x*sig_y)) * exp(-(x-xcen)^2/(2*sig_x^2)) * exp(-(y-ycen)^2/(2*sig_y^2))
sig_x and sig_y are derived from fwhm_x and fwhm_y with: fwhm = 2 * sqrt(2*ln(2)) * sigma
Images can be CPL_TYPE_INT, CPL_TYPE_FLOAT or CPL_TYPE_DOUBLE.
The cpl_image_iqe() function is directly called by this function.
Possible _cpl_error_code_ set in this function:
cpl_error_code cpl_image_flip | ( | cpl_image * | im, | |
int | angle | |||
) |
Flip an image on a given miror line.
im | the image to flip. | |
angle | mirror line in polar coord. is theta = (PI/4) * angle |
angle can take one of the following values:
Images can be CPL_TYPE_INT, CPL_TYPE_FLOAT or CPL_TYPE_DOUBLE.
Possible _cpl_error_code_ set in this function:
cpl_error_code cpl_image_get_fwhm | ( | const cpl_image * | in, | |
int | xpos, | |||
int | ypos, | |||
double * | fwhm_x, | |||
double * | fwhm_y | |||
) |
Compute FWHM values in x and y for an object.
in | the input image | |
xpos | the x position of the object (1 for the first pixel) | |
ypos | the y position of the object (1 for the first pixel) | |
fwhm_x | the computed FWHM in x or -1 on error | |
fwhm_y | the computed FWHM in y or -1 on error |
For the FWHM in x (resp. y) to be computed, the image size in the x (resp. y) direction should be at least of 5 pixels.
If for any reason, one of the FHWMs cannot be computed, its returned value is -1.0, but an error is not necessarily raised. For example, if a 4 column image is passed, the fwhm_x would be -1.0, the fwhm_y would be correctly computed, and no error would be raised.
Possible _cpl_error_code_ set in this function:
cpl_error_code cpl_image_logarithm | ( | cpl_image * | image, | |
double | base | |||
) |
Compute the elementwise logarithm of the image.
image | Image to be modified in place. | |
base | Base of the logarithm. |
Images can be CPL_TYPE_INT, CPL_TYPE_FLOAT or CPL_TYPE_DOUBLE.
The base and all the pixels must be positive and the base must be different from 1, or a cpl_error_code will be returned and the image will be left unmodified.
Possible _cpl_error_code_ set in this function:
cpl_image* cpl_image_logarithm_create | ( | const cpl_image * | image, | |
double | base | |||
) |
Create a new image by taking the elementwise logarithm of an image.
image | Image to take logarithm of | |
base | Base of the logarithm. |
cpl_error_code cpl_image_move | ( | cpl_image * | im, | |
int | nb_cut, | |||
const int * | new_pos | |||
) |
Reorganize the pixels in an image.
im | the image to reorganize | |
nb_cut | the number of cut in x and y | |
new_pos | array with the nb_cut^2 new positions |
Images can be CPL_TYPE_INT, CPL_TYPE_FLOAT or CPL_TYPE_DOUBLE.
The image x and y sizes have to be multiples of nb_cut.
Example: 16 17 18 6 5 4 13 14 15 3 2 1 10 11 12 ----> 12 11 10 7 8 9 9 8 7 4 5 6 18 17 16 1 2 3 15 14 13 image 3x6 cpl_image_move(image, 3, new_pos); with new_pos = {9,8,7,6,5,4,3,2,1};
The bad pixels are moved accordingly.
Possible _cpl_error_code_ set in this function:
cpl_error_code cpl_image_multiply | ( | cpl_image * | im1, | |
const cpl_image * | im2 | |||
) |
Multiply two images, store the result in the first image.
im1 | first operand. | |
im2 | second operand. |
cpl_image* cpl_image_multiply_create | ( | const cpl_image * | image1, | |
const cpl_image * | image2 | |||
) |
Multiply two images.
image1 | first operand | |
image2 | second operand |
cpl_error_code cpl_image_multiply_scalar | ( | cpl_image * | image, | |
double | factor | |||
) |
Elementwise multiplication of an image with a scalar.
image | Image to be modified in place. | |
factor | Number to multiply with |
cpl_image* cpl_image_multiply_scalar_create | ( | const cpl_image * | image, | |
double | factor | |||
) |
Create a new image by multiplication of a scalar and an image.
image | Image to be multiplied | |
factor | Number to multiply with |
cpl_error_code cpl_image_normalise | ( | cpl_image * | image, | |
cpl_norm | mode | |||
) |
Normalise pixels in an image.
image | Image operand. | |
mode | Normalisation mode. |
Possible normalisations are:
Possible _cpl_error_code_ set in this function:
cpl_image* cpl_image_normalise_create | ( | const cpl_image * | image_in, | |
cpl_norm | mode | |||
) |
Create a new normalised image from an existing image.
image_in | Image operand. | |
mode | Normalisation mode. |
cpl_error_code cpl_image_power | ( | cpl_image * | image, | |
double | exponent | |||
) |
Compute the elementwise power of the image.
image | Image to be modified in place. | |
exponent | Scalar exponent. |
Images can be CPL_TYPE_INT, CPL_TYPE_FLOAT or CPL_TYPE_DOUBLE.
If the exponent is negative all pixels must be non-zero and if the exponent is non-integer all pixels must be non-negative, otherwise a cpl_error_code is returned and the image is unmodified.
Following the behaviour of C99 pow() function, this function sets 0^0 = 1.
Possible _cpl_error_code_ set in this function:
cpl_image* cpl_image_power_create | ( | const cpl_image * | image, | |
double | exponent | |||
) |
Create a new image by elementwise raising of an image to a power.
image | Image to raise to a power | |
exponent | scalar exponent |
cpl_error_code cpl_image_shift | ( | cpl_image * | self, | |
int | dx, | |||
int | dy | |||
) |
Shift an image by integer offsets.
self | The image to shift in place | |
dx | The shift in X | |
dy | The shift in Y |
Possible _cpl_error_code_ set in this function:
cpl_error_code cpl_image_subtract | ( | cpl_image * | im1, | |
const cpl_image * | im2 | |||
) |
Subtract two images, store the result in the first image.
im1 | first operand. | |
im2 | second operand. |
cpl_image* cpl_image_subtract_create | ( | const cpl_image * | image1, | |
const cpl_image * | image2 | |||
) |
Subtract two images.
image1 | first operand | |
image2 | second operand |
cpl_error_code cpl_image_subtract_scalar | ( | cpl_image * | image, | |
double | subtrahend | |||
) |
Elementwise subtraction of a scalar from an image.
image | Image to be modified in place. | |
subtrahend | Number to subtract |
cpl_image* cpl_image_subtract_scalar_create | ( | const cpl_image * | image, | |
double | subtrahend | |||
) |
Create an image by elementwise subtraction of a scalar from an image.
image | Image to be subtracted from | |
subtrahend | Number to subtract |
cpl_error_code cpl_image_threshold | ( | cpl_image * | image_in, | |
double | lo_cut, | |||
double | hi_cut, | |||
double | assign_lo_cut, | |||
double | assign_hi_cut | |||
) |
Threshold an image to a given interval.
image_in | Image to threshold. | |
lo_cut | Lower bound. | |
hi_cut | Higher bound. | |
assign_lo_cut | Value to assign to pixels below low bound. | |
assign_hi_cut | Value to assign to pixels above high bound. |
Use FLT_MIN and FLT_MAX for floating point images and DBL_MIN and DBL_MAX for double images for the lo_cut and hi_cut to avoid any pixel replacement.
Images can be CPL_TYPE_INT, CPL_TYPE_FLOAT or CPL_TYPE_DOUBLE. lo_cut must be smaller than or equal to hi_cut.
Possible _cpl_error_code_ set in this function:
cpl_error_code cpl_image_turn | ( | cpl_image * | self, | |
int | rot | |||
) |
Rotate an image by a multiple of 90 degrees counterclockwise.
self | The image to rotate in place. | |
rot | The multiple: -1 is a rotation of 90 deg clockwise. |
For rotations of +90 or -90 degrees on rectangular non-1D-images, the pixel buffer is temporarily duplicated.
rot may be any integer value, its modulo 4 determines the rotation:
Possible _cpl_error_code_ set in this function:
cpl_vector* cpl_vector_new_from_image_column | ( | const cpl_image * | image_in, | |
int | pos | |||
) |
Extract a column from an image.
image_in | Input image | |
pos | Position of the column (1 for the left one) |
The bad pixels map is not taken into account in this function.
Possible _cpl_error_code_ set in this function:
cpl_vector* cpl_vector_new_from_image_row | ( | const cpl_image * | image_in, | |
int | pos | |||
) |
Extract a row from an image.
image_in | Input image | |
pos | Position of the row (1 for the bottom one) |
The bad pixels map is not taken into account in this function.
Possible _cpl_error_code_ set in this function: