mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 07:43:03 +04:00
Implementation of bit-exact resize. Internal calls to linear resize updated to use bit-exact version. (#9468)
This commit is contained in:
committed by
Vadim Pisarevsky
parent
84ee4d701a
commit
51cb56ef2c
@@ -347,7 +347,7 @@ int main( int argc, char** argv )
|
||||
remap(view, rview, map1[k1], map2[k1], INTER_LINEAR);
|
||||
}
|
||||
printf("%s %s %s\n", imageList[i*3].c_str(), imageList[i*3+1].c_str(), imageList[i*3+2].c_str());
|
||||
resize( canvas, small_canvas, Size(1500, 1500/3) );
|
||||
resize( canvas, small_canvas, Size(1500, 1500/3), 0, 0, INTER_LINEAR_EXACT );
|
||||
for( k = 0; k < small_canvas.rows; k += 16 )
|
||||
line(small_canvas, Point(0, k), Point(small_canvas.cols, k), Scalar(0,255,0), 1);
|
||||
imshow("rectified", small_canvas);
|
||||
|
||||
@@ -70,7 +70,7 @@ int main(int argc, const char** argv)
|
||||
if( img0.empty() )
|
||||
break;
|
||||
|
||||
resize(img0, img, Size(640, 640*img0.rows/img0.cols), INTER_LINEAR);
|
||||
resize(img0, img, Size(640, 640*img0.rows/img0.cols), 0, 0, INTER_LINEAR_EXACT);
|
||||
|
||||
if( fgimg.empty() )
|
||||
fgimg.create(img.size(), img.type());
|
||||
|
||||
@@ -174,7 +174,7 @@ void detectAndDraw( Mat& img, CascadeClassifier& cascade,
|
||||
|
||||
cvtColor( img, gray, COLOR_BGR2GRAY );
|
||||
double fx = 1 / scale;
|
||||
resize( gray, smallImg, Size(), fx, fx, INTER_LINEAR );
|
||||
resize( gray, smallImg, Size(), fx, fx, INTER_LINEAR_EXACT );
|
||||
equalizeHist( smallImg, smallImg );
|
||||
|
||||
t = (double)getTickCount();
|
||||
|
||||
@@ -232,7 +232,7 @@ int main (const int argc, const char * argv[])
|
||||
|
||||
}
|
||||
else{ //apply random warp to input image
|
||||
resize(inputImage, target_image, Size(216, 216));
|
||||
resize(inputImage, target_image, Size(216, 216), 0, 0, INTER_LINEAR_EXACT);
|
||||
Mat warpGround;
|
||||
RNG rng(getTickCount());
|
||||
double angle;
|
||||
|
||||
@@ -80,7 +80,7 @@ int main(int argc, char** argv)
|
||||
queryName<<path<<indexQuery<<".png";
|
||||
Mat query=imread(queryName.str(), IMREAD_GRAYSCALE);
|
||||
Mat queryToShow;
|
||||
resize(query, queryToShow, sz2Sh);
|
||||
resize(query, queryToShow, sz2Sh, 0, 0, INTER_LINEAR_EXACT);
|
||||
imshow("QUERY", queryToShow);
|
||||
moveWindow("TEST", 0,0);
|
||||
vector<Point> contQuery = simpleContour(query);
|
||||
@@ -95,7 +95,7 @@ int main(int argc, char** argv)
|
||||
cout<<"name: "<<iiname.str()<<endl;
|
||||
Mat iiIm=imread(iiname.str(), 0);
|
||||
Mat iiToShow;
|
||||
resize(iiIm, iiToShow, sz2Sh);
|
||||
resize(iiIm, iiToShow, sz2Sh, 0, 0, INTER_LINEAR_EXACT);
|
||||
imshow("TEST", iiToShow);
|
||||
moveWindow("TEST", sz2Sh.width+50,0);
|
||||
vector<Point> contii = simpleContour(iiIm);
|
||||
@@ -112,7 +112,7 @@ int main(int argc, char** argv)
|
||||
bestname<<path<<bestMatch<<".png";
|
||||
Mat iiIm=imread(bestname.str(), 0);
|
||||
Mat bestToShow;
|
||||
resize(iiIm, bestToShow, sz2Sh);
|
||||
resize(iiIm, bestToShow, sz2Sh, 0, 0, INTER_LINEAR_EXACT);
|
||||
imshow("BEST MATCH", bestToShow);
|
||||
moveWindow("BEST MATCH", sz2Sh.width+50,0);
|
||||
waitKey();
|
||||
|
||||
@@ -135,7 +135,7 @@ void detectAndDraw( Mat& img, CascadeClassifier& cascade,
|
||||
cvtColor( img, gray, COLOR_BGR2GRAY );
|
||||
|
||||
double fx = 1 / scale;
|
||||
resize( gray, smallImg, Size(), fx, fx, INTER_LINEAR );
|
||||
resize( gray, smallImg, Size(), fx, fx, INTER_LINEAR_EXACT );
|
||||
equalizeHist( smallImg, smallImg );
|
||||
|
||||
cascade.detectMultiScale( smallImg, faces,
|
||||
|
||||
@@ -100,7 +100,7 @@ StereoCalib(const vector<string>& imagelist, Size boardSize, float squareSize, b
|
||||
if( scale == 1 )
|
||||
timg = img;
|
||||
else
|
||||
resize(img, timg, Size(), scale, scale);
|
||||
resize(img, timg, Size(), scale, scale, INTER_LINEAR_EXACT);
|
||||
found = findChessboardCorners(timg, boardSize, corners,
|
||||
CALIB_CB_ADAPTIVE_THRESH | CALIB_CB_NORMALIZE_IMAGE);
|
||||
if( found )
|
||||
@@ -120,7 +120,7 @@ StereoCalib(const vector<string>& imagelist, Size boardSize, float squareSize, b
|
||||
cvtColor(img, cimg, COLOR_GRAY2BGR);
|
||||
drawChessboardCorners(cimg, boardSize, corners, found);
|
||||
double sf = 640./MAX(img.rows, img.cols);
|
||||
resize(cimg, cimg1, Size(), sf, sf);
|
||||
resize(cimg, cimg1, Size(), sf, sf, INTER_LINEAR_EXACT);
|
||||
imshow("corners", cimg1);
|
||||
char c = (char)waitKey(500);
|
||||
if( c == 27 || c == 'q' || c == 'Q' ) //Allow ESC to quit
|
||||
|
||||
@@ -465,7 +465,7 @@ int main(int argc, char* argv[])
|
||||
work_scale = min(1.0, sqrt(work_megapix * 1e6 / full_img.size().area()));
|
||||
is_work_scale_set = true;
|
||||
}
|
||||
resize(full_img, img, Size(), work_scale, work_scale);
|
||||
resize(full_img, img, Size(), work_scale, work_scale, INTER_LINEAR_EXACT);
|
||||
}
|
||||
if (!is_seam_scale_set)
|
||||
{
|
||||
@@ -478,7 +478,7 @@ int main(int argc, char* argv[])
|
||||
features[i].img_idx = i;
|
||||
LOGLN("Features in image #" << i+1 << ": " << features[i].keypoints.size());
|
||||
|
||||
resize(full_img, img, Size(), seam_scale, seam_scale);
|
||||
resize(full_img, img, Size(), seam_scale, seam_scale, INTER_LINEAR_EXACT);
|
||||
images[i] = img.clone();
|
||||
}
|
||||
|
||||
@@ -805,7 +805,7 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
}
|
||||
if (abs(compose_scale - 1) > 1e-1)
|
||||
resize(full_img, img, Size(), compose_scale, compose_scale);
|
||||
resize(full_img, img, Size(), compose_scale, compose_scale, INTER_LINEAR_EXACT);
|
||||
else
|
||||
img = full_img;
|
||||
full_img.release();
|
||||
@@ -831,7 +831,7 @@ int main(int argc, char* argv[])
|
||||
mask.release();
|
||||
|
||||
dilate(masks_warped[img_idx], dilated_mask, Mat());
|
||||
resize(dilated_mask, seam_mask, mask_warped.size());
|
||||
resize(dilated_mask, seam_mask, mask_warped.size(), 0, 0, INTER_LINEAR_EXACT);
|
||||
mask_warped = seam_mask & mask_warped;
|
||||
|
||||
if (!blender && !timelapse)
|
||||
|
||||
@@ -344,7 +344,7 @@ int main( int argc, char** argv )
|
||||
for ( size_t j = 0; j < detections.size(); j++ )
|
||||
{
|
||||
Mat detection = full_neg_lst[i]( detections[j] ).clone();
|
||||
resize( detection, detection, pos_image_size );
|
||||
resize( detection, detection, pos_image_size, 0, 0, INTER_LINEAR_EXACT);
|
||||
neg_lst.push_back( detection );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user