Skip to content

cv::undistort behaviour changed in new SIMD implementation #15286

@dmgotsch

Description

@dmgotsch
System information
  • OpenCV => 4.1.1
  • Operating System / Platform => Ubuntu 18.04 64bit
  • Compiler => gcc 7.4.0
Detailed description

The SIMD_64F implementation of cv::undistort in undistort.simd.hpp' gives different results than the non-optimized version (and previous versions of OpenCV such as 4.1.0 and below)
For the example below the resulting image seems to be offset about half a pixel down and a smaller fraction of pixel left.

Steps to reproduce

Image source:
lena_512_24bpp

```.cpp
// C++ code example
double kmat_data[9] = {3217, 0, 1592, 0, 3217, 1201, 0, 0, 1};
cv::Mat kmat = cv::Mat(3, 3, CV_64F, kmat_data);
double dist_coeff_data[5] = { 0.04, -0.4, -0.01, 0.04, 0.7 };
cv::Mat dist_coeffs = cv::Mat(5, 1, CV_64F, dist_coeff_data);
cv::Mat img_undist, img = cv::read( "lena_512_24bpp.png" );

cv::undistort( img, img_undist, kmat, dist_coeffs );
```

Disabling the #CV_SIMD_64F flags in `moduels/calib3d/src/undistort.simd.hpp' and recompiling results in a different image (seems to be offset by a fraction of a pixel in both dimensions)

Output of above code

Output in OpenCV 3.4.6 (same system)
cv_test 3 4 6

Output in OpenCV 4.1.1
cv_test 4 1 1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions