ifw-odp  2.0.0-alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions
Image Simulation

Functions

cpl_error_code clipm_image_sim_noise_gaussian (cpl_image *img_modified, const cpl_size window_xxyy[4], double sigma)
 Add white gaussian noise to an image. More...
 
cpl_error_code clipm_image_sim_circle (cpl_image *img_modified, double centre_x, double centre_y, double radius, double brightness)
 Add a circle to an existing image (additively, on top). More...
 
cpl_error_code clipm_image_sim_rectangle (cpl_image *img_modified, double centre_x, double centre_y, double angle, double length, double width, double brightness)
 Add a circle to an existing image (additively, on top). More...
 

Detailed Description

This module provides tool functions for the simulation of image content. They are intended to create test images.

Synopsis:
*

Function Documentation

cpl_error_code clipm_image_sim_circle ( cpl_image *  img_modified,
double  centre_x,
double  centre_y,
double  radius,
double  brightness 
)

Add a circle to an existing image (additively, on top).

Parameters
img_modifiedInput image to modify (FITS convention)
centre_xX centre
centre_yY centre
radiusRadius, if = 0, nothing is done
brightnessFilling brightness
Returns
CPL error code
Principle:
  • A filled circle is added on top of the existing image content.
  • radius can be negative, in this case nothing is done.
  • The centre may lie outside the image.
Bad Pixel Handling:
Since the circle is added to the existing image content, only good pixels will be modified.
Error Handling:
The following errors can be set and returned:
  • CPL_ERROR_NULL_INPUT: img_modified is NULL
  • CPL_ERROR_INVALID_TYPE: img_modified is not of type CPL_TYPE_INT, CPL_TYPE_FLOAT or CPL_TYPE_DOUBLE
Todo:
  • implement unit test
cpl_error_code clipm_image_sim_noise_gaussian ( cpl_image *  img_modified,
const cpl_size  window_xxyy[4],
double  sigma 
)

Add white gaussian noise to an image.

Parameters
img_modifiedImage
window_xxyy(Optional) Coordinate buffer of the form {xa, xb, ya, yb}, can be NULL, minimum/maximum order is irrelevant
sigmaNoise sigma, must be > 0
Returns
CPL error code
Principle:
  • An existing image must be passed.
  • Gaussian noise is added to the pixels with the corresponding sigma value.
  • The added absolute noise values are limited to 4*sigma to produce a reliable value range for testing.
Bad Pixel Handling:
Bad pixels are ignored (the data buffer is not modified at these locations).
Error Handling:
The following errors can be set and returned:
  • CPL_ERROR_NULL_INPUT: image is NULL
  • CPL_ERROR_ILLEGAL_INPUT: sigma <= 0
  • CPL_ERROR_INVALID_TYPE: image is not of type CPL_TYPE_INT, CPL_TYPE_FLOAT or CPL_TYPE_DOUBLE
  • CPL_ERROR_ACCESS_OUT_OF_RANGE: window_xxyy specifies coordinates outside the image plane
Todo:
  • implement unit test
cpl_error_code clipm_image_sim_rectangle ( cpl_image *  img_modified,
double  centre_x,
double  centre_y,
double  angle,
double  length,
double  width,
double  brightness 
)

Add a circle to an existing image (additively, on top).

Parameters
img_modifiedInput image to modify (FITS convention)
centre_xX centre
centre_yY centre
angleOrientation (mathematically positive, i.e. counterclockwise)
lengthLength, will point into the direction of angle
widthWidth
brightnessFilling brightness
Returns
CPL error code
Principle:
  • A filled rectangle is added on top of the existing image content.
  • The centre may lie outside the image.
Bad Pixel Handling:
Since the rectangle is added to the existing image content, only good pixels will be modified.
Error Handling:
The following errors can be set and returned:
  • CPL_ERROR_NULL_INPUT: img_modified is NULL
  • CPL_ERROR_INVALID_TYPE: img_modified is not of type CPL_TYPE_INT, CPL_TYPE_FLOAT or CPL_TYPE_DOUBLE
Todo:
  • implement unit test