From 8c394a4f2e02994f21c3cf88706ad62d65b53431 Mon Sep 17 00:00:00 2001 From: Vitaly Tuzov Date: Fri, 1 Dec 2017 13:10:59 +0300 Subject: [PATCH] Updated internal calls to linear resize to use bit-exact version --- modules/bgsegm/test/test_backgroundsubtractor_lsbp.cpp | 2 +- modules/ccalib/src/randpattern.cpp | 2 +- modules/dpm/src/dpm_feature.cpp | 4 ++-- modules/face/samples/facemark_lbf_fitting.cpp | 2 +- modules/face/samples/sampleDetectLandmarks.cpp | 2 +- modules/face/samples/sampleDetectLandmarksvideo.cpp | 2 +- modules/face/samples/sample_face_swapping.cpp | 4 ++-- modules/face/src/face_alignment.cpp | 2 +- modules/face/src/facemarkAAM.cpp | 2 +- .../face_landmark/face_landmark_detection.markdown | 2 +- .../tutorials/face_landmark/face_landmark_video.markdown | 2 +- .../tutorials/face_landmark/sample_face_swapping.markdown | 4 ++-- modules/img_hash/src/average_hash.cpp | 2 +- modules/img_hash/src/block_mean_hash.cpp | 2 +- modules/img_hash/src/phash.cpp | 2 +- modules/line_descriptor/samples/matching.cpp | 4 ++-- modules/line_descriptor/src/binary_descriptor.cpp | 2 +- modules/optflow/perf/opencl/perf_dis_optflow.cpp | 4 ++-- modules/optflow/perf/perf_disflow.cpp | 4 ++-- modules/saliency/src/BING/objectnessBING.cpp | 2 +- modules/saliency/src/motionSaliencyBinWangApr2014.cpp | 4 ++-- modules/saliency/src/staticSaliencySpectralResidual.cpp | 6 +++--- modules/structured_light/samples/cap_pattern.cpp | 4 ++-- modules/structured_light/samples/pointcloud.cpp | 4 ++-- modules/text/samples/end_to_end_recognition.cpp | 4 ++-- modules/text/samples/webcam_demo.cpp | 2 +- modules/text/src/ocr_beamsearch_decoder.cpp | 2 +- modules/text/src/ocr_hmm_decoder.cpp | 8 ++++---- modules/text/src/ocr_holistic.cpp | 2 +- modules/tracking/src/gtrTracker.cpp | 4 ++-- modules/tracking/src/tldDetector.hpp | 2 +- modules/tracking/src/tldModel.cpp | 2 +- modules/tracking/src/tldTracker.cpp | 2 +- modules/tracking/src/tldUtils.cpp | 2 +- modules/tracking/src/trackerKCF.cpp | 2 +- modules/xfeatures2d/src/sift.cpp | 7 ++++++- .../test/test_rotation_and_scale_invariance.cpp | 4 ++-- modules/ximgproc/perf/perf_disparity_wls_filter.cpp | 4 ++-- modules/ximgproc/samples/disparity_filtering.cpp | 6 +++--- modules/ximgproc/samples/fast_hough_transform.cpp | 2 +- modules/ximgproc/samples/filterdemo.cpp | 2 +- modules/ximgproc/samples/thinning.cpp | 2 +- modules/ximgproc/test/test_adaptive_manifold.cpp | 4 ++-- modules/ximgproc/test/test_adaptive_manifold_ref_impl.cpp | 2 +- modules/ximgproc/test/test_disparity_wls_filter.cpp | 4 ++-- modules/ximgproc/test/test_domain_transform.cpp | 2 +- modules/ximgproc/test/test_guided_filter.cpp | 2 +- modules/ximgproc/test/test_joint_bilateral_filter.cpp | 2 +- modules/ximgproc/test/test_rolling_guidance_filter.cpp | 2 +- modules/xobjdetect/src/waldboost.cpp | 4 ++-- modules/xobjdetect/src/wbdetector.cpp | 2 +- modules/xphoto/perf/perf_learning_based_color_balance.cpp | 2 +- 52 files changed, 80 insertions(+), 75 deletions(-) diff --git a/modules/bgsegm/test/test_backgroundsubtractor_lsbp.cpp b/modules/bgsegm/test/test_backgroundsubtractor_lsbp.cpp index fa18291de..964cc5a50 100644 --- a/modules/bgsegm/test/test_backgroundsubtractor_lsbp.cpp +++ b/modules/bgsegm/test/test_backgroundsubtractor_lsbp.cpp @@ -91,7 +91,7 @@ template static double evaluateBGSAlgorithm(Ptr bgs) { Mat background = imread(getDataDir() + "shared/fruits.png"); Mat object = imread(getDataDir() + "shared/baboon.png"); - cv::resize(object, object, Size(100, 100)); + cv::resize(object, object, Size(100, 100), 0, 0, INTER_LINEAR_EXACT); Ptr generator = bgsegm::createSyntheticSequenceGenerator(background, object); double f1_mean = 0; diff --git a/modules/ccalib/src/randpattern.cpp b/modules/ccalib/src/randpattern.cpp index bde3978fb..0f9045f57 100644 --- a/modules/ccalib/src/randpattern.cpp +++ b/modules/ccalib/src/randpattern.cpp @@ -371,7 +371,7 @@ void RandomPatternGenerator::generatePattern() Mat r = Mat(n, m, CV_32F); cv::randn(r, Scalar::all(0), Scalar::all(1)); - cv::resize(r, r, Size(_imageWidth ,_imageHeight)); + cv::resize(r, r, Size(_imageWidth ,_imageHeight), 0, 0, INTER_LINEAR_EXACT); double min_r, max_r; minMaxLoc(r, &min_r, &max_r); diff --git a/modules/dpm/src/dpm_feature.cpp b/modules/dpm/src/dpm_feature.cpp index 47224935f..869d4f8ac 100644 --- a/modules/dpm/src/dpm_feature.cpp +++ b/modules/dpm/src/dpm_feature.cpp @@ -87,7 +87,7 @@ void Feature::computeFeaturePyramid(const Mat &imageM, vector< Mat > &pyramid) { const double scale = (double)(1.0f/pow(params.sfactor, i)); Mat imScaled; - resize(imageM, imScaled, imSize * scale); + resize(imageM, imScaled, imSize * scale, 0, 0, INTER_LINEAR_EXACT); // First octave at twice the image resolution computeHOG32D(imScaled, pyramid[i], params.binSize/2, params.padx + 1, params.pady + 1); @@ -106,7 +106,7 @@ void Feature::computeFeaturePyramid(const Mat &imageM, vector< Mat > &pyramid) { Mat imScaled2; Size_ imScaledSize = imScaled.size(); - resize(imScaled, imScaled2, imScaledSize*0.5); + resize(imScaled, imScaled2, imScaledSize*0.5, 0, 0, INTER_LINEAR_EXACT); imScaled = imScaled2; computeHOG32D(imScaled2, pyramid[j+params.interval], params.binSize, params.padx + 1, params.pady + 1); diff --git a/modules/face/samples/facemark_lbf_fitting.cpp b/modules/face/samples/facemark_lbf_fitting.cpp index e1d2b0d46..961ed900d 100644 --- a/modules/face/samples/facemark_lbf_fitting.cpp +++ b/modules/face/samples/facemark_lbf_fitting.cpp @@ -104,7 +104,7 @@ int main(int argc, char** argv ){ double __time__ = (double)getTickCount(); float scale = (float)(400.0/frame.cols); - resize(frame, img, Size((int)(frame.cols*scale), (int)(frame.rows*scale))); + resize(frame, img, Size((int)(frame.cols*scale), (int)(frame.rows*scale)), 0, 0, INTER_LINEAR_EXACT); facemark->getFaces(img, rects); rects_scaled.clear(); diff --git a/modules/face/samples/sampleDetectLandmarks.cpp b/modules/face/samples/sampleDetectLandmarks.cpp index 8c3cdc13d..aa9962cfc 100644 --- a/modules/face/samples/sampleDetectLandmarks.cpp +++ b/modules/face/samples/sampleDetectLandmarks.cpp @@ -72,7 +72,7 @@ int main(int argc,char** argv){ facemark->loadModel(filename); cout<<"Loaded model"< faces; - resize(img,img,Size(460,460)); + resize(img,img,Size(460,460), 0, 0, INTER_LINEAR_EXACT); facemark->getFaces(img,faces); vector< vector > shapes; if(facemark->fit(img,faces,shapes)) diff --git a/modules/face/samples/sampleDetectLandmarksvideo.cpp b/modules/face/samples/sampleDetectLandmarksvideo.cpp index 15f78bd1f..c9d76a410 100644 --- a/modules/face/samples/sampleDetectLandmarksvideo.cpp +++ b/modules/face/samples/sampleDetectLandmarksvideo.cpp @@ -83,7 +83,7 @@ int main(int argc,char** argv){ shapes.clear(); cap>>img; //Detect faces in the current image - resize(img,img,Size(600,600)); + resize(img,img,Size(600,600), 0, 0, INTER_LINEAR_EXACT); facemark->getFaces(img,faces); if(faces.size()==0){ cout<<"No faces found in this frame"<getFaces(img1,faces1); facemark->getFaces(img2,faces2); diff --git a/modules/face/src/face_alignment.cpp b/modules/face/src/face_alignment.cpp index 481c272b3..e329a1060 100644 --- a/modules/face/src/face_alignment.cpp +++ b/modules/face/src/face_alignment.cpp @@ -173,7 +173,7 @@ bool FacemarkKazemiImpl::scaleData( vector< vector > & trainlandmarks, //calculating scale for x and y axis scalex=float(s.width)/float(trainimages[i].cols); scaley=float(s.height)/float(trainimages[i].rows); - resize(trainimages[i],trainimages[i],s); + resize(trainimages[i],trainimages[i],s,0,0,INTER_LINEAR_EXACT); for (vector::iterator it = trainlandmarks[i].begin(); it != trainlandmarks[i].end(); it++) { Point2f pt = (*it); pt.x = pt.x*scalex; diff --git a/modules/face/src/facemarkAAM.cpp b/modules/face/src/facemarkAAM.cpp index 352bde657..0b7bdc458 100644 --- a/modules/face/src/facemarkAAM.cpp +++ b/modules/face/src/facemarkAAM.cpp @@ -374,7 +374,7 @@ bool FacemarkAAMImpl::fitImpl( const Mat image, std::vector& landmarks, imgray = image; } - resize(imgray,img,Size(int(image.cols/scale),int(image.rows/scale)));// matlab use bicubic interpolation, the result is float numbers + resize(imgray,img,Size(int(image.cols/scale),int(image.rows/scale)), 0, 0, INTER_LINEAR_EXACT);// matlab use bicubic interpolation, the result is float numbers /*chop the textures model*/ int maxCol = param_m; diff --git a/modules/face/tutorials/face_landmark/face_landmark_detection.markdown b/modules/face/tutorials/face_landmark/face_landmark_detection.markdown index 14cc46774..b87d8569d 100644 --- a/modules/face/tutorials/face_landmark/face_landmark_detection.markdown +++ b/modules/face/tutorials/face_landmark/face_landmark_detection.markdown @@ -63,7 +63,7 @@ in which landmarks have to be detected. facemark->loadModel(filename); cout<<"Loaded model"< faces; -resize(img,img,Size(460,460)); +resize(img,img,Size(460,460),0,0,INTER_LINEAR_EXACT); facemark->getFaces(img,faces); vector< vector > shapes; diff --git a/modules/face/tutorials/face_landmark/face_landmark_video.markdown b/modules/face/tutorials/face_landmark/face_landmark_video.markdown index 6aa00abc8..4b1ed2a51 100644 --- a/modules/face/tutorials/face_landmark/face_landmark_video.markdown +++ b/modules/face/tutorials/face_landmark/face_landmark_video.markdown @@ -74,7 +74,7 @@ while(1){ faces.clear(); shapes.clear(); cap>>img; - resize(img,img,Size(600,600)); + resize(img,img,Size(600,600),0,0,INTER_LINEAR_EXACT); facemark->getFaces(img,faces); if(faces.size()==0){ cout<<"No faces found in this frame"< faces1,faces2; vector< vector > shape1,shape2; float ratio1 = (float)img1.cols/(float)img1.rows; float ratio2 = (float)img2.cols/(float)img2.rows; -resize(img1,img1,Size(640*ratio1,640*ratio1)); -resize(img2,img2,Size(640*ratio2,640*ratio2)); +resize(img1,img1,Size(640*ratio1,640*ratio1),0,0,INTER_LINEAR_EXACT); +resize(img2,img2,Size(640*ratio2,640*ratio2),0,0,INTER_LINEAR_EXACT); Mat img1Warped = img2.clone(); facemark->getFaces(img1,faces1); facemark->getFaces(img2,faces2); diff --git a/modules/img_hash/src/average_hash.cpp b/modules/img_hash/src/average_hash.cpp index 142b089bf..6690952cc 100644 --- a/modules/img_hash/src/average_hash.cpp +++ b/modules/img_hash/src/average_hash.cpp @@ -26,7 +26,7 @@ public: input.type() == CV_8UC3 || input.type() == CV_8U); - cv::resize(input, resizeImg, cv::Size(8,8)); + cv::resize(input, resizeImg, cv::Size(8,8), 0, 0, INTER_LINEAR_EXACT); if(input.type() == CV_8UC3) { cv::cvtColor(resizeImg, grayImg, CV_BGR2GRAY); diff --git a/modules/img_hash/src/block_mean_hash.cpp b/modules/img_hash/src/block_mean_hash.cpp index e60b1e625..768ae7382 100644 --- a/modules/img_hash/src/block_mean_hash.cpp +++ b/modules/img_hash/src/block_mean_hash.cpp @@ -39,7 +39,7 @@ public: input.type() == CV_8UC3 || input.type() == CV_8U); - cv::resize(input, resizeImg_, cv::Size(imgWidth,imgHeight)); + cv::resize(input, resizeImg_, cv::Size(imgWidth,imgHeight), 0, 0, INTER_LINEAR_EXACT); if(input.type() == CV_8UC3) { cv::cvtColor(resizeImg_, grayImg_, CV_BGR2GRAY); diff --git a/modules/img_hash/src/phash.cpp b/modules/img_hash/src/phash.cpp index 6ee866210..fd672d971 100644 --- a/modules/img_hash/src/phash.cpp +++ b/modules/img_hash/src/phash.cpp @@ -20,7 +20,7 @@ public: input.type() == CV_8UC3 || input.type() == CV_8U); - cv::resize(input, resizeImg, cv::Size(32,32)); + cv::resize(input, resizeImg, cv::Size(32,32), 0, 0, INTER_LINEAR_EXACT); if(input.type() == CV_8UC3) { cv::cvtColor(resizeImg, grayImg, CV_BGR2GRAY); diff --git a/modules/line_descriptor/samples/matching.cpp b/modules/line_descriptor/samples/matching.cpp index 27147064f..9353f85d2 100644 --- a/modules/line_descriptor/samples/matching.cpp +++ b/modules/line_descriptor/samples/matching.cpp @@ -197,8 +197,8 @@ int main( int argc, char** argv ) /* plot matches */ cv::Mat lsd_outImg; - resize( imageMat1, imageMat1, Size( imageMat1.cols / 2, imageMat1.rows / 2 ) ); - resize( imageMat2, imageMat2, Size( imageMat2.cols / 2, imageMat2.rows / 2 ) ); + resize( imageMat1, imageMat1, Size( imageMat1.cols / 2, imageMat1.rows / 2 ), 0, 0, INTER_LINEAR_EXACT ); + resize( imageMat2, imageMat2, Size( imageMat2.cols / 2, imageMat2.rows / 2 ), 0, 0, INTER_LINEAR_EXACT ); std::vector lsd_mask( matches.size(), 1 ); drawLineMatches( imageMat1, octave0_1, imageMat2, octave0_2, good_matches, lsd_outImg, Scalar::all( -1 ), Scalar::all( -1 ), lsd_mask, DrawLinesMatchesFlags::DEFAULT ); diff --git a/modules/line_descriptor/src/binary_descriptor.cpp b/modules/line_descriptor/src/binary_descriptor.cpp index a7364daba..a2c2e86a4 100644 --- a/modules/line_descriptor/src/binary_descriptor.cpp +++ b/modules/line_descriptor/src/binary_descriptor.cpp @@ -723,7 +723,7 @@ int BinaryDescriptor::OctaveKeyLines( cv::Mat& image, ScaleLines &keyLines ) numOfFinalLine += edLineVec_[octaveCount]->lines_.numOfLines; /* resize image for next level of pyramid */ - cv::resize( blur, image, cv::Size(), ( 1.f / factor ), ( 1.f / factor ) ); + cv::resize( blur, image, cv::Size(), ( 1.f / factor ), ( 1.f / factor ), INTER_LINEAR_EXACT ); /* update sigma values */ preSigma2 = curSigma2; diff --git a/modules/optflow/perf/opencl/perf_dis_optflow.cpp b/modules/optflow/perf/opencl/perf_dis_optflow.cpp index 251129d1a..703e5b6c6 100644 --- a/modules/optflow/perf/opencl/perf_dis_optflow.cpp +++ b/modules/optflow/perf/opencl/perf_dis_optflow.cpp @@ -94,8 +94,8 @@ void MakeArtificialExample(UMat &dst_frame1, UMat &dst_frame2) UMat tmp(Size(dst_frame1.cols / (1 << src_scale), dst_frame1.rows / (1 << src_scale)), CV_8U); randu(tmp, 0, 255); - resize(tmp, dst_frame1, dst_frame1.size(), 0.0, 0.0, INTER_LINEAR); - resize(tmp, dst_frame2, dst_frame2.size(), 0.0, 0.0, INTER_LINEAR); + resize(tmp, dst_frame1, dst_frame1.size(), 0.0, 0.0, INTER_LINEAR_EXACT); + resize(tmp, dst_frame2, dst_frame2.size(), 0.0, 0.0, INTER_LINEAR_EXACT); Mat displacement_field(Size(dst_frame1.cols / (1 << OF_scale), dst_frame1.rows / (1 << OF_scale)), CV_32FC2); diff --git a/modules/optflow/perf/perf_disflow.cpp b/modules/optflow/perf/perf_disflow.cpp index 5826c0602..a04990896 100644 --- a/modules/optflow/perf/perf_disflow.cpp +++ b/modules/optflow/perf/perf_disflow.cpp @@ -88,8 +88,8 @@ void MakeArtificialExample(Mat &dst_frame1, Mat &dst_frame2) Mat tmp(Size(dst_frame1.cols / (1 << src_scale), dst_frame1.rows / (1 << src_scale)), CV_8U); randu(tmp, 0, 255); - resize(tmp, dst_frame1, dst_frame1.size(), 0.0, 0.0, INTER_LINEAR); - resize(tmp, dst_frame2, dst_frame2.size(), 0.0, 0.0, INTER_LINEAR); + resize(tmp, dst_frame1, dst_frame1.size(), 0.0, 0.0, INTER_LINEAR_EXACT); + resize(tmp, dst_frame2, dst_frame2.size(), 0.0, 0.0, INTER_LINEAR_EXACT); Mat displacement_field(Size(dst_frame1.cols / (1 << OF_scale), dst_frame1.rows / (1 << OF_scale)), CV_32FC2); diff --git a/modules/saliency/src/BING/objectnessBING.cpp b/modules/saliency/src/BING/objectnessBING.cpp index 3847ef537..bda322e67 100644 --- a/modules/saliency/src/BING/objectnessBING.cpp +++ b/modules/saliency/src/BING/objectnessBING.cpp @@ -138,7 +138,7 @@ void ObjectnessBING::predictBBoxSI( Mat &img3u, ValStructVec &valB height = min( height, imgH ), width = min( width, imgW ); Mat im3u, matchCost1f, mag1u; - resize( img3u, im3u, Size( cvRound( _W * imgW * 1.0 / width ), cvRound( _W * imgH * 1.0 / height ) ) ); + resize( img3u, im3u, Size( cvRound( _W * imgW * 1.0 / width ), cvRound( _W * imgH * 1.0 / height ) ), 0, 0, INTER_LINEAR_EXACT ); gradientMag( im3u, mag1u ); matchCost1f = _tigF.matchTemplate( mag1u ); diff --git a/modules/saliency/src/motionSaliencyBinWangApr2014.cpp b/modules/saliency/src/motionSaliencyBinWangApr2014.cpp index 4e9348373..e74dee817 100644 --- a/modules/saliency/src/motionSaliencyBinWangApr2014.cpp +++ b/modules/saliency/src/motionSaliencyBinWangApr2014.cpp @@ -515,8 +515,8 @@ bool MotionSaliencyBinWangApr2014::templateReplacement( const Mat& finalBFMask, /* Check if the value of current pixel BA in potentialBackground model is already contained in at least one of its neighbors' * background model */ - resize( replicateCurrentBAMat, replicateCurrentBAMat, Size( backgroundModelROI.cols, backgroundModelROI.rows ), 0, 0, INTER_LINEAR ); - resize( diffResult, diffResult, Size( backgroundModelROI.cols, backgroundModelROI.rows ), 0, 0, INTER_LINEAR ); + resize( replicateCurrentBAMat, replicateCurrentBAMat, Size( backgroundModelROI.cols, backgroundModelROI.rows ), 0, 0, INTER_LINEAR_EXACT ); + resize( diffResult, diffResult, Size( backgroundModelROI.cols, backgroundModelROI.rows ), 0, 0, INTER_LINEAR_EXACT ); backgroundModelROI.convertTo( backgroundModelROI, CV_8U ); diff --git a/modules/saliency/src/staticSaliencySpectralResidual.cpp b/modules/saliency/src/staticSaliencySpectralResidual.cpp index 55c82723a..0182822e3 100644 --- a/modules/saliency/src/staticSaliencySpectralResidual.cpp +++ b/modules/saliency/src/staticSaliencySpectralResidual.cpp @@ -92,11 +92,11 @@ bool StaticSaliencySpectralResidual::computeSaliencyImpl( InputArray image, Outp if( image.channels() == 3 ) { cvtColor( image, imageGR, COLOR_BGR2GRAY ); - resize( imageGR, grayDown, resizedImageSize, 0, 0, INTER_LINEAR ); + resize( imageGR, grayDown, resizedImageSize, 0, 0, INTER_LINEAR_EXACT ); } else { - resize( image, grayDown, resizedImageSize, 0, 0, INTER_LINEAR ); + resize( image, grayDown, resizedImageSize, 0, 0, INTER_LINEAR_EXACT ); } grayDown.convertTo( realImage, CV_64F ); @@ -130,7 +130,7 @@ bool StaticSaliencySpectralResidual::computeSaliencyImpl( InputArray image, Outp magnitude = magnitude / maxVal; magnitude.convertTo( magnitude, CV_32F ); - resize( magnitude, saliencyMap, image.size(), 0, 0, INTER_LINEAR ); + resize( magnitude, saliencyMap, image.size(), 0, 0, INTER_LINEAR_EXACT ); #ifdef SALIENCY_DEBUG // visualize saliency map diff --git a/modules/structured_light/samples/cap_pattern.cpp b/modules/structured_light/samples/cap_pattern.cpp index a3bf67115..dc0efcd91 100644 --- a/modules/structured_light/samples/cap_pattern.cpp +++ b/modules/structured_light/samples/cap_pattern.cpp @@ -167,10 +167,10 @@ int main( int argc, char** argv ) moveWindow( "cam2", 640 + 75, 0 ); // Resizing images to avoid issues for high resolution images, visualizing them as grayscale - resize( frame1, tmp, Size( 640, 480 ) ); + resize( frame1, tmp, Size( 640, 480 ), 0, 0, INTER_LINEAR_EXACT); cvtColor( tmp, tmp, COLOR_RGB2GRAY ); imshow( "cam1", tmp ); - resize( frame2, tmp, Size( 640, 480 ) ); + resize( frame2, tmp, Size( 640, 480 ), 0, 0, INTER_LINEAR_EXACT); cvtColor( tmp, tmp, COLOR_RGB2GRAY ); imshow( "cam2", tmp ); diff --git a/modules/structured_light/samples/pointcloud.cpp b/modules/structured_light/samples/pointcloud.cpp index 97419dcc1..6eccf180d 100644 --- a/modules/structured_light/samples/pointcloud.cpp +++ b/modules/structured_light/samples/pointcloud.cpp @@ -262,7 +262,7 @@ int main( int argc, char** argv ) applyColorMap( scaledDisparityMap, cm_disp, COLORMAP_JET ); // Show the result - resize( cm_disp, cm_disp, Size( 640, 480 ) ); + resize( cm_disp, cm_disp, Size( 640, 480 ), 0, 0, INTER_LINEAR_EXACT ); imshow( "cm disparity m", cm_disp ); // Compute the point cloud @@ -273,7 +273,7 @@ int main( int argc, char** argv ) // Compute a mask to remove background Mat dst, thresholded_disp; threshold( scaledDisparityMap, thresholded_disp, 0, 255, THRESH_OTSU + THRESH_BINARY ); - resize( thresholded_disp, dst, Size( 640, 480 ) ); + resize( thresholded_disp, dst, Size( 640, 480 ), 0, 0, INTER_LINEAR_EXACT ); imshow( "threshold disp otsu", dst ); #ifdef HAVE_OPENCV_VIZ diff --git a/modules/text/samples/end_to_end_recognition.cpp b/modules/text/samples/end_to_end_recognition.cpp index 1b079067c..c8685c332 100644 --- a/modules/text/samples/end_to_end_recognition.cpp +++ b/modules/text/samples/end_to_end_recognition.cpp @@ -263,10 +263,10 @@ int main(int argc, char* argv[]) - //resize(out_img_detection,out_img_detection,Size(image.cols*scale_img,image.rows*scale_img)); + //resize(out_img_detection,out_img_detection,Size(image.cols*scale_img,image.rows*scale_img),0,0,INTER_LINEAR_EXACT); //imshow("detection", out_img_detection); //imwrite("detection.jpg", out_img_detection); - //resize(out_img,out_img,Size(image.cols*scale_img,image.rows*scale_img)); + //resize(out_img,out_img,Size(image.cols*scale_img,image.rows*scale_img),0,0,INTER_LINEAR_EXACT); namedWindow("recognition",WINDOW_NORMAL); imshow("recognition", out_img); waitKey(0); diff --git a/modules/text/samples/webcam_demo.cpp b/modules/text/samples/webcam_demo.cpp index ba9ba9b37..35a41420d 100644 --- a/modules/text/samples/webcam_demo.cpp +++ b/modules/text/samples/webcam_demo.cpp @@ -193,7 +193,7 @@ int main(int argc, char* argv[]) double t_all = (double)getTickCount(); if (downsize) - resize(frame,frame,Size(320,240)); + resize(frame,frame,Size(320,240),0,0,INTER_LINEAR_EXACT); /*Text Detection*/ cvtColor(frame,gray,COLOR_BGR2GRAY); diff --git a/modules/text/src/ocr_beamsearch_decoder.cpp b/modules/text/src/ocr_beamsearch_decoder.cpp index b746e4b39..96e0978e4 100644 --- a/modules/text/src/ocr_beamsearch_decoder.cpp +++ b/modules/text/src/ocr_beamsearch_decoder.cpp @@ -603,7 +603,7 @@ void OCRBeamSearchClassifierCNN::eval( InputArray _src, vector< vector > cvtColor(src,src,COLOR_RGB2GRAY); } - resize(src,src,Size(window_size*src.cols/src.rows,window_size)); + resize(src,src,Size(window_size*src.cols/src.rows,window_size),0,0,INTER_LINEAR_EXACT); int seg_points = 0; diff --git a/modules/text/src/ocr_hmm_decoder.cpp b/modules/text/src/ocr_hmm_decoder.cpp index c0e9af42f..3b958b173 100644 --- a/modules/text/src/ocr_hmm_decoder.cpp +++ b/modules/text/src/ocr_hmm_decoder.cpp @@ -779,14 +779,14 @@ void OCRHMMClassifierKNN::eval( InputArray _mask, vector& out_class, vector { int height = image_width*tmp.rows/tmp.cols; if(height == 0) height = 1; - resize(tmp,tmp,Size(image_width,height)); + resize(tmp,tmp,Size(image_width,height),0,0,INTER_LINEAR_EXACT); tmp.copyTo(mask(Rect(0,(image_height-height)/2,image_width,height))); } else { int width = image_height*tmp.cols/tmp.rows; if(width == 0) width = 1; - resize(tmp,tmp,Size(width,image_height)); + resize(tmp,tmp,Size(width,image_height),0,0,INTER_LINEAR_EXACT); tmp.copyTo(mask(Rect((image_width-width)/2,0,width,image_height))); } @@ -837,7 +837,7 @@ void OCRHMMClassifierKNN::eval( InputArray _mask, vector& out_class, vector copyMakeBorder(maps[i],maps[i],7,7,7,7,BORDER_CONSTANT,Scalar(0)); GaussianBlur(maps[i], maps[i], Size(7,7), 2, 2); normalize(maps[i],maps[i],0,255,NORM_MINMAX); - resize(maps[i],maps[i],Size(image_width,image_height)); + resize(maps[i],maps[i],Size(image_width,image_height),0,0,INTER_LINEAR_EXACT); } //Generate features for each bitmap @@ -1032,7 +1032,7 @@ void OCRHMMClassifierCNN::eval( InputArray _src, vector& out_class, vector< } // shall we resize the input image or make a copy ? - resize(img,img,Size(window_size,window_size)); + resize(img,img,Size(window_size,window_size),0,0,INTER_LINEAR_EXACT); Mat quad; Mat tmp; diff --git a/modules/text/src/ocr_holistic.cpp b/modules/text/src/ocr_holistic.cpp index 07c4aa98f..a48d30a07 100644 --- a/modules/text/src/ocr_holistic.cpp +++ b/modules/text/src/ocr_holistic.cpp @@ -85,7 +85,7 @@ protected: { CV_Assert(image.channels() == 1 && image.depth() == CV_8U); Mat resized; - resize(image, resized, getPerceptiveField()); + resize(image, resized, getPerceptiveField(), 0, 0, INTER_LINEAR_EXACT); Mat blob = dnn::blobFromImage(resized); net.setInput(blob, "data"); Mat prob = net.forward("prob"); diff --git a/modules/tracking/src/gtrTracker.cpp b/modules/tracking/src/gtrTracker.cpp index c0152bd9f..d7099a382 100644 --- a/modules/tracking/src/gtrTracker.cpp +++ b/modules/tracking/src/gtrTracker.cpp @@ -145,8 +145,8 @@ bool TrackerGOTURNImpl::updateImpl(const Mat& image, Rect2d& boundingBox) //Preprocess //Resize - resize(targetPatch, targetPatch, Size(INPUT_SIZE, INPUT_SIZE)); - resize(searchPatch, searchPatch, Size(INPUT_SIZE, INPUT_SIZE)); + resize(targetPatch, targetPatch, Size(INPUT_SIZE, INPUT_SIZE), 0, 0, INTER_LINEAR_EXACT); + resize(searchPatch, searchPatch, Size(INPUT_SIZE, INPUT_SIZE), 0, 0, INTER_LINEAR_EXACT); //Mean Subtract targetPatch = targetPatch - 128; diff --git a/modules/tracking/src/tldDetector.hpp b/modules/tracking/src/tldDetector.hpp index 4897ba2bc..292cbbb35 100644 --- a/modules/tracking/src/tldDetector.hpp +++ b/modules/tracking/src/tldDetector.hpp @@ -56,7 +56,7 @@ namespace cv const int MAX_EXAMPLES_IN_MODEL = 500; const int MEASURES_PER_CLASSIFIER = 13; const int GRIDSIZE = 15; - const int DOWNSCALE_MODE = cv::INTER_LINEAR; + const int DOWNSCALE_MODE = cv::INTER_LINEAR_EXACT; const double THETA_NN = 0.5; const double CORE_THRESHOLD = 0.5; const double CLASSIFIER_MARGIN = 0.1; diff --git a/modules/tracking/src/tldModel.cpp b/modules/tracking/src/tldModel.cpp index 7ff43e2af..9ee9064cf 100644 --- a/modules/tracking/src/tldModel.cpp +++ b/modules/tracking/src/tldModel.cpp @@ -114,7 +114,7 @@ namespace cv #ifdef BLUR_AS_VADIM GaussianBlur(standardPatch, blurredPatch, GaussBlurKernelSize, 0.0); - resize(blurredPatch, blurredPatch, minSize); + resize(blurredPatch, blurredPatch, minSize, 0, 0, INTER_LINEAR_EXACT); #else resample(blurredImg, RotatedRect(center, size, angle), blurredPatch); #endif diff --git a/modules/tracking/src/tldTracker.cpp b/modules/tracking/src/tldTracker.cpp index 00ee55cc5..db1fccf54 100644 --- a/modules/tracking/src/tldTracker.cpp +++ b/modules/tracking/src/tldTracker.cpp @@ -287,7 +287,7 @@ int TrackerTLDImpl::Pexpert::additionalExamples(std::vector >& examp #if defined BLUR_AS_VADIM GaussianBlur(standardPatch, blurredPatch, GaussBlurKernelSize, 0.0); - resize(blurredPatch, blurredPatch, initSize_); + resize(blurredPatch, blurredPatch, initSize_, 0, 0, INTER_LINEAR_EXACT); #else resample(blurredImg, RotatedRect(center, size, angle), blurredPatch); #endif diff --git a/modules/tracking/src/tldUtils.cpp b/modules/tracking/src/tldUtils.cpp index bed90bc90..b570a1f3b 100644 --- a/modules/tracking/src/tldUtils.cpp +++ b/modules/tracking/src/tldUtils.cpp @@ -103,7 +103,7 @@ double scaleAndBlur(const Mat& originalImg, int scale, Mat& scaledImg, Mat& blur for( int i = 0; i < scale; i++, dScale *= scaleStep ); Size2d size = originalImg.size(); size.height /= dScale; size.width /= dScale; - resize(originalImg, scaledImg, size); + resize(originalImg, scaledImg, size, 0, 0, INTER_LINEAR_EXACT); GaussianBlur(scaledImg, blurredImg, GaussBlurKernelSize, 0.0); return dScale; } diff --git a/modules/tracking/src/trackerKCF.cpp b/modules/tracking/src/trackerKCF.cpp index 6702e2d85..7853f2980 100644 --- a/modules/tracking/src/trackerKCF.cpp +++ b/modules/tracking/src/trackerKCF.cpp @@ -306,7 +306,7 @@ namespace cv{ CV_Assert(img.channels() == 1 || img.channels() == 3); // resize the image whenever needed - if(resizeImage)resize(img,img,Size(img.cols/2,img.rows/2)); + if(resizeImage)resize(img,img,Size(img.cols/2,img.rows/2),0,0,INTER_LINEAR_EXACT); // detection part if(frame>0){ diff --git a/modules/xfeatures2d/src/sift.cpp b/modules/xfeatures2d/src/sift.cpp index 1c1490935..2994221f0 100644 --- a/modules/xfeatures2d/src/sift.cpp +++ b/modules/xfeatures2d/src/sift.cpp @@ -197,7 +197,8 @@ static const float SIFT_DESCR_MAG_THR = 0.2f; // factor used to convert floating-point descriptor to unsigned char static const float SIFT_INT_DESCR_FCTR = 512.f; -#if 0 +#define DoG_TYPE_SHORT 0 +#if DoG_TYPE_SHORT // intermediate type used for DoG pyramids typedef short sift_wt; static const int SIFT_FIXPT_SCALE = 48; @@ -233,7 +234,11 @@ static Mat createInitialImage( const Mat& img, bool doubleImageSize, float sigma { sig_diff = sqrtf( std::max(sigma * sigma - SIFT_INIT_SIGMA * SIFT_INIT_SIGMA * 4, 0.01f) ); Mat dbl; +#if DoG_TYPE_SHORT + resize(gray_fpt, dbl, Size(gray_fpt.cols*2, gray_fpt.rows*2), 0, 0, INTER_LINEAR_EXACT); +#else resize(gray_fpt, dbl, Size(gray_fpt.cols*2, gray_fpt.rows*2), 0, 0, INTER_LINEAR); +#endif GaussianBlur(dbl, dbl, Size(), sig_diff, sig_diff); return dbl; } diff --git a/modules/xfeatures2d/test/test_rotation_and_scale_invariance.cpp b/modules/xfeatures2d/test/test_rotation_and_scale_invariance.cpp index cd213f301..1db986534 100644 --- a/modules/xfeatures2d/test/test_rotation_and_scale_invariance.cpp +++ b/modules/xfeatures2d/test/test_rotation_and_scale_invariance.cpp @@ -438,7 +438,7 @@ protected: { float scale = 1.f + scaleIdx * 0.5f; Mat image1; - resize(image0, image1, Size(), 1./scale, 1./scale); + resize(image0, image1, Size(), 1./scale, 1./scale, INTER_LINEAR_EXACT); vector keypoints1, osiKeypoints1; // osi - original size image featureDetector->detect(image1, keypoints1); @@ -563,7 +563,7 @@ protected: float scale = 1.f + scaleIdx * 0.5f; Mat image1; - resize(image0, image1, Size(), 1./scale, 1./scale); + resize(image0, image1, Size(), 1./scale, 1./scale, INTER_LINEAR_EXACT); vector keypoints1; scaleKeyPoints(keypoints0, keypoints1, 1.0f/scale); diff --git a/modules/ximgproc/perf/perf_disparity_wls_filter.cpp b/modules/ximgproc/perf/perf_disparity_wls_filter.cpp index 89b9e777a..f46c66f92 100644 --- a/modules/ximgproc/perf/perf_disparity_wls_filter.cpp +++ b/modules/ximgproc/perf/perf_disparity_wls_filter.cpp @@ -75,9 +75,9 @@ PERF_TEST_P( DisparityWLSFilterPerfTest, perf, Combine(GuideTypes::all(), SrcTyp MakeArtificialExample(rng,guide,disp_left,disp_right,ROI); if(use_downscale) { - resize(disp_left,disp_left,Size(),0.5,0.5); + resize(disp_left,disp_left,Size(),0.5,0.5, INTER_LINEAR_EXACT); disp_left/=2; - resize(disp_right,disp_right,Size(),0.5,0.5); + resize(disp_right,disp_right,Size(),0.5,0.5, INTER_LINEAR_EXACT); disp_right/=2; ROI = Rect(ROI.x/2,ROI.y/2,ROI.width/2,ROI.height/2); } diff --git a/modules/ximgproc/samples/disparity_filtering.cpp b/modules/ximgproc/samples/disparity_filtering.cpp index beef61d76..767fb9ff6 100644 --- a/modules/ximgproc/samples/disparity_filtering.cpp +++ b/modules/ximgproc/samples/disparity_filtering.cpp @@ -135,8 +135,8 @@ int main(int argc, char** argv) max_disp/=2; if(max_disp%16!=0) max_disp += 16-(max_disp%16); - resize(left ,left_for_matcher ,Size(),0.5,0.5); - resize(right,right_for_matcher,Size(),0.5,0.5); + resize(left ,left_for_matcher ,Size(),0.5,0.5, INTER_LINEAR_EXACT); + resize(right,right_for_matcher,Size(),0.5,0.5, INTER_LINEAR_EXACT); //! [downscale] } else @@ -196,7 +196,7 @@ int main(int argc, char** argv) if(!no_downscale) { // upscale raw disparity and ROI back for a proper comparison: - resize(left_disp,left_disp,Size(),2.0,2.0); + resize(left_disp,left_disp,Size(),2.0,2.0,INTER_LINEAR_EXACT); left_disp = left_disp*2.0; ROI = Rect(ROI.x*2,ROI.y*2,ROI.width*2,ROI.height*2); } diff --git a/modules/ximgproc/samples/fast_hough_transform.cpp b/modules/ximgproc/samples/fast_hough_transform.cpp index ac34932de..c59f30f06 100644 --- a/modules/ximgproc/samples/fast_hough_transform.cpp +++ b/modules/ximgproc/samples/fast_hough_transform.cpp @@ -233,7 +233,7 @@ static void rescale(Mat const &src, Mat &dst, { double scale = min(min(static_cast(maxWidth) / src.cols, static_cast(maxHeight) / src.rows), 1.0); - resize(src, dst, Size(), scale, scale, INTER_LINEAR); + resize(src, dst, Size(), scale, scale, INTER_LINEAR_EXACT); } static void showHumanReadableImg(string const &name, Mat const &img) diff --git a/modules/ximgproc/samples/filterdemo.cpp b/modules/ximgproc/samples/filterdemo.cpp index e375a8aea..2550ab62f 100644 --- a/modules/ximgproc/samples/filterdemo.cpp +++ b/modules/ximgproc/samples/filterdemo.cpp @@ -87,7 +87,7 @@ int main( int argc, const char** argv) if( frame.rows <= rows0 ) src = frame; else - resize(frame, src, Size(cvRound(480.*frame.cols/frame.rows), 480)); + resize(frame, src, Size(cvRound(480.*frame.cols/frame.rows), 480), 0, 0, INTER_LINEAR_EXACT); float t = (float)getTickCount(); ximgproc::anisotropicDiffusion(src, dst, alpha, sigma, niters); diff --git a/modules/ximgproc/samples/thinning.cpp b/modules/ximgproc/samples/thinning.cpp index b6201bcbd..39a6960b8 100644 --- a/modules/ximgproc/samples/thinning.cpp +++ b/modules/ximgproc/samples/thinning.cpp @@ -11,7 +11,7 @@ using namespace cv; int main() { Mat img = imread("opencv-logo.png", IMREAD_COLOR); - resize(img, img, Size(), 0.5, 0.5); + resize(img, img, Size(), 0.5, 0.5, INTER_LINEAR_EXACT); /// Threshold the input image Mat img_grayscale, img_binary; diff --git a/modules/ximgproc/test/test_adaptive_manifold.cpp b/modules/ximgproc/test/test_adaptive_manifold.cpp index 67fb26d60..824459c7d 100644 --- a/modules/ximgproc/test/test_adaptive_manifold.cpp +++ b/modules/ximgproc/test/test_adaptive_manifold.cpp @@ -185,8 +185,8 @@ TEST_P(AdaptiveManifoldRefImplTest, RefImplAccuracy) //inconsistent downsample/upsample operations in reference implementation Size dstSize((guide.cols + 15) & ~15, (guide.rows + 15) & ~15); - resize(guide, guide, dstSize); - resize(src, src, dstSize); + resize(guide, guide, dstSize, 0, 0, INTER_LINEAR_EXACT); + resize(src, src, dstSize, 0, 0, INTER_LINEAR_EXACT); for (int iter = 0; iter < 4; iter++) { diff --git a/modules/ximgproc/test/test_adaptive_manifold_ref_impl.cpp b/modules/ximgproc/test/test_adaptive_manifold_ref_impl.cpp index 273daedf4..97e996a8e 100644 --- a/modules/ximgproc/test/test_adaptive_manifold_ref_impl.cpp +++ b/modules/ximgproc/test/test_adaptive_manifold_ref_impl.cpp @@ -818,7 +818,7 @@ namespace resize(buf.mul, buf.numerator, Size(), 1.0 / df, 1.0 / df); ensureSizeIsEnough(nsz, buf.denominator); - resize(buf.theta_masked, buf.denominator, Size(), 1.0 / df, 1.0 / df); + resize(buf.theta_masked, buf.denominator, Size(), 1.0 / df, 1.0 / df); h_filter(buf.numerator, buf.numerator_filtered, sigma_s / df); h_filter(buf.denominator, buf.denominator_filtered, sigma_s / df); diff --git a/modules/ximgproc/test/test_disparity_wls_filter.cpp b/modules/ximgproc/test/test_disparity_wls_filter.cpp index 93323b525..ed3f58a3b 100644 --- a/modules/ximgproc/test/test_disparity_wls_filter.cpp +++ b/modules/ximgproc/test/test_disparity_wls_filter.cpp @@ -124,8 +124,8 @@ TEST_P(DisparityWLSFilterTest, MultiThreadReproducibility) if(use_downscale) { - resize(left_disp,left_disp,Size(),0.5,0.5); - resize(right_disp,right_disp,Size(),0.5,0.5); + resize(left_disp,left_disp,Size(),0.5,0.5, INTER_LINEAR_EXACT); + resize(right_disp,right_disp,Size(),0.5,0.5, INTER_LINEAR_EXACT); ROI = Rect(ROI.x/2,ROI.y/2,ROI.width/2,ROI.height/2); } diff --git a/modules/ximgproc/test/test_domain_transform.cpp b/modules/ximgproc/test/test_domain_transform.cpp index 92ec267c8..c353ee7a0 100644 --- a/modules/ximgproc/test/test_domain_transform.cpp +++ b/modules/ximgproc/test/test_domain_transform.cpp @@ -85,7 +85,7 @@ Mat convertTypeAndSize(Mat src, int dstType, Size dstSize) } dst.convertTo(dst, dstType); - resize(dst, dst, dstSize); + resize(dst, dst, dstSize, 0, 0, dstType == CV_32FC1 ? INTER_LINEAR : INTER_LINEAR_EXACT); return dst; } diff --git a/modules/ximgproc/test/test_guided_filter.cpp b/modules/ximgproc/test/test_guided_filter.cpp index 04b185fdb..29fdf8896 100644 --- a/modules/ximgproc/test/test_guided_filter.cpp +++ b/modules/ximgproc/test/test_guided_filter.cpp @@ -99,7 +99,7 @@ static Mat convertTypeAndSize(Mat src, int dstType, Size dstSize) } dst.convertTo(dst, dstType); - resize(dst, dst, dstSize); + resize(dst, dst, dstSize, 0, 0, INTER_LINEAR_EXACT); return dst; } diff --git a/modules/ximgproc/test/test_joint_bilateral_filter.cpp b/modules/ximgproc/test/test_joint_bilateral_filter.cpp index 8f71ac801..0436c6664 100644 --- a/modules/ximgproc/test/test_joint_bilateral_filter.cpp +++ b/modules/ximgproc/test/test_joint_bilateral_filter.cpp @@ -83,7 +83,7 @@ static Mat convertTypeAndSize(Mat src, int dstType, Size dstSize) } dst.convertTo(dst, dstType); - resize(dst, dst, dstSize); + resize(dst, dst, dstSize, 0, 0, INTER_LINEAR_EXACT); return dst; } diff --git a/modules/ximgproc/test/test_rolling_guidance_filter.cpp b/modules/ximgproc/test/test_rolling_guidance_filter.cpp index f175118e6..3c36759bd 100644 --- a/modules/ximgproc/test/test_rolling_guidance_filter.cpp +++ b/modules/ximgproc/test/test_rolling_guidance_filter.cpp @@ -81,7 +81,7 @@ static Mat convertTypeAndSize(Mat src, int dstType, Size dstSize) } dst.convertTo(dst, dstType); - resize(dst, dst, dstSize); + resize(dst, dst, dstSize, 0, 0, INTER_LINEAR_EXACT); return dst; } diff --git a/modules/xobjdetect/src/waldboost.cpp b/modules/xobjdetect/src/waldboost.cpp index 8c1394621..d1dbdfd84 100644 --- a/modules/xobjdetect/src/waldboost.cpp +++ b/modules/xobjdetect/src/waldboost.cpp @@ -130,7 +130,7 @@ void WaldBoost::detect(Ptr eval, float h; for (size_t i = 0; i < scales.size(); ++i) { float scale = scales[i]; - resize(img, resized_img, Size(), scale, scale); + resize(img, resized_img, Size(), scale, scale, INTER_LINEAR_EXACT); eval->setImage(resized_img, 0, 0, feature_indices_); int n_rows = (int)(24 / scale); int n_cols = (int)(24 / scale); @@ -162,7 +162,7 @@ void WaldBoost::detect(Ptr eval, float h; for (size_t i = 0; i < scales.size(); ++i) { float scale = scales[i]; - resize(img, resized_img, Size(), scale, scale); + resize(img, resized_img, Size(), scale, scale, INTER_LINEAR_EXACT); eval->setImage(resized_img, 0, 0, feature_indices_); int n_rows = (int)(24 / scale); int n_cols = (int)(24 / scale); diff --git a/modules/xobjdetect/src/wbdetector.cpp b/modules/xobjdetect/src/wbdetector.cpp index 395ea1e48..4c9aed6c5 100644 --- a/modules/xobjdetect/src/wbdetector.cpp +++ b/modules/xobjdetect/src/wbdetector.cpp @@ -179,7 +179,7 @@ void WBDetectorImpl::train( win_count = min(win_count, stage_neg - bootstrap_count); Mat window; for (int k = 0; k < win_count; ++k) { - resize(img(bboxes[indices(k, 0)]), window, Size(24, 24)); + resize(img(bboxes[indices(k, 0)]), window, Size(24, 24), 0, 0, INTER_LINEAR_EXACT); neg_imgs.push_back(window.clone()); bootstrap_count += 1; } diff --git a/modules/xphoto/perf/perf_learning_based_color_balance.cpp b/modules/xphoto/perf/perf_learning_based_color_balance.cpp index 6c66d4eb9..0c2e49ed7 100644 --- a/modules/xphoto/perf/perf_learning_based_color_balance.cpp +++ b/modules/xphoto/perf/perf_learning_based_color_balance.cpp @@ -64,7 +64,7 @@ PERF_TEST_P(learningBasedWBPerfTest, perf, Combine(SZ_ALL_HD, Values(CV_8UC3, CV Mat src_dscl(Size(size.width / 16, size.height / 16), t); RNG rng(1234); rng.fill(src_dscl, RNG::UNIFORM, 0, range_max_val); - resize(src_dscl, src, src.size()); + resize(src_dscl, src, src.size(), 0, 0, INTER_LINEAR_EXACT); Ptr wb = xphoto::createLearningBasedWB(); wb->setRangeMaxVal(range_max_val); wb->setSaturationThreshold(0.98f);