Defines | Typedefs | Functions
contrib/oul/ouml/image_ops.h File Reference
#include <vil1/vil1_memory_image_of.h>
#include <vil1/vil1_save.h>
#include "image_convert.h"
#include <vxl_config.h>

Go to the source code of this file.

Defines

#define INT_MAX   (int)0x7fffffff
#define INT_MIN   (int)(-0x80000000)

Typedefs

typedef vil1_memory_image_of< int > IntImage
typedef vil1_memory_image_of
< vxl_byte > 
ByteImage

Functions

template<class T >
vil1_memory_image_of< T > & operator-= (vil1_memory_image_of< T > &im1, vil1_memory_image_of< T > &im2)
template<class T >
vil1_memory_image_of< T > & operator+= (vil1_memory_image_of< T > &im1, T constant_add)
 += operator for images for adding a constant factor
template<class T >
void threshold_abs (vil1_memory_image_of< T > &image, vil1_memory_image_of< T > &source_vals, T threshold, T zero_val)
 threshold_abs
template<class T >
max_val (const vil1_memory_image_of< T > &image, T min)
 max_val
template<class T >
min_val (const vil1_memory_image_of< T > &image, T max)
 min_val
template<class T >
vil1_memory_image_of< T > * normalise_image (const vil1_memory_image_of< T > &src, T low, T high, T min, T max, T epsilon=(T) 0)
 normalise_image
void save_intimage_asbyte (vil1_memory_image_of< int > &src, char *filename)
void save_intimage_asbyte_nonorm (vil1_memory_image_of< int > &src, char *filename)

Define Documentation

#define INT_MAX   (int)0x7fffffff

Definition at line 10 of file image_ops.h.

#define INT_MIN   (int)(-0x80000000)

Definition at line 13 of file image_ops.h.


Typedef Documentation

typedef vil1_memory_image_of<vxl_byte> ByteImage

Definition at line 47 of file image_ops.h.

typedef vil1_memory_image_of<int> IntImage

Definition at line 46 of file image_ops.h.


Function Documentation

template<class T >
T max_val ( const vil1_memory_image_of< T > &  image,
min 
)

max_val

Return the maximum value for an image. Assumes that a < operator is defined on the template parameter.

Parameters:
vil1_memory_image_of<T>&image: the source image.
Tmin: the minimum value to use to initialise the search. For unsigned chars this will probably be 0, but for signed ints it might be -MAXINT, and for RGB could be rgb<0,0,0> etc.
Returns:
T: the maximum value found.

Definition at line 162 of file image_ops.txx.

template<class T >
T min_val ( const vil1_memory_image_of< T > &  image,
max 
)

min_val

Return the minimum value for an image. Assumes that a < operator is defined on the template parameter.

Parameters:
vil1_memory_image_of<T>&image: the source image.
Tmax: the maximum value to use to initialise the search. For unsigned chars this will probably be 255, but for signed ints it might be MAXINT, and for RGB could be rgb<255,255,255> etc.
Returns:
T: the minimum value found.

Definition at line 186 of file image_ops.txx.

template<class T >
vil1_memory_image_of<T>* normalise_image ( const vil1_memory_image_of< T > &  src,
low,
high,
min,
max,
epsilon 
)

normalise_image

Normalise an image so that the pixel values fit within the range specified. This is useful for normalising prior to saving int/double images. Can normalise to 0 to 255 and then save as a pgm etc.

Parameters:
vil1_memory_image_of<T>&src: the source image
Tlow: the minimum value to normalise to
Thigh: the maximum value to normalise to
Tmin: the smallest possible value of a T
Tmax: the largest possible value of a T
Tepsilon: a small T. Needed for normalising floats etc as numerical inaccuracy can cause the result to be slightly greater than high.
Returns:
vil1_memory_image_of<T> *: a new normalised image

Definition at line 215 of file image_ops.txx.

template<class T >
vil1_memory_image_of<T>& operator+= ( vil1_memory_image_of< T > &  im1,
constant_add 
)

+= operator for images for adding a constant factor

An in place += operator for images. Saves from having to copy any data anywhere.

Parameters:
im1,:vil1_memory_image_of<T> &, the image to be modified
constant_add,:T, the amount to add to each pixel in the image
Returns:
vil1_memory_image_of<T> &: a reference to im1
Author:
Brendan McCane

Definition at line 79 of file image_ops.txx.

template<class T >
vil1_memory_image_of<T>& operator-= ( vil1_memory_image_of< T > &  im1,
vil1_memory_image_of< T > &  im2 
)

-= operator for images

An in place -= operator for images. Saves from having to copy any data anywhere.

Parameters:
im1,:vil1_memory_image_of<T> &, the image to be modified
im2,:vil1_memory_image_of<T> &, the image to subtract from
Returns:
vil1_memory_image_of<T> &: a reference to im1
Author:
Brendan McCane

Definition at line 34 of file image_ops.txx.

void save_intimage_asbyte ( vil1_memory_image_of< int > &  src,
char *  filename 
) [inline]

Definition at line 49 of file image_ops.h.

void save_intimage_asbyte_nonorm ( vil1_memory_image_of< int > &  src,
char *  filename 
) [inline]

Definition at line 63 of file image_ops.h.

template<class T >
void threshold_abs ( vil1_memory_image_of< T > &  image,
vil1_memory_image_of< T > &  source_vals,
threshold,
zero_val 
)

threshold_abs

Threshold the passed in image but in an abs manner. That is, a pixel is set if abs(x-y)>threshold. Pixels which satisfy the condition are set to their corresponding counterparts in the source_vals image, and pixels which fail the condition are set to zero_val.

Parameters:
image,:vil1_memory_image_of<T> &, the image to be modified
source_vals,:vil1_memory_image_of<T> &, the image to be modified
threshold,:T, the threshold to apply
zero_val,:T, the value to set the thresholded pixels to
Author:
Brendan McCane

Definition at line 124 of file image_ops.txx.