ifw-odp  2.0.0-alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Macros | Functions
clipm_testlib_tools.c File Reference
#include <clipm.h>
#include "clipm_testlib_tools.h"
#include "clipm_testlib_base.h"
#include "clipm_priv_checks.h"
#include "clipm_priv_error.h"
#include "clipm_priv_image.h"
#include "cpl_image_defs.h"

Macros

#define clipm_testlib_image_add_wgn_BODY(TYPE)
 

Functions

void clipm_testlib_array_dump (const cpl_array *array, const char *name)
 Dump an array to stdout. More...
 
cpl_image * clipm_testlib_image_create_invalid (cpl_size xsize, cpl_size ysize)
 Create an image of type CPL_TYPE_INVALID. More...
 
cpl_matrix * clipm_testlib_generate_poisson_points (double xmin, double ymin, double xmax, double ymax, cpl_size homogeneity, cpl_size N, cpl_type type)
 Generate a list of N random points stored in a matrix. More...
 
cpl_image * clipm_testlib_image_create_gaussians (int xsize, int ysize, cpl_matrix *locations, cpl_type type, double weight, double sigma)
 Create an image containing a set of equal gaussian peaks. More...
 
cpl_error_code clipm_testlib_image_add_wgn (cpl_image *image, const cpl_size window_xxyy[4], double sigma, double noise_abs_limit)
 Add white gaussian noise to an image. More...
 
cpl_type clipm_testlib_ctype_2_cpltype (const char *ctype_str)
 Get CPL type from C-type identifier string. More...
 
const char * clipm_testlib_cpltype_2_literal (cpl_type type)
 Get CPL type as string. More...
 
int clipm_testlib_iterate_types_windows (int *iterator, cpl_type in_types_or, const cpl_size in_window_xxyy[4], const cpl_image *in_image, cpl_type *out_type, cpl_size **out_window_xxyy, cpl_image **out_image, cpl_size *out_ngoodpix)
 
cpl_error_code clipm_testlib_image_reject_pattern (cpl_image *img, const cpl_size window_xxyy[4], const char *pattern_name)
 Reject a pattern of pixels. More...
 
cpl_error_code clipm_testlib_image_reject_all (cpl_image *img, const cpl_size window_xxyy[4])
 Reject all pixels in image (window) More...
 
cpl_size clipm_testlib_image_count_bad (const cpl_image *img, const cpl_size window_xxyy[4])
 Count the bad pixels in an image (window). More...
 
cpl_size clipm_testlib_image_count_bad_wdw (const cpl_image *img, cpl_size x1, cpl_size y1, cpl_size x2, cpl_size y2)
 Count the bad pixels in an image (window). More...
 
cpl_image * clipm_testlib_image_conv_matrix (const cpl_image *img, const cpl_matrix *kernel, int extend_bpm)
 Simple reference convolution implementation. More...
 
cpl_error_code clipm_testlib_image_get_window_details (const cpl_image *img, const cpl_size window_xxyy[4], cpl_size ll[2], cpl_size ur[2], cpl_size size[2])
 Return the corners of a window and its size. More...
 
cpl_error_code _clipm_testlib_image_save_if_verbose (const cpl_image *img, const char *func, const char *identifier, int nr)
 Write an image to disk and print a message. More...
 

Macro Definition Documentation

#define clipm_testlib_image_add_wgn_BODY (   TYPE)
Value:
do { \
cpl_size x, \
y; \
TYPE *tdata; \
\
tdata = (TYPE*)data; \
\
for (y = 0; y < wdwsize[1]; y++) \
{ \
for (x = 0; x < wdwsize[0]; x++) \
{ \
if (badp == NULL || badp[x] == CPL_BINARY_0) \
{ \
double g; \
g = sigma * clipm_math_rng_gaussian(); \
if (noise_abs_limit >= 0.0 && fabs(g) > noise_abs_limit) \
g = (g < 0.0 ? -1 : +1) * noise_abs_limit; \
if (type == CPL_TYPE_INT) \
tdata[x] += clipm_math_round_d2i(g); \
else \
tdata[x] += g; \
} \
} \
tdata += size[0]; \
if (badp != NULL) \
badp += size[0]; \
} \
} while (0)
double clipm_math_rng_gaussian(void)
Generate gaussian-distributed random number.
Definition: clipm_math_rng.c:255
int clipm_math_round_d2i(double in)
Round a double value to the nearest integer.
Definition: clipm_math.c:73