Digital Image Correlation Engine
Version 1.0
A modular, high-performance, image correlation tool used to compute full-field displacements and strains from digital images
|
#include <DICe_Image.h>
Public Member Functions | |
Image (const char *file_name, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null) | |
Image (const char *file_name, const int_t offset_x, const int_t offset_y, const int_t width, const int_t height, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null) | |
Image (intensity_t *intensities, const int_t width, const int_t height, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null) | |
Image (const int_t width, const int_t height, Teuchos::ArrayRCP< intensity_t > intensities, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null, const int_t offset_x=0, const int_t offset_y=0) | |
Image (const int_t width, const int_t height, const intensity_t intensity=0.0, const int_t offset_x=0, const int_t offset_y=0) | |
Image (Teuchos::RCP< Image > img, const int_t offset_x=0, const int_t offset_y=0, const int_t width=-1, const int_t height=-1, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null) | |
void | initialize_array_image (intensity_t *intensities) |
void | default_constructor_tasks (const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null) |
default constructor tasks | |
void | update_image_fields (const char *file_name, const Teuchos::RCP< Teuchos::ParameterList > ¶ms) |
update an already allocated image class with new intensity field and gradients | |
void | post_allocation_tasks (const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null) |
post allocation tasks | |
virtual | ~Image () |
virtual destructor | |
void | write (const std::string &file_name) |
void | write_overlap_image (const std::string &file_name, Teuchos::RCP< Image > top_img) |
void | write_grad_x (const std::string &file_name) |
void | write_grad_y (const std::string &file_name) |
int_t | width () const |
returns the width of the image | |
int_t | height () const |
return the height of the image | |
int_t | num_pixels () const |
returns the number of pixels in the image | |
int_t | offset_x () const |
returns the offset x coordinate | |
int_t | offset_y () const |
returns the offset y coordinate | |
scalar_t | mean () const |
returns the mean value of the image | |
const intensity_t & | operator() (const int_t x, const int_t y) const |
const intensity_t & | operator() (const int_t i) const |
Teuchos::ArrayRCP< intensity_t > | intensities () const |
returns a copy of the intenisity values as an array | |
Teuchos::ArrayRCP< scalar_t > | grad_x_array () const |
returns a copy of the grad_x values as an array | |
Teuchos::ArrayRCP< scalar_t > | grad_y_array () const |
returns a copy of the grad_y values as an array | |
void | replace_intensities (Teuchos::ArrayRCP< intensity_t > intensities) |
void | interpolate_keys_fourth_all (intensity_t &intensity_val, scalar_t &grad_x_val, scalar_t &grad_y_val, const bool compute_gradient, const scalar_t &local_x, const scalar_t &local_y) |
interpolate intensity and gradients | |
intensity_t | interpolate_keys_fourth_global (const scalar_t &global_x, const scalar_t &global_y) |
intensity_t | interpolate_keys_fourth (const scalar_t &local_x, const scalar_t &local_y) |
scalar_t | interpolate_grad_x_keys_fourth (const scalar_t &local_x, const scalar_t &local_y) |
scalar_t | interpolate_grad_y_keys_fourth (const scalar_t &local_x, const scalar_t &local_y) |
intensity_t | interpolate_bilinear_global (const scalar_t &global_x, const scalar_t &global_y) |
void | interpolate_bilinear_all (intensity_t &intensity_val, scalar_t &grad_x_val, scalar_t &grad_y_val, const bool compute_gradient, const scalar_t &local_x, const scalar_t &local_y) |
interpolate intensity and gradients | |
intensity_t | interpolate_bilinear (const scalar_t &local_x, const scalar_t &local_y) |
scalar_t | interpolate_grad_x_bilinear (const scalar_t &local_x, const scalar_t &local_y) |
scalar_t | interpolate_grad_y_bilinear (const scalar_t &local_x, const scalar_t &local_y) |
intensity_t | interpolate_bicubic_global (const scalar_t &global_x, const scalar_t &global_y) |
void | interpolate_bicubic_all (intensity_t &intensity_val, scalar_t &grad_x_val, scalar_t &grad_y_val, const bool compute_gradient, const scalar_t &local_x, const scalar_t &local_y) |
interpolate intensity and gradients | |
intensity_t | interpolate_bicubic (const scalar_t &local_x, const scalar_t &local_y) |
scalar_t | interpolate_grad_x_bicubic (const scalar_t &local_x, const scalar_t &local_y) |
scalar_t | interpolate_grad_y_bicubic (const scalar_t &local_x, const scalar_t &local_y) |
const scalar_t & | grad_x (const int_t x, const int_t y) const |
const scalar_t & | grad_y (const int_t x, const int_t y) const |
const scalar_t & | laplacian (const int_t x, const int_t y) const |
const scalar_t & | mask (const int_t x, const int_t y) const |
void | create_mask (const Conformal_Area_Def &area_def, const bool smooth_edges=true) |
void | apply_mask (const Conformal_Area_Def &area_def, const bool smooth_edges=true) |
void | apply_mask (const bool smooth_edges) |
Teuchos::RCP< Image > | apply_transformation (Teuchos::RCP< Local_Shape_Function > shape_function, const int_t cx, const int_t cy, const bool apply_in_place=false) |
Teuchos::RCP< Image > | normalize (const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null) |
Teuchos::RCP< Image > | apply_rotation (const Rotation_Value rotation, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null) |
void | compute_gradients (const bool use_hierarchical_parallelism=false, const int_t team_size=256) |
compute the image gradients | |
void | smooth_gradients_convolution_5_point () |
compute the image gradients | |
void | compute_gradients_finite_difference () |
compute the image gradients | |
bool | has_gradients () const |
returns true if the gradients have been computed | |
bool | is_video_frame () const |
returns true if the image is a frame from a video sequence cine or netcdf file | |
bool | has_file_name () const |
returns true if the image was created from a file not array | |
bool | has_gauss_filter () const |
returns true if the image has been gauss filtered | |
void | gauss_filter (const int_t mask_size=-1, const bool use_hierarchical_parallelism=false, const int_t team_size=256) |
filter the image using a 7 point gauss filter | |
void | set_file_name (const std::string &file_name) |
sets the file name of the image | |
std::string | file_name () const |
returns the name of the file if available | |
void | set_file_name (std::string &file_name) |
scalar_t | diff (Teuchos::RCP< Image > rhs) const |
returns the difference of two images: | |
int_t | gauss_filter_mask_size () const |
returns the size of the gauss filter mask | |
Private Attributes | |
int_t | width_ |
pixel container width_ | |
int_t | height_ |
pixel container height_ | |
int_t | offset_x_ |
int_t | offset_y_ |
Teuchos::ArrayRCP< intensity_t > | intensity_rcp_ |
rcp to the intensity array (used to ensure it doesn't get deallocated) | |
Teuchos::ArrayRCP< intensity_t > | intensities_ |
pixel container | |
Teuchos::ArrayRCP< intensity_t > | intensities_temp_ |
device intensity work array | |
Teuchos::ArrayRCP< scalar_t > | mask_ |
mask coefficients | |
Teuchos::ArrayRCP< scalar_t > | grad_x_ |
image gradient x container | |
Teuchos::ArrayRCP< scalar_t > | grad_y_ |
image gradient y container | |
Teuchos::ArrayRCP< scalar_t > | laplacian_ |
image gradient y container | |
bool | has_gradients_ |
flag that the gradients have been computed | |
bool | has_gauss_filter_ |
flag that the image has been filtered | |
scalar_t | grad_c1_ |
coeff used in computing gradients | |
scalar_t | grad_c2_ |
coeff used in computing gradients | |
scalar_t | gauss_filter_coeffs_ [13][13] |
Gauss filter coefficients. | |
int_t | gauss_filter_mask_size_ |
Gauss filter mask size. | |
int_t | gauss_filter_half_mask_ |
half the gauss filter mask size | |
std::string | file_name_ |
name of the file that was the source of this image | |
bool | has_file_name_ |
true if the image was read from a file not created from an array | |
Gradient_Method | gradient_method_ |
gradient method | |
A container class to hold the pixel intensity information and provide some basic methods Note: the coordinates are from the top left corner (positive right for x and positive down for y) intensity access is always in local coordinates, for example if only a portion of an image is read into the intensity values, accessing the first value in the array is via the indicies (0,0) even if the first pixel is not in the upper left corner of the global image from which the poriton was taken
DICe::Image::Image | ( | const char * | file_name, |
const Teuchos::RCP< Teuchos::ParameterList > & | params = Teuchos::null |
||
) |
constructor that reads in a whole tiff file
file_name | the name of the tiff file |
params | image parameters |
DICe::Image::Image | ( | const char * | file_name, |
const int_t | offset_x, | ||
const int_t | offset_y, | ||
const int_t | width, | ||
const int_t | height, | ||
const Teuchos::RCP< Teuchos::ParameterList > & | params = Teuchos::null |
||
) |
constructor that stores only a portion of a tiff file given by the offset and dims
file_name | the name of the tiff file |
offset_x | upper left corner x-coordinate |
offset_y | upper left corner y-coorindate |
width | x-dim of the image (offset_x + width must be < the global image width) |
height | y-dim of the image (offset_y + height must be < the global image height) |
params | image parameters |
DICe::Image::Image | ( | intensity_t * | intensities, |
const int_t | width, | ||
const int_t | height, | ||
const Teuchos::RCP< Teuchos::ParameterList > & | params = Teuchos::null |
||
) |
constrtuctor that takes an array as input note: assumes the input array is always stored LayoutRight or "row major"
intensities | pre-allocated array of intensity values |
width | the width of the image |
height | the height of the image |
params | image parameters |
DICe::Image::Image | ( | const int_t | width, |
const int_t | height, | ||
Teuchos::ArrayRCP< intensity_t > | intensities, | ||
const Teuchos::RCP< Teuchos::ParameterList > & | params = Teuchos::null , |
||
const int_t | offset_x = 0 , |
||
const int_t | offset_y = 0 |
||
) |
constructor that takes a Teuchos::ArrayRCP as input note: assumes the input array is always stored LayoutRight or "row major"
width | image width |
height | image height |
intensities | image intensity values |
params | optional image parameters |
offset_x | the x offset for a sub image |
offset_y | the y offset for a sub image |
DICe::Image::Image | ( | const int_t | width, |
const int_t | height, | ||
const intensity_t | intensity = 0.0 , |
||
const int_t | offset_x = 0 , |
||
const int_t | offset_y = 0 |
||
) |
constructor that creates a zero image
width | the width of the image |
height | the height of the image |
intensity | value to fill the array with |
offset_x | offset to upper left corner x coord if this is a subregion of a larger image |
offset_y | offset to upper left corner y coord if this is a subregion of a larger image no params allowed since the intensity values are all zeros so gradients or filters would not make sense |
DICe::Image::Image | ( | Teuchos::RCP< Image > | img, |
const int_t | offset_x = 0 , |
||
const int_t | offset_y = 0 , |
||
const int_t | width = -1 , |
||
const int_t | height = -1 , |
||
const Teuchos::RCP< Teuchos::ParameterList > & | params = Teuchos::null |
||
) |
constructor that takes another image and dims of a sub portion note: no params arg because the parent image's are copied
img | the image to copy |
offset_x | the upper left corner x-coord in image coordinates |
offset_y | the upper left corner y-coord in image coordinates |
width | the width of the sub image |
height | the height of the sub image |
params | image parameters (for example compute_gradients, etc.) |
void DICe::Image::apply_mask | ( | const bool | smooth_edges | ) |
apply the mask field to the image and sync up the arrays between device and host assumes that the mask field is already populated
smooth_edges | use Gaussian smoothing along the edges |
void DICe::Image::apply_mask | ( | const Conformal_Area_Def & | area_def, |
const bool | smooth_edges = true |
||
) |
creates the image mask and then applies it to the intensity values For the area_def, the boundary defines the outer edge of the region for which the mask will be set to 1.0. For the excluded region within the boundary, the mask will be set to 0.0 mask values will be 1.0 for excluded regions. note: mask coordinates are always global, if the image is a portion of a larger image, the offsets will be applied to the coordinates to align the mask
area_def | defines the shape of the mask and what is included/excluded |
smooth_edges | smooths the edges of the mask to avoid high freq. content |
Teuchos::RCP<Image> DICe::Image::apply_rotation | ( | const Rotation_Value | rotation, |
const Teuchos::RCP< Teuchos::ParameterList > & | params = Teuchos::null |
||
) |
apply a rotation to this image to create another image in this case, there are only three options 90, 180, and 270 degree rotations
rotation | enum that defines the rotation |
params | parameters to apply to the new image |
Teuchos::RCP<Image> DICe::Image::apply_transformation | ( | Teuchos::RCP< Local_Shape_Function > | shape_function, |
const int_t | cx, | ||
const int_t | cy, | ||
const bool | apply_in_place = false |
||
) |
apply a transformation to this image to create another image
shape_function | the deformation mapping parameters u,v,theta,... (in this case return is null pointer) |
cx | centroid of mapping in the current image (used when applying rotation) |
cy | centroid of mapping in the current image (used when applying rotation) |
apply_in_place | true if the mapped intensity values should replace the existing values in the image |
void DICe::Image::create_mask | ( | const Conformal_Area_Def & | area_def, |
const bool | smooth_edges = true |
||
) |
create the image mask field, but don't apply it to the image For the area_def, the boundary defines the outer edge of the region for which the mask will be set to 1.0. For the excluded region within the boundary, the mask will be set to 0.0 mask values will be 1.0 for excluded regions. note: mask coordinates are always global, if the image is a portion of a larger image, the offsets will be applied to the coordinates to align the mask
area_def | defines the shape of the mask and what is included/excluded |
smooth_edges | smooths the edges of the mask to avoid high freq. content |
gradient accessors: note the internal arrays are stored as (row,column) so the indices have to be switched from coordinates x,y to y,x y is row, x is column
x | image coordinate x |
y | image coordinate y |
gradient accessor for y
x | image coordinate x |
y | image coordinate y |
void DICe::Image::initialize_array_image | ( | intensity_t * | intensities | ) |
perform initialization of an image from an array
intensities | the array of intensity values |
intensity_t DICe::Image::interpolate_bicubic | ( | const scalar_t & | local_x, |
const scalar_t & | local_y | ||
) |
interpolant
local_x | local image coordinate x |
local_y | local image coordinate y |
|
inline |
interpolant
global_x | global image coordinate x |
global_y | global image coordinate y |
intensity_t DICe::Image::interpolate_bilinear | ( | const scalar_t & | local_x, |
const scalar_t & | local_y | ||
) |
interpolant
local_x | local image coordinate x |
local_y | local image coordinate y |
|
inline |
interpolant
global_x | global image coordinate x |
global_y | global image coordinate y |
scalar_t DICe::Image::interpolate_grad_x_bicubic | ( | const scalar_t & | local_x, |
const scalar_t & | local_y | ||
) |
interpolant
local_x | local image coordinate x |
local_y | local image coordinate y |
scalar_t DICe::Image::interpolate_grad_x_bilinear | ( | const scalar_t & | local_x, |
const scalar_t & | local_y | ||
) |
interpolant
local_x | local image coordinate x |
local_y | local image coordinate y |
scalar_t DICe::Image::interpolate_grad_x_keys_fourth | ( | const scalar_t & | local_x, |
const scalar_t & | local_y | ||
) |
interpolant
local_x | local image coordinate x |
local_y | local image coordinate y |
scalar_t DICe::Image::interpolate_grad_y_bicubic | ( | const scalar_t & | local_x, |
const scalar_t & | local_y | ||
) |
interpolant
local_x | local image coordinate x |
local_y | local image coordinate y |
scalar_t DICe::Image::interpolate_grad_y_bilinear | ( | const scalar_t & | local_x, |
const scalar_t & | local_y | ||
) |
interpolant
local_x | local image coordinate x |
local_y | local image coordinate y |
scalar_t DICe::Image::interpolate_grad_y_keys_fourth | ( | const scalar_t & | local_x, |
const scalar_t & | local_y | ||
) |
interpolant
local_x | local image coordinate x |
local_y | local image coordinate y |
intensity_t DICe::Image::interpolate_keys_fourth | ( | const scalar_t & | local_x, |
const scalar_t & | local_y | ||
) |
interpolant
local_x | local image coordinate x |
local_y | local image coordinate y |
|
inline |
interpolant
global_x | global image coordinate x |
global_y | global image coordinate y |
laplacian accessor: note the internal arrays are stored as (row,column) so the indices have to be switched from coordinates x,y to y,x y is row, x is column
x | image coordinate x |
y | image coordinate y |
mask value accessor
x | image coordinate x |
y | image coordinate y |
Teuchos::RCP<Image> DICe::Image::normalize | ( | const Teuchos::RCP< Teuchos::ParameterList > & | params = Teuchos::null | ) |
normalize the image intensity values
params | the image parameters to use |
const intensity_t& DICe::Image::operator() | ( | const int_t | i | ) | const |
intensity accessors: note the internal arrays are stored as (row,column) so the indices have to be switched from coordinates x,y to y,x y is row, x is column
i | pixel index |
const intensity_t& DICe::Image::operator() | ( | const int_t | x, |
const int_t | y | ||
) | const |
intensity accessors: note the internal arrays are stored as (row,column) so the indices have to be switched from coordinates x,y to y,x y is row, x is column
x | image coordinate x |
y | image coordinate y |
void DICe::Image::replace_intensities | ( | Teuchos::ArrayRCP< intensity_t > | intensities | ) |
replaces the intensity values of the image
intensities | the new intensity value array |
|
inline |
set the filename for the image
file_name | the string name to use |
void DICe::Image::write | ( | const std::string & | file_name | ) |
write the image to a file (tiff, jpeg, or png, depending on which file extension is used in the name) Tiff, jpeg, and png will truncate the intensity values to an 8-bit integer value and scale the image so that the histogram is spread over the entire 0-255 range. The rawi format saves the full intesity_t precision value to file
file_name | the name of the file to write to |
void DICe::Image::write_grad_x | ( | const std::string & | file_name | ) |
write the image x gradients to a file (tiff, jpeg, or png, depending on which file extension is used in the name) Tiff, jpeg, and png will truncate the intensity values to an 8-bit integer value and scale the image so that the histogram is spread over the entire 0-255 range. The rawi format saves the full intesity_t precision value to file
file_name | the name of the file to write to |
void DICe::Image::write_grad_y | ( | const std::string & | file_name | ) |
write the image y gradients to a file (tiff, jpeg, or png, depending on which file extension is used in the name) Tiff, jpeg, and png will truncate the intensity values to an 8-bit integer value and scale the image so that the histogram is spread over the entire 0-255 range. The rawi format saves the full intesity_t precision value to file
file_name | the name of the file to write to |
void DICe::Image::write_overlap_image | ( | const std::string & | file_name, |
Teuchos::RCP< Image > | top_img | ||
) |
write an image to file that combines this image and another of the same size with both overlayed using transparency
file_name | the name of the file to output |
top_img | pointer to the image to be overlayed on top of this one |
|
private |
offsets are used to convert to global image coordinates (the pixel container may be a subset of a larger image)
|
private |
offsets are used to convert to global image coordinates (the pixel container may be a subset of a larger image)