|
|
|
@ -74,8 +74,10 @@ void printUsage() |
|
|
|
|
"\nMotion Estimation Flags:\n" |
|
|
|
|
" --work_megapix <float>\n" |
|
|
|
|
" Resolution for image registration step. The default is 0.6 Mpx.\n" |
|
|
|
|
" --features (surf|orb)\n" |
|
|
|
|
" Type of features used for images matching. The default is surf.\n" |
|
|
|
|
" --match_conf <float>\n" |
|
|
|
|
" Confidence for feature matching step. The default is 0.65.\n" |
|
|
|
|
" Confidence for feature matching step. The default is 0.65 for surf and 0.3 for orb.\n" |
|
|
|
|
" --conf_thresh <float>\n" |
|
|
|
|
" Threshold for two images are from the same panorama confidence.\n" |
|
|
|
|
" The default is 1.0.\n" |
|
|
|
@ -123,6 +125,7 @@ double work_megapix = 0.6; |
|
|
|
|
double seam_megapix = 0.1; |
|
|
|
|
double compose_megapix = -1; |
|
|
|
|
float conf_thresh = 1.f; |
|
|
|
|
string features = "surf"; |
|
|
|
|
string ba_cost_func = "ray"; |
|
|
|
|
string ba_refine_mask = "xxxxx"; |
|
|
|
|
bool do_wave_correct = true; |
|
|
|
@ -188,6 +191,13 @@ int parseCmdArgs(int argc, char** argv) |
|
|
|
|
result_name = argv[i + 1]; |
|
|
|
|
i++; |
|
|
|
|
} |
|
|
|
|
else if (string(argv[i]) == "--features") |
|
|
|
|
{ |
|
|
|
|
features = argv[i + 1]; |
|
|
|
|
if (features == "orb") |
|
|
|
|
match_conf = 0.3f; |
|
|
|
|
i++; |
|
|
|
|
} |
|
|
|
|
else if (string(argv[i]) == "--match_conf") |
|
|
|
|
{ |
|
|
|
|
match_conf = static_cast<float>(atof(argv[i + 1])); |
|
|
|
@ -334,12 +344,24 @@ int main(int argc, char* argv[]) |
|
|
|
|
int64 t = getTickCount(); |
|
|
|
|
|
|
|
|
|
Ptr<FeaturesFinder> finder; |
|
|
|
|
if (features == "surf") |
|
|
|
|
{ |
|
|
|
|
#ifndef ANDROID |
|
|
|
|
if (try_gpu && gpu::getCudaEnabledDeviceCount() > 0) |
|
|
|
|
finder = new SurfFeaturesFinderGpu(); |
|
|
|
|
else |
|
|
|
|
if (try_gpu && gpu::getCudaEnabledDeviceCount() > 0) |
|
|
|
|
finder = new SurfFeaturesFinderGpu(); |
|
|
|
|
else |
|
|
|
|
#endif |
|
|
|
|
finder = new SurfFeaturesFinder(); |
|
|
|
|
finder = new SurfFeaturesFinder(); |
|
|
|
|
} |
|
|
|
|
else if (features == "orb") |
|
|
|
|
{ |
|
|
|
|
finder = new OrbFeaturesFinder(); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
cout << "Unknown 2D features type: '" << features << "'.\n"; |
|
|
|
|
return -1; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Mat full_img, img; |
|
|
|
|
vector<ImageFeatures> features(num_images); |
|
|
|
@ -548,27 +570,27 @@ int main(int argc, char* argv[]) |
|
|
|
|
compensator->feed(corners, images_warped, masks_warped); |
|
|
|
|
|
|
|
|
|
Ptr<SeamFinder> seam_finder; |
|
|
|
|
if (seam_find_type == "no") |
|
|
|
|
seam_finder = new detail::NoSeamFinder(); |
|
|
|
|
else if (seam_find_type == "voronoi") |
|
|
|
|
seam_finder = new detail::VoronoiSeamFinder(); |
|
|
|
|
else if (seam_find_type == "gc_color") |
|
|
|
|
{ |
|
|
|
|
#ifndef ANDROID |
|
|
|
|
if (try_gpu && gpu::getCudaEnabledDeviceCount() > 0) |
|
|
|
|
seam_finder = new detail::GraphCutSeamFinderGpu(GraphCutSeamFinderBase::COST_COLOR); |
|
|
|
|
else |
|
|
|
|
#endif |
|
|
|
|
seam_finder = new detail::GraphCutSeamFinder(GraphCutSeamFinderBase::COST_COLOR); |
|
|
|
|
} |
|
|
|
|
else if (seam_find_type == "gc_colorgrad") |
|
|
|
|
{ |
|
|
|
|
#ifndef ANDROID |
|
|
|
|
if (try_gpu && gpu::getCudaEnabledDeviceCount() > 0) |
|
|
|
|
seam_finder = new detail::GraphCutSeamFinderGpu(GraphCutSeamFinderBase::COST_COLOR_GRAD); |
|
|
|
|
else |
|
|
|
|
#endif |
|
|
|
|
seam_finder = new detail::GraphCutSeamFinder(GraphCutSeamFinderBase::COST_COLOR_GRAD); |
|
|
|
|
if (seam_find_type == "no") |
|
|
|
|
seam_finder = new detail::NoSeamFinder(); |
|
|
|
|
else if (seam_find_type == "voronoi") |
|
|
|
|
seam_finder = new detail::VoronoiSeamFinder(); |
|
|
|
|
else if (seam_find_type == "gc_color") |
|
|
|
|
{ |
|
|
|
|
#ifndef ANDROID |
|
|
|
|
if (try_gpu && gpu::getCudaEnabledDeviceCount() > 0) |
|
|
|
|
seam_finder = new detail::GraphCutSeamFinderGpu(GraphCutSeamFinderBase::COST_COLOR); |
|
|
|
|
else |
|
|
|
|
#endif |
|
|
|
|
seam_finder = new detail::GraphCutSeamFinder(GraphCutSeamFinderBase::COST_COLOR); |
|
|
|
|
} |
|
|
|
|
else if (seam_find_type == "gc_colorgrad") |
|
|
|
|
{ |
|
|
|
|
#ifndef ANDROID |
|
|
|
|
if (try_gpu && gpu::getCudaEnabledDeviceCount() > 0) |
|
|
|
|
seam_finder = new detail::GraphCutSeamFinderGpu(GraphCutSeamFinderBase::COST_COLOR_GRAD); |
|
|
|
|
else |
|
|
|
|
#endif |
|
|
|
|
seam_finder = new detail::GraphCutSeamFinder(GraphCutSeamFinderBase::COST_COLOR_GRAD); |
|
|
|
|
} |
|
|
|
|
if (seam_finder.empty()) |
|
|
|
|
{ |
|
|
|
|