When using the UINT16 data type. What is difference resize between matlab and opencv?

427 views Asked by At

Looking at the above question, I found why resize results between opencv and matlab are different.

However, when the input data type is UINT16, the result is still different.

I want to know why this is happening.

  • Resize interpolation : bicubic(modified opencv factor : 0.75 -> 0.5).
  • Matlab Anti-Aliasing option false.

matlab(2016a) example

input = uint16(reshape(0:15,4,4).');
unit16_out = imresize(input, 0.5,'AntiAliasing', false);

[ 2, 5
  10, 13]

openCV(2.4.13.5) example

cv::Mat in_16(4, 4, CV_16UC1);
for (int i = 0; i < 16; ++i) {
    in_16.at<unsigned short>(i) = i;
}
cv::Mat out_16;
cv::resize(in_16, out_16, cv::Size(0, 0), 0.5, 0.5, CV_INTER_CUBIC);

[2, 4
11, 13]
0

There are 0 answers