Main Page | Modules | Alphabetical List | Class List | Directories | Class Members

Image generation functions


Functions

cpl_error_code cpl_image_fill_noise_uniform (cpl_image *ima, double min_pix, double max_pix)
 Generate an image with uniform random noise distribution.
cpl_error_code cpl_image_fill_gaussian (cpl_image *ima, double xcen, double ycen, double norm, double sig_x, double sig_y)
 Generate an image from a 2d gaussian function.
cpl_error_code cpl_image_fill_polynomial (cpl_image *ima, const cpl_polynomial *poly, double startx, double stepx, double starty, double stepy)
 Generate an image from a 2d polynomial function.
cpl_image * cpl_image_fill_test_create (int nx, int ny)
 Generate an image for testing purposes.

Detailed Description

This module provides functions to generate images.

These functions are mostly used to test the software. Gaussian images, or uniform noise images can be generated.

Synopsis:
   #include "cpl_image_gen.h"

Function Documentation

cpl_error_code cpl_image_fill_gaussian cpl_image *  ima,
double  xcen,
double  ycen,
double  norm,
double  sig_x,
double  sig_y
 

Generate an image from a 2d gaussian function.

Parameters:
ima the gaussian image to generate
xcen x position of the center (1 for the first pixel)
ycen y position of the center (1 for the first pixel)
norm norm of the gaussian.
sig_x Sigma in x for the gaussian distribution.
sig_y Sigma in y for the gaussian distribution.
Returns:
the _cpl_error_code_ or CPL_ERROR_NONE
This function expects an already allocated image. This function generates an image of a 2d gaussian. The gaussian is defined by the position of its centre, given in pixel coordinates inside the image with the FITS convention (x from 1 to nx, y from 1 to ny), its norm and the value of sigma in x and y.

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))

The input image type can be CPL_TYPE_FLOAT or CPL_TYPE_DOUBLE.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if (one of) the input pointer(s) is NULL
  • CPL_ERROR_TYPE_MISMATCH if the passed image type is not supported

cpl_error_code cpl_image_fill_noise_uniform cpl_image *  ima,
double  min_pix,
double  max_pix
 

Generate an image with uniform random noise distribution.

Parameters:
ima the image to generate
min_pix Minimum output pixel value.
max_pix Maximum output pixel value.
Returns:
the _cpl_error_code_ or CPL_ERROR_NONE
Generate an image with a uniform random noise distribution. Pixel values are within the provided bounds. This function expects an already allocated image. The input image type can be CPL_TYPE_FLOAT or CPL_TYPE_DOUBLE.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if (one of) the input pointer(s) is NULL
  • CPL_ERROR_ILLEGAL_INPUT if min_pix is bigger than max_pix
  • CPL_ERROR_TYPE_MISMATCH if the passed image type is not supported

cpl_error_code cpl_image_fill_polynomial cpl_image *  ima,
const cpl_polynomial *  poly,
double  startx,
double  stepx,
double  starty,
double  stepy
 

Generate an image from a 2d polynomial function.

Parameters:
ima the polynomial image to generate
poly the 2d polynomial
startx the x value associated with the left pixels column
stepx the x step
starty the y value associated with the bottom pixels row
stepy the y step
Returns:
the _cpl_error_code_ or CPL_ERROR_NONE
This function expects an already allocated image. The pixel value of the pixel (i, j) is set to poly(startx+(i-1)*stepx, starty+(j-1)*stepy).

The input image type can be CPL_TYPE_FLOAT or CPL_TYPE_DOUBLE.

If you want to generate an image whose pixel values are the values of the polynomial applied to the pixel positions, just call cpl_image_fill_polynomial(ima, poly, 1.0, 1.0, 1.0, 1.0) ;

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if (one of) the input pointer(s) is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the polynomial's dimension is not 2
  • CPL_ERROR_TYPE_MISMATCH if the passed image type is not supported

cpl_image* cpl_image_fill_test_create int  nx,
int  ny
 

Generate an image for testing purposes.

Parameters:
nx x size
ny y size
Returns:
1 newly allocated image or NULL in error case
Generates a reference pattern for testing purposes only. The created image has to be deallocated with cpl_image_delete().


Generated on Mon Sep 26 14:38:17 2005 for Common Pipeline Library Reference Manual by  doxygen 1.4.1