|
BRL-CAD
|
Files | |
| file | ops.h |
Macros | |
| #define | ICV_DIFF_PHASH 0 |
| #define | ICV_DIFF_SSIM 1 |
Enumerations | |
| enum | ICV_RESIZE_METHOD { ICV_RESIZE_UNDERSAMPLE , ICV_RESIZE_SHRINK , ICV_RESIZE_NINTERP , ICV_RESIZE_BINTERP } |
Various routines to perform operations on images.
| #define ICV_DIFF_PHASH 0 |
| int icv_sanitize | ( | icv_image_t * | img | ) |
| 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;
| 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.
| 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.
| 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_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_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.
| img1 | First Image. |
| img2 | Second Image. |
| 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.
| img1 | First Image. |
| img2 | Second Image. |
| 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.
| img1 | First Image. |
| img2 | Second Image. |
| 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 | ||
| ) |
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. Output endpoints map to input endpoints; a one-pixel output maps to source coordinate zero. 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. Output endpoints map to input endpoints; a one-pixel output maps to source coordinate zero. Stretching one dimension while shrinking the other is supported. 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.
| bif | Image (packed in icv_image struct) |
| method | One of the modes. |
| out_width | Out Width. |
| out_height | Out Height. |
| factor | Integer type data representing the factor to be shrunken |
Rotate an image. s [-rifb | -a angle] [-# bytes] [-s squaresize] [-w width] [-n height] [-o outputfile] inputfile [> outputfile]
|
extern |
Compare two images and report pixel differences. Return code is 1 if there are any differences, else 0. For more detailed reporting, pass non-null integer pointers to the matching, off_by_1, and/or off_by_many parameters.
Counts are per-channel (matching pixdiff "bytes" semantics):
|
extern |
Generate a visual representation of the differences between two images. (At least for now, images must be the same size.)
For pixels that match, a half-intensity greyscale representation is output. For pixels that differ, each channel is independently highlighted:
This means a pixel that differs only in the red channel appears as a pure red highlight, green-only difference as pure green, etc. – matching the traditional pixdiff output convention.
Returns NULL if there is an error.
|
extern |
Compare two images using perceptual image hashing and report the Hamming distance between them. Useful for approximate image comparisons.
|
extern |
|
extern |
Compare the embedded render metadata (icv_render_info) of two images.
Writes a human-readable report to out_msgs describing any differences found in the db filename, object list, and camera parameters.
Returns 0 if the metadata in both images is identical (or both absent), 1 if they differ, and -1 if neither image carries any metadata.
| img1 | First image (may be NULL – treated as having no metadata) |
| img2 | Second image (may be NULL – treated as having no metadata) |
| out_msgs | bu_vls to receive the human-readable comparison report; may be NULL |
|
extern |
Generate nirt shotline commands for every pixel that differs between img1 and img2.
A separate nirt script is written for each image that has render_info attached. Both scripts encode shotlines for the same set of differing pixels; they differ only in the camera parameters used to reconstruct the rays and in the scene header comment. This allows the caller to interrogate either scene independently even when the images were rendered from different .g files or with different object sets.
Ray reconstruction mirrors BRL-CAD rt/grid.c grid_setup() for the orthographic case (rt_perspective == 0). Perspective is also handled.
Either output file pointer may be NULL to suppress that output. If an image has no render_info the corresponding output is silently skipped.
| img1 | First image |
| img2 | Second image |
| nirt_out1 | Open FILE* to write img1's nirt script (may be NULL) |
| nirt_out2 | Open FILE* to write img2's nirt script (may be NULL) |
Returns the number of differing pixels for which shots were written, or -1 on error (e.g., neither active output has render metadata, mismatched sizes).
|
extern |
Fit an image to suggested dimensions.