interpolation - Interpolating 1 dimensional array using OpenCV -
i define array of 2 values, , try use imgproc module's resize function resize 10 elements linear interpolation interpolation method. cv::mat input = cv::mat(1, 2, cv_32f); input.at<float>(0, 0) = 0.f; input.at<float>(0, 1) = 1.f; cv::mat output = cv::mat(1, 11, cv_32f); cv::resize(input, output, output.size(), 0, 0, cv::inter_linear); for(int i=0; i<11; ++i) { std::cout<< output.at<float>(0, i) << " "; } the output have expected is: 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 what is: 0 0 0 0.136364 0.318182 0.5 0.681818 0.863636 1 1 1 clearly, understanding of how resize works wrong @ fundamental level. can please tell me doing wrong? admittedly, opencv overkill such simple linear interpolation, please me wrong here. it's simple. opencv image processing library. should remember working on images. take @ output when have 8 pixels in destination image 0 0 0.125 0.375 0.625 0.875 1 1 if take @ image it&