BRL-CAD
Collaboration diagram for Image Operations:

Files

file  ops.h
 

Enumerations

enum  ICV_RESIZE_METHOD { ICV_RESIZE_UNDERSAMPLE , ICV_RESIZE_SHRINK , ICV_RESIZE_NINTERP , ICV_RESIZE_BINTERP }
 

Functions

int icv_sanitize (icv_image_t *img)
 
int icv_add_val (icv_image_t *img, double val)
 
int icv_multiply_val (icv_image_t *img, double val)
 
int icv_divide_val (icv_image_t *img, double val)
 
int icv_pow_val (icv_image_t *img, double val)
 
icv_image_ticv_add (icv_image_t *img1, icv_image_t *img2)
 
icv_image_ticv_sub (icv_image_t *img1, icv_image_t *img2)
 
icv_image_ticv_multiply (icv_image_t *img1, icv_image_t *img2)
 
icv_image_ticv_divide (icv_image_t *img1, icv_image_t *img2)
 
int icv_saturate (icv_image_t *img, double sat)
 
int icv_resize (icv_image_t *bif, ICV_RESIZE_METHOD method, size_t out_width, size_t out_height, size_t factor)
 
int icv_rot (size_t argc, const char *argv[])
 

Detailed Description

Various routines to perform operations on images.

Enumeration Type Documentation

◆ ICV_RESIZE_METHOD

Enumerator
ICV_RESIZE_UNDERSAMPLE 
ICV_RESIZE_SHRINK 
ICV_RESIZE_NINTERP 
ICV_RESIZE_BINTERP 

Definition at line 145 of file ops.h.

Function Documentation

◆ icv_sanitize()

int icv_sanitize ( icv_image_t img)

This function sanitizes the image.

It forces the image pixels to be in the prescribed range.

All the pixels higher than the max range are set to MAX (1.0). All the pixels lower than the min range are set to MIN (0.0).

Note if an image(bif) is sanitized then, (bif->flags&&ICV_SANITIZED) is true.

◆ icv_add_val()

int icv_add_val ( icv_image_t img,
double  val 
)

This adds a constant value to all the pixels of the image. Also if the flag ICV_OPERATIONS_MODE is set this doesn't sanitize the image.

Note to set the flag for a bif (icv_image struct); bif->flags |= ICV_OPERATIONS_MODE;

◆ icv_multiply_val()

int icv_multiply_val ( icv_image_t img,
double  val 
)

This multiplies all the pixels of the image with a constant Value. Also if the flag ICV_OPERATIONS_MODE is set this doesn't sanitize the image.

◆ icv_divide_val()

int icv_divide_val ( icv_image_t img,
double  val 
)

This divides all the pixels of the image with a constant Value. Also if the flag ICV_OPERATIONS_MODE is set this doesn't sanitize the image.

◆ icv_pow_val()

int icv_pow_val ( icv_image_t img,
double  val 
)

This raises all the pixels of the image to a constant exponential power. Also if the flag ICV_OPERATIONS_MODE is set this doesn't sanitize the image.

◆ icv_add()

icv_image_t * icv_add ( icv_image_t img1,
icv_image_t img2 
)

This routine adds pixel value of one image to pixel value of other pixel and inserts in the same index of the output image.

Also it sanitizes the image.

◆ icv_sub()

icv_image_t * icv_sub ( icv_image_t img1,
icv_image_t img2 
)

This routine subtracts pixel value of one image from pixel value of other pixel and inserts the result at the same index of the output image.

Also it sanitizes the image.

Parameters
img1First Image.
img2Second Image.
Returns
New icv_image (img1 - img2)

◆ icv_multiply()

icv_image_t * icv_multiply ( icv_image_t img1,
icv_image_t img2 
)

This routine multiplies pixel value of one image to pixel value of other pixel and inserts the result at the same index of the output image.

Also it sanitizes the image.

Parameters
img1First Image.
img2Second Image.
Returns
New icv_image (img1 * img2)

◆ icv_divide()

icv_image_t * icv_divide ( icv_image_t img1,
icv_image_t img2 
)

This routine divides pixel value of one image from pixel value of other pixel and inserts the result at the same index of the output image.

Also it sanitizes the image.

Parameters
img1First Image.
img2Second Image.
Returns
New icv_image (img1 / img2)

◆ icv_saturate()

int icv_saturate ( icv_image_t img,
double  sat 
)

Change the saturation of image pixels. If sat is set to 0.0 the result will be monochromatic; if sat is made 1.0, the color will not change; if sat is made greater than 1.0, the amount of color is increased.

Parameters
imgRGB Image to be saturated.
satSaturation value.

◆ icv_resize()

int icv_resize ( icv_image_t bif,
ICV_RESIZE_METHOD  method,
size_t  out_width,
size_t  out_height,
size_t  factor 
)

This function resizes the given input image. Mode of usage: a) ICV_RESIZE_UNDERSAMPLE : This method undersamples the said image e.g. icv_resize(bif, ICV_RESIZE_UNDERSAMPLE, 0, 0, 2); undersamples the image with a factor of 2.

b) ICV_RESIZE_SHRINK : This Shrinks the image, keeping the light energy per square area as constant. e.g. icv_resize(bif, ICV_RESIZE_SHRINK,0,0,2); shrinks the image with a factor of 2.

c) ICV_RESIZE_NINTERP : This interpolates using nearest neighbor method. e.g. icv_resize(bif, ICV_RESIZE_NINTERP,1024,1024,0); interpolates the output image to have the size of 1024X1024.

d) ICV_RESIZE_BINTERP : This interpolates using bilinear Interpolation Method. e.g. icv_resize(bif, ICV_RESIZE_BINTERP,1024,1024,0); interpolates the output image to have the size of 1024X1024.

resizes the image inplace.

Parameters
bifImage (packed in icv_image struct)
methodOne of the modes.
out_widthOut Width.
out_heightOut Height.
factorInteger type data representing the factor to be shrunken
Returns
0 on success and -1 on failure.

◆ icv_rot()

int icv_rot ( size_t  argc,
const char *  argv[] 
)

Rotate an image. s [-rifb | -a angle] [-# bytes] [-s squaresize] [-w width] [-n height] [-o outputfile] inputfile [> outputfile]