Skip to content

Different results in DICe interface compared to custom application (Due to version of OpenCV used) #239

@Stone-stone1

Description

@Stone-stone1

Hello DICe developers,

Thank you for your software, I find it very useful !

I was trying to write a custom application based on the custom_app example provided in the tests/examples folder, and to compare the results I was getting to the ones coming from DICe software (Digital Image Correlation Engine), in order to see if my implementation was good.

I managed to load an input parameter file and a correlation parameter file into my application, and I managed to extract some results from my correlation.
I also launched a 2d analysis on DICe software with the same parameters.

My issue is that the results I get from my application are slightly different than the results coming from DICe software, and I can't figure out why.
First I thought that maybe some parameters DICe software used were hidden to the user, so I tried to modify some parameters in my application, but I can't get the same results as DICe software...
Maybe you would have an idea on what I did wrong here ?

Here is my code :

using namespace DICe::field_enums;

int main(int argc, char* argv[]) {

	std::cout << "Begin custom_app example\n";
	DICe::initialize(argc, argv);

	int NB_POINTS = 25;

	DICe::Schema schema("input.xml", "params.xml");

	schema.set_ref_image("images//aaa_b2_00.tif");

	for (auto indexImage = 1; indexImage <= 2; ++indexImage)
	{
		schema.set_def_image("images//aaa_b2_0" + std::to_string(indexImage) + ".tif");

		schema.execute_correlation();
		schema.execute_post_processors();

		// compute displacement and score of each points in the current frame
		auto const results = schema.mesh();
		Teuchos::RCP<DICe::MultiField> subsetDisplacementsX = results->get_field(SUBSET_DISPLACEMENT_X_FS);
		Teuchos::RCP<DICe::MultiField> subsetDisplacementsY = results->get_field(SUBSET_DISPLACEMENT_Y_FS);
		Teuchos::RCP<DICe::MultiField> subsetsScores = results->get_field(GAMMA_FS);

		std::cout << "[IMAGE " << indexImage << "]" << std::endl;
		for (auto indexPoint = 0; indexPoint < NB_POINTS; ++indexPoint)
		{
			cv::Point2d const displacement(subsetDisplacementsX->local_value(indexPoint), subsetDisplacementsY->local_value(indexPoint));
			auto const score = schema.local_field_value(indexPoint, GAMMA_FS);
			std::cout << "[" << indexPoint << "] =  " << displacement << "  " << score << std::endl;
		}
		std::cout << std::endl;

	}
	DICe::finalize();
	std::cout << "End custom_app example\n";

	return 0;
}

Here is my input.xml file :

<ParameterList>
  <Parameter name="output_folder" type="string" value="E:\WS\Test\Test\results\" /> 
  <Parameter name="correlation_parameters_file" type="string" value="E:\WS\Test\Test\params.xml" />
  <Parameter name="subset_file" type="string" value="./subsets.txt" />
  <Parameter name="subset_size" type="int" value="25" />
  <Parameter name="step_size" type="int" value="100" />
  <Parameter name="separate_output_file_for_each_subset" type="bool" value="false" />
  <Parameter name="create_separate_run_info_file" type="bool" value="true" />
  <Parameter name="image_folder" type="string" value="E:\WS\Test\Test\images\" />
  <Parameter name="reference_image_index" type="int" value="0" />
  <Parameter name="start_image_index" type="int" value="0" />
  <Parameter name="end_image_index" type="int" value="2" />
  <Parameter name="skip_image_index" type="int" value="1" />
  <Parameter name="num_file_suffix_digits" type="int" value="2" />
  <Parameter name="image_file_extension" type="string" value=".tif" />
  <Parameter name="image_file_prefix" type="string" value="aaa_b2_" />
</ParameterList>

Here is the subsets.txt showing the location of the subsets :

BEGIN SUBSET_COORDINATES
24 24
24 124
24 224
24 324
24 424
124 424
124 324
124 224
124 124
124 24
224 24
224 124
224 224
224 324
224 424
324 424
324 324
324 224
324 124
324 24
424 24
424 124
424 224
424 324
424 424
END SUBSET_COORDINATES

And here is the params.xml file :

<ParameterList>
  <Parameter name="interpolation_method" type="string" value="KEYS_FOURTH" />
  <Parameter name="sssig_threshold" type="double" value="148" />
  <Parameter name="optimization_method" type="string" value="GRADIENT_BASED" />
  <Parameter name="initialization_method" type="string" value="USE_FEATURE_MATCHING" />
  <Parameter name="enable_translation" type="bool" value="true" />
  <Parameter name="enable_rotation" type="bool" value="false" />
  <Parameter name="enable_normal_strain" type="bool" value="false" />
  <Parameter name="enable_shear_strain" type="bool" value="false" />
  <Parameter name="output_delimiter" type="string" value="," />
  <ParameterList name="output_spec"> 
    <Parameter name="COORDINATE_X" type="bool" value="true" />
    <Parameter name="COORDINATE_Y" type="bool" value="true" />
    <Parameter name="DISPLACEMENT_X" type="bool" value="true" />
    <Parameter name="DISPLACEMENT_Y" type="bool" value="true" />
    <Parameter name="SIGMA" type="bool" value="true" />
    <Parameter name="GAMMA" type="bool" value="true" />
  </ParameterList>
</ParameterList>

Here is a screenshot of DICe software showing the parameters I entered :
Parameters DICe software

The images I used are the 3 first images of Sample 10 from 2D DIC challenge (named aaa_b2_00.tif, aaa_b2_01.tif and aaa_b2_02.tif). I can upload them if they are not accessible to you.

Here is a screenshot of the results I got from DICe software :
Results DICe software

And there is a screenshot of the results I got from my implementation :
Results implementation

As you can see, the DISPLACEMENT_X for subset #1 is slighly different, even though the DISPLACEMENT_Y and GAMMA values are not different.
But some points like #8 or #11 for example are not good in my implementation while they are in DICe software results.

I can not figure out why, so if you had any idea on what went wrong I would really appreciate it.

Sorry for the long message.
Thank you in advance for your help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions