Skip to content

Draft: TestImageDifference asymmetrical result issue

Issue encountered in vtkImageDifference. The class claims to be symmetrical to inputs A/B and B/A, but using test images I have encountered that the result in this case is asymmetrical.

Input images:

input1.png input1

input2.png input2

Setting

  vtkNew<vtkImageDifference> diff12;
  diff12->SetInputConnection(0, r1->GetOutputPort());
  diff12->SetInputConnection(1, r2->GetOutputPort());
  vtkNew<vtkPNGWriter> w12;
  w12->SetFileName("diff12.png");

results in image

diff12

while using

  vtkNew<vtkImageDifference> diff21;
  diff21->SetInputConnection(0, r2->GetOutputPort());
  diff21->SetInputConnection(1, r1->GetOutputPort());
  vtkNew<vtkPNGWriter> w21;
  w21->SetFileName("diff21.png");

results in image

diff21

The issue is quite important since vtkImageDifference is used in vtkTesting for image comparison between baseline images and new images created during tests. Merge request 9378 had tests passing with the above image despite the difference should resulted in a failed test.

Merge request reports

Loading