Updated internal calls to linear resize to use bit-exact version

pull/1482/head
Vitaly Tuzov 7 years ago
parent b0fc85b1a4
commit 8c394a4f2e
  1. 2
      modules/bgsegm/test/test_backgroundsubtractor_lsbp.cpp
  2. 2
      modules/ccalib/src/randpattern.cpp
  3. 4
      modules/dpm/src/dpm_feature.cpp
  4. 2
      modules/face/samples/facemark_lbf_fitting.cpp
  5. 2
      modules/face/samples/sampleDetectLandmarks.cpp
  6. 2
      modules/face/samples/sampleDetectLandmarksvideo.cpp
  7. 4
      modules/face/samples/sample_face_swapping.cpp
  8. 2
      modules/face/src/face_alignment.cpp
  9. 2
      modules/face/src/facemarkAAM.cpp
  10. 2
      modules/face/tutorials/face_landmark/face_landmark_detection.markdown
  11. 2
      modules/face/tutorials/face_landmark/face_landmark_video.markdown
  12. 4
      modules/face/tutorials/face_landmark/sample_face_swapping.markdown
  13. 2
      modules/img_hash/src/average_hash.cpp
  14. 2
      modules/img_hash/src/block_mean_hash.cpp
  15. 2
      modules/img_hash/src/phash.cpp
  16. 4
      modules/line_descriptor/samples/matching.cpp
  17. 2
      modules/line_descriptor/src/binary_descriptor.cpp
  18. 4
      modules/optflow/perf/opencl/perf_dis_optflow.cpp
  19. 4
      modules/optflow/perf/perf_disflow.cpp
  20. 2
      modules/saliency/src/BING/objectnessBING.cpp
  21. 4
      modules/saliency/src/motionSaliencyBinWangApr2014.cpp
  22. 6
      modules/saliency/src/staticSaliencySpectralResidual.cpp
  23. 4
      modules/structured_light/samples/cap_pattern.cpp
  24. 4
      modules/structured_light/samples/pointcloud.cpp
  25. 4
      modules/text/samples/end_to_end_recognition.cpp
  26. 2
      modules/text/samples/webcam_demo.cpp
  27. 2
      modules/text/src/ocr_beamsearch_decoder.cpp
  28. 8
      modules/text/src/ocr_hmm_decoder.cpp
  29. 2
      modules/text/src/ocr_holistic.cpp
  30. 4
      modules/tracking/src/gtrTracker.cpp
  31. 2
      modules/tracking/src/tldDetector.hpp
  32. 2
      modules/tracking/src/tldModel.cpp
  33. 2
      modules/tracking/src/tldTracker.cpp
  34. 2
      modules/tracking/src/tldUtils.cpp
  35. 2
      modules/tracking/src/trackerKCF.cpp
  36. 7
      modules/xfeatures2d/src/sift.cpp
  37. 4
      modules/xfeatures2d/test/test_rotation_and_scale_invariance.cpp
  38. 4
      modules/ximgproc/perf/perf_disparity_wls_filter.cpp
  39. 6
      modules/ximgproc/samples/disparity_filtering.cpp
  40. 2
      modules/ximgproc/samples/fast_hough_transform.cpp
  41. 2
      modules/ximgproc/samples/filterdemo.cpp
  42. 2
      modules/ximgproc/samples/thinning.cpp
  43. 4
      modules/ximgproc/test/test_adaptive_manifold.cpp
  44. 2
      modules/ximgproc/test/test_adaptive_manifold_ref_impl.cpp
  45. 4
      modules/ximgproc/test/test_disparity_wls_filter.cpp
  46. 2
      modules/ximgproc/test/test_domain_transform.cpp
  47. 2
      modules/ximgproc/test/test_guided_filter.cpp
  48. 2
      modules/ximgproc/test/test_joint_bilateral_filter.cpp
  49. 2
      modules/ximgproc/test/test_rolling_guidance_filter.cpp
  50. 4
      modules/xobjdetect/src/waldboost.cpp
  51. 2
      modules/xobjdetect/src/wbdetector.cpp
  52. 2
      modules/xphoto/perf/perf_learning_based_color_balance.cpp

@ -91,7 +91,7 @@ template<typename T>
static double evaluateBGSAlgorithm(Ptr<T> bgs) { static double evaluateBGSAlgorithm(Ptr<T> bgs) {
Mat background = imread(getDataDir() + "shared/fruits.png"); Mat background = imread(getDataDir() + "shared/fruits.png");
Mat object = imread(getDataDir() + "shared/baboon.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<bgsegm::SyntheticSequenceGenerator> generator = bgsegm::createSyntheticSequenceGenerator(background, object); Ptr<bgsegm::SyntheticSequenceGenerator> generator = bgsegm::createSyntheticSequenceGenerator(background, object);
double f1_mean = 0; double f1_mean = 0;

@ -371,7 +371,7 @@ void RandomPatternGenerator::generatePattern()
Mat r = Mat(n, m, CV_32F); Mat r = Mat(n, m, CV_32F);
cv::randn(r, Scalar::all(0), Scalar::all(1)); 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; double min_r, max_r;
minMaxLoc(r, &min_r, &max_r); minMaxLoc(r, &min_r, &max_r);

@ -87,7 +87,7 @@ void Feature::computeFeaturePyramid(const Mat &imageM, vector< Mat > &pyramid)
{ {
const double scale = (double)(1.0f/pow(params.sfactor, i)); const double scale = (double)(1.0f/pow(params.sfactor, i));
Mat imScaled; Mat imScaled;
resize(imageM, imScaled, imSize * scale); resize(imageM, imScaled, imSize * scale, 0, 0, INTER_LINEAR_EXACT);
// First octave at twice the image resolution // First octave at twice the image resolution
computeHOG32D(imScaled, pyramid[i], params.binSize/2, computeHOG32D(imScaled, pyramid[i], params.binSize/2,
params.padx + 1, params.pady + 1); params.padx + 1, params.pady + 1);
@ -106,7 +106,7 @@ void Feature::computeFeaturePyramid(const Mat &imageM, vector< Mat > &pyramid)
{ {
Mat imScaled2; Mat imScaled2;
Size_<double> imScaledSize = imScaled.size(); Size_<double> imScaledSize = imScaled.size();
resize(imScaled, imScaled2, imScaledSize*0.5); resize(imScaled, imScaled2, imScaledSize*0.5, 0, 0, INTER_LINEAR_EXACT);
imScaled = imScaled2; imScaled = imScaled2;
computeHOG32D(imScaled2, pyramid[j+params.interval], computeHOG32D(imScaled2, pyramid[j+params.interval],
params.binSize, params.padx + 1, params.pady + 1); params.binSize, params.padx + 1, params.pady + 1);

@ -104,7 +104,7 @@ int main(int argc, char** argv ){
double __time__ = (double)getTickCount(); double __time__ = (double)getTickCount();
float scale = (float)(400.0/frame.cols); 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); facemark->getFaces(img, rects);
rects_scaled.clear(); rects_scaled.clear();

@ -72,7 +72,7 @@ int main(int argc,char** argv){
facemark->loadModel(filename); facemark->loadModel(filename);
cout<<"Loaded model"<<endl; cout<<"Loaded model"<<endl;
vector<Rect> faces; vector<Rect> faces;
resize(img,img,Size(460,460)); resize(img,img,Size(460,460), 0, 0, INTER_LINEAR_EXACT);
facemark->getFaces(img,faces); facemark->getFaces(img,faces);
vector< vector<Point2f> > shapes; vector< vector<Point2f> > shapes;
if(facemark->fit(img,faces,shapes)) if(facemark->fit(img,faces,shapes))

@ -83,7 +83,7 @@ int main(int argc,char** argv){
shapes.clear(); shapes.clear();
cap>>img; cap>>img;
//Detect faces in the current image //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); facemark->getFaces(img,faces);
if(faces.size()==0){ if(faces.size()==0){
cout<<"No faces found in this frame"<<endl; cout<<"No faces found in this frame"<<endl;

@ -139,8 +139,8 @@ int main( int argc, char** argv)
//Detect faces in the current image //Detect faces in the current image
float ratio1 = (float)img1.cols/(float)img1.rows; float ratio1 = (float)img1.cols/(float)img1.rows;
float ratio2 = (float)img2.cols/(float)img2.rows; float ratio2 = (float)img2.cols/(float)img2.rows;
resize(img1,img1,Size((int)(640*ratio1),(int)(640*ratio1))); resize(img1,img1,Size((int)(640*ratio1),(int)(640*ratio1)), 0, 0, INTER_LINEAR_EXACT);
resize(img2,img2,Size((int)(640*ratio2),(int)(640*ratio2))); resize(img2,img2,Size((int)(640*ratio2),(int)(640*ratio2)), 0, 0, INTER_LINEAR_EXACT);
Mat img1Warped = img2.clone(); Mat img1Warped = img2.clone();
facemark->getFaces(img1,faces1); facemark->getFaces(img1,faces1);
facemark->getFaces(img2,faces2); facemark->getFaces(img2,faces2);

@ -173,7 +173,7 @@ bool FacemarkKazemiImpl::scaleData( vector< vector<Point2f> > & trainlandmarks,
//calculating scale for x and y axis //calculating scale for x and y axis
scalex=float(s.width)/float(trainimages[i].cols); scalex=float(s.width)/float(trainimages[i].cols);
scaley=float(s.height)/float(trainimages[i].rows); 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<Point2f>::iterator it = trainlandmarks[i].begin(); it != trainlandmarks[i].end(); it++) { for (vector<Point2f>::iterator it = trainlandmarks[i].begin(); it != trainlandmarks[i].end(); it++) {
Point2f pt = (*it); Point2f pt = (*it);
pt.x = pt.x*scalex; pt.x = pt.x*scalex;

@ -374,7 +374,7 @@ bool FacemarkAAMImpl::fitImpl( const Mat image, std::vector<Point2f>& landmarks,
imgray = image; 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*/ /*chop the textures model*/
int maxCol = param_m; int maxCol = param_m;

@ -63,7 +63,7 @@ in which landmarks have to be detected.
facemark->loadModel(filename); facemark->loadModel(filename);
cout<<"Loaded model"<<endl; cout<<"Loaded model"<<endl;
vector<Rect> faces; vector<Rect> faces;
resize(img,img,Size(460,460)); resize(img,img,Size(460,460),0,0,INTER_LINEAR_EXACT);
facemark->getFaces(img,faces); facemark->getFaces(img,faces);
vector< vector<Point2f> > shapes; vector< vector<Point2f> > shapes;

@ -74,7 +74,7 @@ while(1){
faces.clear(); faces.clear();
shapes.clear(); shapes.clear();
cap>>img; cap>>img;
resize(img,img,Size(600,600)); resize(img,img,Size(600,600),0,0,INTER_LINEAR_EXACT);
facemark->getFaces(img,faces); facemark->getFaces(img,faces);
if(faces.size()==0){ if(faces.size()==0){
cout<<"No faces found in this frame"<<endl; cout<<"No faces found in this frame"<<endl;

@ -54,8 +54,8 @@ vector<Rect> faces1,faces2;
vector< vector<Point2f> > shape1,shape2; vector< vector<Point2f> > shape1,shape2;
float ratio1 = (float)img1.cols/(float)img1.rows; float ratio1 = (float)img1.cols/(float)img1.rows;
float ratio2 = (float)img2.cols/(float)img2.rows; float ratio2 = (float)img2.cols/(float)img2.rows;
resize(img1,img1,Size(640*ratio1,640*ratio1)); resize(img1,img1,Size(640*ratio1,640*ratio1),0,0,INTER_LINEAR_EXACT);
resize(img2,img2,Size(640*ratio2,640*ratio2)); resize(img2,img2,Size(640*ratio2,640*ratio2),0,0,INTER_LINEAR_EXACT);
Mat img1Warped = img2.clone(); Mat img1Warped = img2.clone();
facemark->getFaces(img1,faces1); facemark->getFaces(img1,faces1);
facemark->getFaces(img2,faces2); facemark->getFaces(img2,faces2);

@ -26,7 +26,7 @@ public:
input.type() == CV_8UC3 || input.type() == CV_8UC3 ||
input.type() == CV_8U); 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) if(input.type() == CV_8UC3)
{ {
cv::cvtColor(resizeImg, grayImg, CV_BGR2GRAY); cv::cvtColor(resizeImg, grayImg, CV_BGR2GRAY);

@ -39,7 +39,7 @@ public:
input.type() == CV_8UC3 || input.type() == CV_8UC3 ||
input.type() == CV_8U); 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) if(input.type() == CV_8UC3)
{ {
cv::cvtColor(resizeImg_, grayImg_, CV_BGR2GRAY); cv::cvtColor(resizeImg_, grayImg_, CV_BGR2GRAY);

@ -20,7 +20,7 @@ public:
input.type() == CV_8UC3 || input.type() == CV_8UC3 ||
input.type() == CV_8U); 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) if(input.type() == CV_8UC3)
{ {
cv::cvtColor(resizeImg, grayImg, CV_BGR2GRAY); cv::cvtColor(resizeImg, grayImg, CV_BGR2GRAY);

@ -197,8 +197,8 @@ int main( int argc, char** argv )
/* plot matches */ /* plot matches */
cv::Mat lsd_outImg; cv::Mat lsd_outImg;
resize( imageMat1, imageMat1, Size( imageMat1.cols / 2, imageMat1.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 ) ); resize( imageMat2, imageMat2, Size( imageMat2.cols / 2, imageMat2.rows / 2 ), 0, 0, INTER_LINEAR_EXACT );
std::vector<char> lsd_mask( matches.size(), 1 ); std::vector<char> lsd_mask( matches.size(), 1 );
drawLineMatches( imageMat1, octave0_1, imageMat2, octave0_2, good_matches, lsd_outImg, Scalar::all( -1 ), Scalar::all( -1 ), lsd_mask, drawLineMatches( imageMat1, octave0_1, imageMat2, octave0_2, good_matches, lsd_outImg, Scalar::all( -1 ), Scalar::all( -1 ), lsd_mask,
DrawLinesMatchesFlags::DEFAULT ); DrawLinesMatchesFlags::DEFAULT );

@ -723,7 +723,7 @@ int BinaryDescriptor::OctaveKeyLines( cv::Mat& image, ScaleLines &keyLines )
numOfFinalLine += edLineVec_[octaveCount]->lines_.numOfLines; numOfFinalLine += edLineVec_[octaveCount]->lines_.numOfLines;
/* resize image for next level of pyramid */ /* 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 */ /* update sigma values */
preSigma2 = curSigma2; preSigma2 = curSigma2;

@ -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); UMat tmp(Size(dst_frame1.cols / (1 << src_scale), dst_frame1.rows / (1 << src_scale)), CV_8U);
randu(tmp, 0, 255); randu(tmp, 0, 255);
resize(tmp, dst_frame1, dst_frame1.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); 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)), Mat displacement_field(Size(dst_frame1.cols / (1 << OF_scale), dst_frame1.rows / (1 << OF_scale)),
CV_32FC2); CV_32FC2);

@ -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); Mat tmp(Size(dst_frame1.cols / (1 << src_scale), dst_frame1.rows / (1 << src_scale)), CV_8U);
randu(tmp, 0, 255); randu(tmp, 0, 255);
resize(tmp, dst_frame1, dst_frame1.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); 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)), Mat displacement_field(Size(dst_frame1.cols / (1 << OF_scale), dst_frame1.rows / (1 << OF_scale)),
CV_32FC2); CV_32FC2);

@ -138,7 +138,7 @@ void ObjectnessBING::predictBBoxSI( Mat &img3u, ValStructVec<float, Vec4i> &valB
height = min( height, imgH ), width = min( width, imgW ); height = min( height, imgH ), width = min( width, imgW );
Mat im3u, matchCost1f, mag1u; 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 ); gradientMag( im3u, mag1u );
matchCost1f = _tigF.matchTemplate( mag1u ); matchCost1f = _tigF.matchTemplate( mag1u );

@ -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' /* Check if the value of current pixel BA in potentialBackground model is already contained in at least one of its neighbors'
* background model * background model
*/ */
resize( replicateCurrentBAMat, replicateCurrentBAMat, 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 ); resize( diffResult, diffResult, Size( backgroundModelROI.cols, backgroundModelROI.rows ), 0, 0, INTER_LINEAR_EXACT );
backgroundModelROI.convertTo( backgroundModelROI, CV_8U ); backgroundModelROI.convertTo( backgroundModelROI, CV_8U );

@ -92,11 +92,11 @@ bool StaticSaliencySpectralResidual::computeSaliencyImpl( InputArray image, Outp
if( image.channels() == 3 ) if( image.channels() == 3 )
{ {
cvtColor( image, imageGR, COLOR_BGR2GRAY ); cvtColor( image, imageGR, COLOR_BGR2GRAY );
resize( imageGR, grayDown, resizedImageSize, 0, 0, INTER_LINEAR ); resize( imageGR, grayDown, resizedImageSize, 0, 0, INTER_LINEAR_EXACT );
} }
else else
{ {
resize( image, grayDown, resizedImageSize, 0, 0, INTER_LINEAR ); resize( image, grayDown, resizedImageSize, 0, 0, INTER_LINEAR_EXACT );
} }
grayDown.convertTo( realImage, CV_64F ); grayDown.convertTo( realImage, CV_64F );
@ -130,7 +130,7 @@ bool StaticSaliencySpectralResidual::computeSaliencyImpl( InputArray image, Outp
magnitude = magnitude / maxVal; magnitude = magnitude / maxVal;
magnitude.convertTo( magnitude, CV_32F ); 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 #ifdef SALIENCY_DEBUG
// visualize saliency map // visualize saliency map

@ -167,10 +167,10 @@ int main( int argc, char** argv )
moveWindow( "cam2", 640 + 75, 0 ); moveWindow( "cam2", 640 + 75, 0 );
// Resizing images to avoid issues for high resolution images, visualizing them as grayscale // 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 ); cvtColor( tmp, tmp, COLOR_RGB2GRAY );
imshow( "cam1", tmp ); 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 ); cvtColor( tmp, tmp, COLOR_RGB2GRAY );
imshow( "cam2", tmp ); imshow( "cam2", tmp );

@ -262,7 +262,7 @@ int main( int argc, char** argv )
applyColorMap( scaledDisparityMap, cm_disp, COLORMAP_JET ); applyColorMap( scaledDisparityMap, cm_disp, COLORMAP_JET );
// Show the result // 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 ); imshow( "cm disparity m", cm_disp );
// Compute the point cloud // Compute the point cloud
@ -273,7 +273,7 @@ int main( int argc, char** argv )
// Compute a mask to remove background // Compute a mask to remove background
Mat dst, thresholded_disp; Mat dst, thresholded_disp;
threshold( scaledDisparityMap, thresholded_disp, 0, 255, THRESH_OTSU + THRESH_BINARY ); 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 ); imshow( "threshold disp otsu", dst );
#ifdef HAVE_OPENCV_VIZ #ifdef HAVE_OPENCV_VIZ

@ -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); //imshow("detection", out_img_detection);
//imwrite("detection.jpg", 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); namedWindow("recognition",WINDOW_NORMAL);
imshow("recognition", out_img); imshow("recognition", out_img);
waitKey(0); waitKey(0);

@ -193,7 +193,7 @@ int main(int argc, char* argv[])
double t_all = (double)getTickCount(); double t_all = (double)getTickCount();
if (downsize) if (downsize)
resize(frame,frame,Size(320,240)); resize(frame,frame,Size(320,240),0,0,INTER_LINEAR_EXACT);
/*Text Detection*/ /*Text Detection*/
cvtColor(frame,gray,COLOR_BGR2GRAY); cvtColor(frame,gray,COLOR_BGR2GRAY);

@ -603,7 +603,7 @@ void OCRBeamSearchClassifierCNN::eval( InputArray _src, vector< vector<double> >
cvtColor(src,src,COLOR_RGB2GRAY); 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; int seg_points = 0;

@ -779,14 +779,14 @@ void OCRHMMClassifierKNN::eval( InputArray _mask, vector<int>& out_class, vector
{ {
int height = image_width*tmp.rows/tmp.cols; int height = image_width*tmp.rows/tmp.cols;
if(height == 0) height = 1; 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))); tmp.copyTo(mask(Rect(0,(image_height-height)/2,image_width,height)));
} }
else else
{ {
int width = image_height*tmp.cols/tmp.rows; int width = image_height*tmp.cols/tmp.rows;
if(width == 0) width = 1; 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))); tmp.copyTo(mask(Rect((image_width-width)/2,0,width,image_height)));
} }
@ -837,7 +837,7 @@ void OCRHMMClassifierKNN::eval( InputArray _mask, vector<int>& out_class, vector
copyMakeBorder(maps[i],maps[i],7,7,7,7,BORDER_CONSTANT,Scalar(0)); copyMakeBorder(maps[i],maps[i],7,7,7,7,BORDER_CONSTANT,Scalar(0));
GaussianBlur(maps[i], maps[i], Size(7,7), 2, 2); GaussianBlur(maps[i], maps[i], Size(7,7), 2, 2);
normalize(maps[i],maps[i],0,255,NORM_MINMAX); 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 //Generate features for each bitmap
@ -1032,7 +1032,7 @@ void OCRHMMClassifierCNN::eval( InputArray _src, vector<int>& out_class, vector<
} }
// shall we resize the input image or make a copy ? // 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 quad;
Mat tmp; Mat tmp;

@ -85,7 +85,7 @@ protected:
{ {
CV_Assert(image.channels() == 1 && image.depth() == CV_8U); CV_Assert(image.channels() == 1 && image.depth() == CV_8U);
Mat resized; Mat resized;
resize(image, resized, getPerceptiveField()); resize(image, resized, getPerceptiveField(), 0, 0, INTER_LINEAR_EXACT);
Mat blob = dnn::blobFromImage(resized); Mat blob = dnn::blobFromImage(resized);
net.setInput(blob, "data"); net.setInput(blob, "data");
Mat prob = net.forward("prob"); Mat prob = net.forward("prob");

@ -145,8 +145,8 @@ bool TrackerGOTURNImpl::updateImpl(const Mat& image, Rect2d& boundingBox)
//Preprocess //Preprocess
//Resize //Resize
resize(targetPatch, targetPatch, 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)); resize(searchPatch, searchPatch, Size(INPUT_SIZE, INPUT_SIZE), 0, 0, INTER_LINEAR_EXACT);
//Mean Subtract //Mean Subtract
targetPatch = targetPatch - 128; targetPatch = targetPatch - 128;

@ -56,7 +56,7 @@ namespace cv
const int MAX_EXAMPLES_IN_MODEL = 500; const int MAX_EXAMPLES_IN_MODEL = 500;
const int MEASURES_PER_CLASSIFIER = 13; const int MEASURES_PER_CLASSIFIER = 13;
const int GRIDSIZE = 15; 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 THETA_NN = 0.5;
const double CORE_THRESHOLD = 0.5; const double CORE_THRESHOLD = 0.5;
const double CLASSIFIER_MARGIN = 0.1; const double CLASSIFIER_MARGIN = 0.1;

@ -114,7 +114,7 @@ namespace cv
#ifdef BLUR_AS_VADIM #ifdef BLUR_AS_VADIM
GaussianBlur(standardPatch, blurredPatch, GaussBlurKernelSize, 0.0); GaussianBlur(standardPatch, blurredPatch, GaussBlurKernelSize, 0.0);
resize(blurredPatch, blurredPatch, minSize); resize(blurredPatch, blurredPatch, minSize, 0, 0, INTER_LINEAR_EXACT);
#else #else
resample(blurredImg, RotatedRect(center, size, angle), blurredPatch); resample(blurredImg, RotatedRect(center, size, angle), blurredPatch);
#endif #endif

@ -287,7 +287,7 @@ int TrackerTLDImpl::Pexpert::additionalExamples(std::vector<Mat_<uchar> >& examp
#if defined BLUR_AS_VADIM #if defined BLUR_AS_VADIM
GaussianBlur(standardPatch, blurredPatch, GaussBlurKernelSize, 0.0); GaussianBlur(standardPatch, blurredPatch, GaussBlurKernelSize, 0.0);
resize(blurredPatch, blurredPatch, initSize_); resize(blurredPatch, blurredPatch, initSize_, 0, 0, INTER_LINEAR_EXACT);
#else #else
resample(blurredImg, RotatedRect(center, size, angle), blurredPatch); resample(blurredImg, RotatedRect(center, size, angle), blurredPatch);
#endif #endif

@ -103,7 +103,7 @@ double scaleAndBlur(const Mat& originalImg, int scale, Mat& scaledImg, Mat& blur
for( int i = 0; i < scale; i++, dScale *= scaleStep ); for( int i = 0; i < scale; i++, dScale *= scaleStep );
Size2d size = originalImg.size(); Size2d size = originalImg.size();
size.height /= dScale; size.width /= dScale; 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); GaussianBlur(scaledImg, blurredImg, GaussBlurKernelSize, 0.0);
return dScale; return dScale;
} }

@ -306,7 +306,7 @@ namespace cv{
CV_Assert(img.channels() == 1 || img.channels() == 3); CV_Assert(img.channels() == 1 || img.channels() == 3);
// resize the image whenever needed // 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 // detection part
if(frame>0){ if(frame>0){

@ -197,7 +197,8 @@ static const float SIFT_DESCR_MAG_THR = 0.2f;
// factor used to convert floating-point descriptor to unsigned char // factor used to convert floating-point descriptor to unsigned char
static const float SIFT_INT_DESCR_FCTR = 512.f; 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 // intermediate type used for DoG pyramids
typedef short sift_wt; typedef short sift_wt;
static const int SIFT_FIXPT_SCALE = 48; 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) ); sig_diff = sqrtf( std::max(sigma * sigma - SIFT_INIT_SIGMA * SIFT_INIT_SIGMA * 4, 0.01f) );
Mat dbl; 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); 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); GaussianBlur(dbl, dbl, Size(), sig_diff, sig_diff);
return dbl; return dbl;
} }

@ -438,7 +438,7 @@ protected:
{ {
float scale = 1.f + scaleIdx * 0.5f; float scale = 1.f + scaleIdx * 0.5f;
Mat image1; Mat image1;
resize(image0, image1, Size(), 1./scale, 1./scale); resize(image0, image1, Size(), 1./scale, 1./scale, INTER_LINEAR_EXACT);
vector<KeyPoint> keypoints1, osiKeypoints1; // osi - original size image vector<KeyPoint> keypoints1, osiKeypoints1; // osi - original size image
featureDetector->detect(image1, keypoints1); featureDetector->detect(image1, keypoints1);
@ -563,7 +563,7 @@ protected:
float scale = 1.f + scaleIdx * 0.5f; float scale = 1.f + scaleIdx * 0.5f;
Mat image1; Mat image1;
resize(image0, image1, Size(), 1./scale, 1./scale); resize(image0, image1, Size(), 1./scale, 1./scale, INTER_LINEAR_EXACT);
vector<KeyPoint> keypoints1; vector<KeyPoint> keypoints1;
scaleKeyPoints(keypoints0, keypoints1, 1.0f/scale); scaleKeyPoints(keypoints0, keypoints1, 1.0f/scale);

@ -75,9 +75,9 @@ PERF_TEST_P( DisparityWLSFilterPerfTest, perf, Combine(GuideTypes::all(), SrcTyp
MakeArtificialExample(rng,guide,disp_left,disp_right,ROI); MakeArtificialExample(rng,guide,disp_left,disp_right,ROI);
if(use_downscale) 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; 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; disp_right/=2;
ROI = Rect(ROI.x/2,ROI.y/2,ROI.width/2,ROI.height/2); ROI = Rect(ROI.x/2,ROI.y/2,ROI.width/2,ROI.height/2);
} }

@ -135,8 +135,8 @@ int main(int argc, char** argv)
max_disp/=2; max_disp/=2;
if(max_disp%16!=0) if(max_disp%16!=0)
max_disp += 16-(max_disp%16); max_disp += 16-(max_disp%16);
resize(left ,left_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); resize(right,right_for_matcher,Size(),0.5,0.5, INTER_LINEAR_EXACT);
//! [downscale] //! [downscale]
} }
else else
@ -196,7 +196,7 @@ int main(int argc, char** argv)
if(!no_downscale) if(!no_downscale)
{ {
// upscale raw disparity and ROI back for a proper comparison: // 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; left_disp = left_disp*2.0;
ROI = Rect(ROI.x*2,ROI.y*2,ROI.width*2,ROI.height*2); ROI = Rect(ROI.x*2,ROI.y*2,ROI.width*2,ROI.height*2);
} }

@ -233,7 +233,7 @@ static void rescale(Mat const &src, Mat &dst,
{ {
double scale = min(min(static_cast<double>(maxWidth) / src.cols, double scale = min(min(static_cast<double>(maxWidth) / src.cols,
static_cast<double>(maxHeight) / src.rows), 1.0); static_cast<double>(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) static void showHumanReadableImg(string const &name, Mat const &img)

@ -87,7 +87,7 @@ int main( int argc, const char** argv)
if( frame.rows <= rows0 ) if( frame.rows <= rows0 )
src = frame; src = frame;
else 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(); float t = (float)getTickCount();
ximgproc::anisotropicDiffusion(src, dst, alpha, sigma, niters); ximgproc::anisotropicDiffusion(src, dst, alpha, sigma, niters);

@ -11,7 +11,7 @@ using namespace cv;
int main() int main()
{ {
Mat img = imread("opencv-logo.png", IMREAD_COLOR); 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 /// Threshold the input image
Mat img_grayscale, img_binary; Mat img_grayscale, img_binary;

@ -185,8 +185,8 @@ TEST_P(AdaptiveManifoldRefImplTest, RefImplAccuracy)
//inconsistent downsample/upsample operations in reference implementation //inconsistent downsample/upsample operations in reference implementation
Size dstSize((guide.cols + 15) & ~15, (guide.rows + 15) & ~15); Size dstSize((guide.cols + 15) & ~15, (guide.rows + 15) & ~15);
resize(guide, guide, dstSize); resize(guide, guide, dstSize, 0, 0, INTER_LINEAR_EXACT);
resize(src, src, dstSize); resize(src, src, dstSize, 0, 0, INTER_LINEAR_EXACT);
for (int iter = 0; iter < 4; iter++) for (int iter = 0; iter < 4; iter++)
{ {

@ -818,7 +818,7 @@ namespace
resize(buf.mul, buf.numerator, Size(), 1.0 / df, 1.0 / df); resize(buf.mul, buf.numerator, Size(), 1.0 / df, 1.0 / df);
ensureSizeIsEnough(nsz, buf.denominator); 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.numerator, buf.numerator_filtered, sigma_s / df);
h_filter(buf.denominator, buf.denominator_filtered, sigma_s / df); h_filter(buf.denominator, buf.denominator_filtered, sigma_s / df);

@ -124,8 +124,8 @@ TEST_P(DisparityWLSFilterTest, MultiThreadReproducibility)
if(use_downscale) if(use_downscale)
{ {
resize(left_disp,left_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); 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); ROI = Rect(ROI.x/2,ROI.y/2,ROI.width/2,ROI.height/2);
} }

@ -85,7 +85,7 @@ Mat convertTypeAndSize(Mat src, int dstType, Size dstSize)
} }
dst.convertTo(dst, dstType); dst.convertTo(dst, dstType);
resize(dst, dst, dstSize); resize(dst, dst, dstSize, 0, 0, dstType == CV_32FC1 ? INTER_LINEAR : INTER_LINEAR_EXACT);
return dst; return dst;
} }

@ -99,7 +99,7 @@ static Mat convertTypeAndSize(Mat src, int dstType, Size dstSize)
} }
dst.convertTo(dst, dstType); dst.convertTo(dst, dstType);
resize(dst, dst, dstSize); resize(dst, dst, dstSize, 0, 0, INTER_LINEAR_EXACT);
return dst; return dst;
} }

@ -83,7 +83,7 @@ static Mat convertTypeAndSize(Mat src, int dstType, Size dstSize)
} }
dst.convertTo(dst, dstType); dst.convertTo(dst, dstType);
resize(dst, dst, dstSize); resize(dst, dst, dstSize, 0, 0, INTER_LINEAR_EXACT);
return dst; return dst;
} }

@ -81,7 +81,7 @@ static Mat convertTypeAndSize(Mat src, int dstType, Size dstSize)
} }
dst.convertTo(dst, dstType); dst.convertTo(dst, dstType);
resize(dst, dst, dstSize); resize(dst, dst, dstSize, 0, 0, INTER_LINEAR_EXACT);
return dst; return dst;
} }

@ -130,7 +130,7 @@ void WaldBoost::detect(Ptr<CvFeatureEvaluator> eval,
float h; float h;
for (size_t i = 0; i < scales.size(); ++i) { for (size_t i = 0; i < scales.size(); ++i) {
float scale = scales[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_); eval->setImage(resized_img, 0, 0, feature_indices_);
int n_rows = (int)(24 / scale); int n_rows = (int)(24 / scale);
int n_cols = (int)(24 / scale); int n_cols = (int)(24 / scale);
@ -162,7 +162,7 @@ void WaldBoost::detect(Ptr<CvFeatureEvaluator> eval,
float h; float h;
for (size_t i = 0; i < scales.size(); ++i) { for (size_t i = 0; i < scales.size(); ++i) {
float scale = scales[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_); eval->setImage(resized_img, 0, 0, feature_indices_);
int n_rows = (int)(24 / scale); int n_rows = (int)(24 / scale);
int n_cols = (int)(24 / scale); int n_cols = (int)(24 / scale);

@ -179,7 +179,7 @@ void WBDetectorImpl::train(
win_count = min(win_count, stage_neg - bootstrap_count); win_count = min(win_count, stage_neg - bootstrap_count);
Mat window; Mat window;
for (int k = 0; k < win_count; ++k) { 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()); neg_imgs.push_back(window.clone());
bootstrap_count += 1; bootstrap_count += 1;
} }

@ -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); Mat src_dscl(Size(size.width / 16, size.height / 16), t);
RNG rng(1234); RNG rng(1234);
rng.fill(src_dscl, RNG::UNIFORM, 0, range_max_val); 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<xphoto::LearningBasedWB> wb = xphoto::createLearningBasedWB(); Ptr<xphoto::LearningBasedWB> wb = xphoto::createLearningBasedWB();
wb->setRangeMaxVal(range_max_val); wb->setRangeMaxVal(range_max_val);
wb->setSaturationThreshold(0.98f); wb->setSaturationThreshold(0.98f);

Loading…
Cancel
Save