Comparison of OpenCV Image Size with Matlab

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 bicubic interpolation I recompiled openCV with -0.5f instead of -0.75f

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

matlab code is just

 Gr = imresize(Gr, 0,5); 
+2
source share
1 answer

This change for OpenCV only makes the interpolation kernel formulas match. It does not include anti-aliasing. The result here will match

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

To comply with the standard, you need to further modify the kernel, making it wider.

+2
source

Source: https://habr.com/ru/post/1206531/


All Articles