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
|
Subsets are used to store temporary collections of pixels for comparison between the reference and deformed images. The data that is stored by a subset is a list of x and y corrdinates of each pixel (this allows for arbitrary shape) and containers for pixel intensity values. More...
#include <DICe_Subset.h>
Public Member Functions | |
Subset (int_t cx, int_t cy, Teuchos::ArrayRCP< int_t > x, Teuchos::ArrayRCP< int_t > y) | |
Subset (const int_t cx, const int_t cy, const int_t width, const int_t height) | |
Subset (const int_t cx, const int_t cy, const Conformal_Area_Def &subset_def) | |
virtual | ~Subset () |
virtual destructor | |
int_t | num_pixels () const |
returns the number of pixels in the subset | |
int_t | centroid_x () const |
returns the centroid x pixel location | |
int_t | centroid_y () const |
returns the centroid y pixel location | |
void | update_centroid (const int_t cx, const int_t cy) |
update the centroid of a subset | |
const int_t & | x (const int_t pixel_index) const |
const int_t & | y (const int_t pixel_index) const |
const scalar_t & | grad_x (const int_t pixel_index) const |
const scalar_t & | grad_y (const int_t pixel_index) const |
bool | has_gradients () const |
returns true if the gradients have been computed | |
Teuchos::ArrayRCP< scalar_t > | grad_x_array () const |
returns a copy of the gradient x values as an array | |
Teuchos::ArrayRCP< scalar_t > | grad_y_array () const |
returns a copy of the gradient x values as an array | |
intensity_t & | ref_intensities (const int_t pixel_index) |
intensity_t & | def_intensities (const int_t pixel_index) |
void | initialize (Teuchos::RCP< Image > image, const Subset_View_Target target=REF_INTENSITIES, Teuchos::RCP< Local_Shape_Function > shape_function=Teuchos::null, const Interpolation_Method interp=KEYS_FOURTH) |
void | write_tiff (const std::string &file_name, const bool use_def_intensities=false) |
void | write_subset_on_image (const std::string &file_name, Teuchos::RCP< Image > image, Teuchos::RCP< Local_Shape_Function > shape_function=Teuchos::null) |
intensity_t | max (const Subset_View_Target target=REF_INTENSITIES) |
intensity_t | min (const Subset_View_Target target=REF_INTENSITIES) |
scalar_t | mean (const Subset_View_Target target) |
scalar_t | mean (const Subset_View_Target target, scalar_t &sum) |
void | round (const Subset_View_Target target) |
round the values in the subset to the nearest integer number | |
scalar_t | gamma () |
returns the ZNSSD gamma correlation value between the reference and deformed subsets | |
scalar_t | diff_ref_def () const |
returns the un-normalized difference between the the reference and deformed intensity values | |
scalar_t | sssig () |
returns the SSSIG value for the reference intensities | |
void | reset_is_active () |
reset the is_active bool for each pixel to true; | |
bool & | is_active (const int_t pixel_index) |
returns true if this pixel is active | |
int_t | num_active_pixels () |
returns the number of active pixels in the subset | |
bool & | is_deactivated_this_step (const int_t pixel_index) |
returns true if this pixel is deactivated for this particular frame | |
void | reset_is_deactivated_this_step () |
reset the is_deactivated_this_step bool for each pixel to false | |
bool | is_conformal () const |
True if the subset is not square and has geometry information in a Conformal_Area_Def. | |
const Conformal_Area_Def * | conformal_subset_def () const |
Returns a pointer to the subset's Conformal_Area_Def. | |
int_t | sub_image_id () const |
Return the id of the sub-region of a global image to use. | |
void | set_sub_image_id (const int_t id) |
set the sub_image_id | |
scalar_t | noise_std_dev (Teuchos::RCP< Image > image, Teuchos::RCP< Local_Shape_Function > shape_function) |
Returns an estimate of the noise standard deviation for this subset based on the method of J. Immerkaer, Fast Noise Variance Estimation, Computer Vision and Image Understanding, Vol. 64, No. 2, pp. 300-302, Sep. 1996 The estimate is computed for a rectangular window that encompases the entire subset if the subset is conformal. More... | |
scalar_t | contrast_std_dev () |
Returns the std deviation of the image intensity values. | |
void | turn_off_obstructed_pixels (Teuchos::RCP< Local_Shape_Function > shape_function) |
EXPERIMENTAL Check the deformed position of the pixel to see if it falls inside an obstruction, if so, turn it off. More... | |
void | turn_on_previously_obstructed_pixels () |
EXPERIMENTAL See if any pixels that were obstructed to begin with are now in view, if so use the newly visible intensity values to reconstruct the subset. More... | |
bool | is_obstructed_pixel (const scalar_t &coord_x, const scalar_t &coord_y) const |
EXPERIMENTAL Returns true if the given coordinates fall within an obstructed region for this subset. More... | |
std::set< std::pair< int_t, int_t > > * | pixels_blocked_by_other_subsets () |
EXPERIMENTAL Returns a pointer to the set of pixels currently obstructed by another subset. | |
std::set< std::pair< int_t, int_t > > | deformed_shapes (Teuchos::RCP< Local_Shape_Function > shape_function=Teuchos::null, const int_t cx=0, const int_t cy=0, const scalar_t &skin_factor=1.0) |
EXPERIMENTAL Return the deformed geometry information for the subset boundary. | |
Private Attributes | |
int_t | num_pixels_ |
number of pixels in the subset | |
Teuchos::ArrayRCP< intensity_t > | ref_intensities_ |
pixel container | |
Teuchos::ArrayRCP< intensity_t > | def_intensities_ |
pixel container | |
Teuchos::ArrayRCP< scalar_t > | grad_x_ |
container for grad_x | |
Teuchos::ArrayRCP< scalar_t > | grad_y_ |
container for grad_y | |
Teuchos::ArrayRCP< bool > | is_active_ |
pixels can be deactivated by obstructions (persistent) | |
Teuchos::ArrayRCP< bool > | is_deactivated_this_step_ |
pixels can be deactivated for this frame only | |
Teuchos::ArrayRCP< int_t > | x_ |
initial x position of the pixels in the reference image | |
Teuchos::ArrayRCP< int_t > | y_ |
initial x position of the pixels in the reference image | |
std::set< std::pair< int_t, int_t > > | obstructed_coords_ |
EXPERIMENTAL Holds the obstruction coordinates if they exist. NOTE: The coordinates are switched for this (i.e. (Y,X)) so that the loops over y then x will be more efficient. | |
std::set< std::pair< int_t, int_t > > | pixels_blocked_by_other_subsets_ |
EXPERIMENTAL Holds the pixels blocked by other subsets if they exist. NOTE: The coordinates are switched for this (i.e. (Y,X)) so that the loops over y then x will be more efficient. | |
int_t | cx_ |
centroid location x | |
int_t | cy_ |
centroid location y | |
bool | has_gradients_ |
true if the gradient values are populated | |
Conformal_Area_Def | conformal_subset_def_ |
Conformal_Area_Def that defines the subset geometry. | |
bool | is_conformal_ |
The subset is not square. | |
int_t | sub_image_id_ |
Subsets are used to store temporary collections of pixels for comparison between the reference and deformed images. The data that is stored by a subset is a list of x and y corrdinates of each pixel (this allows for arbitrary shape) and containers for pixel intensity values.
DICe::Subset::Subset | ( | int_t | cx, |
int_t | cy, | ||
Teuchos::ArrayRCP< int_t > | x, | ||
Teuchos::ArrayRCP< int_t > | y | ||
) |
constructor that takes arrays of the pixel locations as input (note this type of subset has not been enabled for obstruction detection, only conformal subsets with defined shapes have this enabled. See the constructor below with a subset_def argument)
cx | centroid x pixel location |
cy | centroid y pixel location |
x | array of x coordinates |
y | array of y coordinates |
constructor that takes a centroid and dims as arguments (note this type of subset has not been enabled for obstruction detection, only conformal subsets with defined shapes have this enabled. See the constructor below with a subset_def argument)
cx | centroid x pixel location |
cy | centroid y pixel location |
width | width of the centroid (should be an odd number, otherwise the next larger odd number is used) |
height | height of the centroid (should be an odd number, otherwise the next larger odd numer is used) |
DICe::Subset::Subset | ( | const int_t | cx, |
const int_t | cy, | ||
const Conformal_Area_Def & | subset_def | ||
) |
constructor that takes a conformal subset def as the input
cx | centroid x pixel location |
cy | centroid y pixel location |
subset_def | the definition of the subset areas |
intensity_t& DICe::Subset::def_intensities | ( | const int_t | pixel_index | ) |
ref intensities accessor
pixel_index | the pixel id |
gradient x accessor
pixel_index | the pixel id note there is no bounds checking |
gradient y accessor
pixel_index | the pixel id note there is no bounds checking |
void DICe::Subset::initialize | ( | Teuchos::RCP< Image > | image, |
const Subset_View_Target | target = REF_INTENSITIES , |
||
Teuchos::RCP< Local_Shape_Function > | shape_function = Teuchos::null , |
||
const Interpolation_Method | interp = KEYS_FOURTH |
||
) |
initialization method:
image | the image to get the intensity values from |
target | the initialization mode (put the values in the ref or def intensities) |
shape_function | contains the deformation map (optional) |
interp | interpolation method (optional) |
EXPERIMENTAL Returns true if the given coordinates fall within an obstructed region for this subset.
coord_x | global x-coordinate |
coord_y | global y-coordinate |
intensity_t DICe::Subset::max | ( | const Subset_View_Target | target = REF_INTENSITIES | ) |
returns the max intensity value
target | either the reference or deformed intensity values |
scalar_t DICe::Subset::mean | ( | const Subset_View_Target | target | ) |
returns the mean intensity value
target | either the reference or deformed intensity values |
scalar_t DICe::Subset::mean | ( | const Subset_View_Target | target, |
scalar_t & | sum | ||
) |
returns the mean intensity value
target | either the reference or deformed intensity values |
sum | [output] returns the reduction value of the intensities minus the mean |
intensity_t DICe::Subset::min | ( | const Subset_View_Target | target = REF_INTENSITIES | ) |
returns the min intensity value
target | either the reference or deformed intensity values |
scalar_t DICe::Subset::noise_std_dev | ( | Teuchos::RCP< Image > | image, |
Teuchos::RCP< Local_Shape_Function > | shape_function | ||
) |
Returns an estimate of the noise standard deviation for this subset based on the method of J. Immerkaer, Fast Noise Variance Estimation, Computer Vision and Image Understanding, Vol. 64, No. 2, pp. 300-302, Sep. 1996 The estimate is computed for a rectangular window that encompases the entire subset if the subset is conformal.
image | the image for which to estimate the noise for this subset |
shape_function | contains the deformation map (optional) |
intensity_t& DICe::Subset::ref_intensities | ( | const int_t | pixel_index | ) |
ref intensities accessor
pixel_index | the pixel id |
void DICe::Subset::turn_off_obstructed_pixels | ( | Teuchos::RCP< Local_Shape_Function > | shape_function | ) |
EXPERIMENTAL Check the deformed position of the pixel to see if it falls inside an obstruction, if so, turn it off.
shape_function | contains the deformation map (optional) |
This method uses the specified deformation map to deform the subset to the current position. It then checks to see if any of the deformed pixels fall behind an obstruction. These obstructed pixels are turned off by setting the is_deactivated_this_step_[i] flag to true. These flags are reset on every frame. When methods like gamma() are called on an objective, these pixels get skipped so they do not contribute to the correlation or the optimization routine.
void DICe::Subset::turn_on_previously_obstructed_pixels | ( | ) |
EXPERIMENTAL See if any pixels that were obstructed to begin with are now in view, if so use the newly visible intensity values to reconstruct the subset.
Some pixels in the subset may be hidden in the first frame by an obstruction (or another subset that sits on top of this one). As the frames progress, these pixels eventually become visible. This method can be used to evolve the reference subset intensities by taking the intensity value of the pixel when it becomes visible. The location of the pixel in the current frame is not needed because it is assumed that the reference and deformed subset intensity arrays are ordered the same. So all that needs to be checked is if it was deactivated at frame zero, and is now not deactivated this step, that particular pixel can be used.
void DICe::Subset::write_subset_on_image | ( | const std::string & | file_name, |
Teuchos::RCP< Image > | image, | ||
Teuchos::RCP< Local_Shape_Function > | shape_function = Teuchos::null |
||
) |
draw the subset over an image
file_name | the name of the tif file to write |
image | pointer to the image to use as the background |
shape_function | contains the deformation map (optional) |
void DICe::Subset::write_tiff | ( | const std::string & | file_name, |
const bool | use_def_intensities = false |
||
) |
write the subset intensity values to a tif file
file_name | the name of the tif file to write |
use_def_intensities | use the deformed intensities rather than the reference |
x coordinate accessor
pixel_index | the pixel id note there is no bounds checking on the index |
y coordinate accessor
pixel_index | the pixel id note there is no bounds checking on the index |
|
private |
if sub regions of the frame are used instead of reading in the whole sub image, this sub_image_id defines which region to draw the pixel information from