\r
int main(int argc, char* argv[])\r
{\r
+ int64 app_start_time = getTickCount();\r
cv::setBreakOnError(true);\r
\r
vector<string> img_names;\r
}\r
}\r
\r
+ int64 t = getTickCount();\r
+ LOGLN("Parsing params and reading images...");\r
for (int i = 1; i < argc; ++i)\r
{\r
if (string(argv[i]) == "--trygpu")\r
}\r
}\r
}\r
+ LOGLN("Parsing params and reading images, time: " << ((getTickCount() - t) / getTickFrequency()) << " sec");\r
\r
int num_images = static_cast<int>(images.size());\r
if (num_images < 2)\r
return -1;\r
}\r
\r
+ t = getTickCount();\r
LOGLN("Finding features...");\r
vector<ImageFeatures> features;\r
SurfFeaturesFinder finder(trygpu);\r
finder(images, features);\r
+ LOGLN("Finding features, time: " << ((getTickCount() - t) / getTickFrequency()) << " sec");\r
\r
- LOGLN("Pairwise matching...");\r
+ t = getTickCount();\r
+ LOGLN("Pairwise matching... ");\r
vector<MatchesInfo> pairwise_matches;\r
BestOf2NearestMatcher matcher(trygpu);\r
if (user_match_conf)\r
matcher = BestOf2NearestMatcher(trygpu, match_conf);\r
matcher(images, features, pairwise_matches);\r
+ LOGLN("Pairwise matching, time: " << ((getTickCount() - t) / getTickFrequency()) << " sec");\r
\r
vector<int> indices = leaveBiggestComponent(images, features, pairwise_matches, conf_thresh);\r
vector<string> img_names_subset;\r
return -1;\r
}\r
\r
+ t = getTickCount();\r
LOGLN("Estimating rotations...");\r
HomographyBasedEstimator estimator;\r
vector<CameraParams> cameras;\r
estimator(images, features, pairwise_matches, cameras);\r
+ LOGLN("Estimating rotations, time: " << ((getTickCount() - t) / getTickFrequency()) << " sec");\r
\r
for (size_t i = 0; i < cameras.size(); ++i)\r
{\r
LOGLN("Initial focal length " << i << ": " << cameras[i].focal);\r
}\r
\r
- LOGLN("Bundle adjustment...");\r
+ t = getTickCount();\r
+ LOGLN("Bundle adjustment... ");\r
BundleAdjuster adjuster(ba_space, conf_thresh);\r
adjuster(images, features, pairwise_matches, cameras);\r
+ LOGLN("Bundle adjustment, time: " << ((getTickCount() - t) / getTickFrequency()) << " sec");\r
\r
if (wave_correct)\r
{\r
+ t = getTickCount();\r
LOGLN("Wave correcting...");\r
vector<Mat> rmats;\r
for (size_t i = 0; i < cameras.size(); ++i)\r
waveCorrect(rmats);\r
for (size_t i = 0; i < cameras.size(); ++i)\r
cameras[i].R = rmats[i];\r
+ LOGLN("Wave correcting, time: " << ((getTickCount() - t) / getTickFrequency()) << " sec");\r
}\r
\r
// Find median focal length\r
if ((work_megapix > 0 || compose_megapix > 0) \r
&& abs(work_megapix - compose_megapix) > 1e-3)\r
{\r
+ t = getTickCount();\r
+ LOGLN("Compose scaling...");\r
for (int i = 0; i < num_images; ++i)\r
{\r
Mat full_img = imread(img_names[i]);\r
cameras[i].focal *= compose_scale / work_scale;\r
}\r
camera_focal *= static_cast<float>(compose_scale / work_scale);\r
+ LOGLN("Compose scaling, time: " << ((getTickCount() - t) / getTickFrequency()) << " sec");\r
}\r
\r
vector<Mat> masks(num_images);\r
vector<Mat> masks_warped(num_images);\r
vector<Mat> images_warped(num_images);\r
\r
- LOGLN("Warping images...");\r
+ t = getTickCount();\r
+ LOGLN("Warping images... ");\r
Ptr<Warper> warper = Warper::createByCameraFocal(camera_focal, warp_type);\r
for (int i = 0; i < num_images; ++i)\r
{\r
vector<Mat> images_f(num_images);\r
for (int i = 0; i < num_images; ++i)\r
images_warped[i].convertTo(images_f[i], CV_32F);\r
+ LOGLN("Warping images, time: " << ((getTickCount() - t) / getTickFrequency()) << " sec");\r
\r
+ t = getTickCount();\r
LOGLN("Finding seams...");\r
Ptr<SeamFinder> seam_finder = SeamFinder::createDefault(seam_find_type);\r
(*seam_finder)(images_f, corners, masks_warped);\r
+ LOGLN("Finding seams, time: " << ((getTickCount() - t) / getTickFrequency()) << " sec");\r
\r
+ t = getTickCount();\r
LOGLN("Blending images...");\r
Mat result, result_mask;\r
Ptr<Blender> blender = Blender::createDefault(blend_type);\r
(*blender)(images_f, corners, masks_warped, result, result_mask);\r
+ LOGLN("Blending images, time: " << ((getTickCount() - t) / getTickFrequency()) << " sec");\r
\r
imwrite(result_name, result);\r
\r
- LOGLN("Finished");\r
+ LOGLN("Finished, total time: " << ((getTickCount() - app_start_time) / getTickFrequency()) << " sec");\r
return 0;\r
}\r
\r