2

here is my function

int* Utilities::MatlabImresize(int* channel,int width, int height, double scale)
{
    cv::Mat src(width, height, CV_32F);
    for (int i = 0; i < width * height; ++i)
    {
        src.at<float>(i) = channel[i];      
    }
    cv::Mat dst;
    cv::resize(src, dst, cv::Size(), 0.5, 0.5,cv::INTER_CUBIC);
    ofstream myfile;
    myfile.open("C:\\Users\\gdarmon\\Desktop\\OpenCV_CR.txt");
    myfile << dst;
    myfile.close();

    return NULL;
}

As discussed in my previous question imresize - trying to understand the bicubic interpolation I have recompiled openCV with -0.5f instead of -0.75f

however I still get different results although the input is the same, I guess i'm using resize() function wrong... can you please help?

the matlab code is just

Gr = imresize(Gr, 0,5);
Community
  • 1
  • 1
Gilad
  • 6,437
  • 14
  • 61
  • 119

1 Answers1

2

That change to OpenCV only makes the interpolation kernels' formulas match. It does not enable anti-aliasing. The result here will match with

imresize(A,scale,'bicubic','AntiAliasing',false)

To match the default, you'd need to further modify the kernel, making it broader.

chappjc
  • 30,359
  • 6
  • 75
  • 132
  • I remember a very nice discussion between you and Amro about this. +1 – rayryeng Jan 09 '15 at 05:03
  • @chappjc ohh I thought the whole point was to match the default..., anyway thank you i will try to work with this. – Gilad Jan 09 '15 at 18:12
  • @Gilad No, the point was to make anything match. Without fixing the coefficients, that couldn't happen. – chappjc Jan 09 '15 at 19:03