Open Source Computer Vision Library https://opencv.org/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

204 lines
6.4 KiB

12 years ago
#include "perf_precomp.hpp"
#include "opencv2/imgcodecs.hpp"
12 years ago
#include "opencv2/opencv_modules.hpp"
#include "opencv2/core/ocl.hpp"
namespace opencv_test
{
12 years ago
using namespace perf;
#define SURF_MATCH_CONFIDENCE 0.65f
#define ORB_MATCH_CONFIDENCE 0.3f
#define WORK_MEGAPIX 0.6
typedef TestBaseWithParam<string> stitch;
typedef TestBaseWithParam<int> stitchExposureCompensation;
Merge pull request #6933 from hrnr:gsoc_all [GSOC] New camera model for stitching pipeline * implement estimateAffine2D estimates affine transformation using robust RANSAC method. * uses RANSAC framework in calib3d * includes accuracy test * uses SVD decomposition for solving 3 point equation * implement estimateAffinePartial2D estimates limited affine transformation * includes accuracy test * stitching: add affine matcher initial version of matcher that estimates affine transformation * stitching: added affine transform estimator initial version of estimator that simply chain transformations in homogeneous coordinates * calib3d: rename estimateAffine3D test test Calib3d_EstimateAffineTransform rename to Calib3d_EstimateAffine3D. This is more descriptive and prevents confusion with estimateAffine2D tests. * added perf test for estimateAffine functions tests both estimateAffine2D and estimateAffinePartial2D * calib3d: compare error in square in estimateAffine2D * incorporates fix from #6768 * rerun affine estimation on inliers * stitching: new API for parallel feature finding due to ABI breakage new functionality is added to `FeaturesFinder2`, `SurfFeaturesFinder2` and `OrbFeaturesFinder2` * stitching: add tests for parallel feature find API * perf test (about linear speed up) * accuracy test compares results with serial version * stitching: use dynamic_cast to overcome ABI issues adding parallel API to FeaturesFinder breaks ABI. This commit uses dynamic_cast and hardcodes thread-safe finders to avoid breaking ABI. This should be replaced by proper method similar to FeaturesMatcher on next ABI break. * use estimateAffinePartial2D in AffineBestOf2NearestMatcher * add constructor to AffineBestOf2NearestMatcher * allows to choose between full affine transform and partial affine transform. Other params are the as for BestOf2NearestMatcher * added protected field * samples: stitching_detailed support affine estimator and matcher * added new flags to choose matcher and estimator * stitching: rework affine matcher represent transformation in homogeneous coordinates affine matcher: remove duplicite code rework flow to get rid of duplicite code affine matcher: do not center points to (0, 0) it is not needed for affine model. it should not affect estimation in any way. affine matcher: remove unneeded cv namespacing * stitching: add stub bundle adjuster * adds stub bundle adjuster that does nothing * can be used in place of standard bundle adjusters to omit bundle adjusting step * samples: stitching detailed, support no budle adjust * uses new NoBundleAdjuster * added affine warper * uses R to get whole affine transformation and propagates rotation and translation to plane warper * add affine warper factory class * affine warper: compensate transformation * samples: stitching_detailed add support for affine warper * add Stitcher::create method this method follows similar constructor methods and returns smart pointer. This allows constructing Stitcher according to OpenCV guidelines. * supports multiple stitcher configurations (PANORAMA and SCANS) for convenient setup * returns cv::Ptr * stitcher: dynamicaly determine correct estimator we need to use affine estimator for affine matcher * preserves ABI (but add hints for ABI 4) * uses dynamic_cast hack to inject correct estimator * sample stitching: add support for multiple modes shows how to use different configurations of stitcher easily (panorama stitching and scans affine model) * stitcher: find features in parallel use new FeatureFinder API to find features in parallel. Parallelized using TBB. * stitching: disable parallel feature finding for OCL it does not bring much speedup to run features finder in parallel when OpenCL is enabled, because finder needs to wait for OCL device. Also, currently ORB is not thread-safe when OCL is enabled. * stitching: move matcher tests move matchers tests perf_stich.cpp -> perf_matchers.cpp * stitching: add affine stiching integration test test basic affine stitching (SCANS mode of stitcher) with images that have only translation between them * enable surf for stitching tests stitching.b12 test was failing with surf investigated the issue, surf is producing good result. Transformation is only slightly different from ORB, so that resulting pano does not exactly match ORB's result. That caused sanity check to fail. * added size checks similar to other tests * sanity check will be applied only for ORB * stitching: fix wrong estimator choice if case was exactly wrong, estimators were chosen wrong added logging for estimated transformation * enable surf for matchers stitching tests * enable SURF * rework sanity checking. Check estimated transform instead of matches. Est. transform should be more stable and comparable between SURF and ORB. * remove regression checking for VectorFeatures tests. It has a lot if data andtest is the same as previous except it test different vector size for performance, so sanity checking does not add any value here. Added basic sanity asserts instead. * stitching tests: allow relative error for transform * allows .01 relative error for estimated homography sanity check in stitching matchers tests * fix VS warning stitching tests: increase relative error increase relative error to make it pass on all platforms (results are still good). stitching test: allow bigger relative error transformation can differ in small values (with small absolute difference, but large relative difference). transformation output still looks usable for all platforms. This difference affects only mac and windows, linux passes fine with small difference. * stitching: add tests for affine matcher uses s1, s2 images. added also new sanity data. * stitching tests: use different data for matchers tests this data should yeild more stable transformation (it has much more matches, especially for surf). Sanity data regenerated. * stitching test: rework tests for matchers * separated rotation and translations as they are different by scale. * use appropriate absolute error for them separately. (relative error does not work for values near zero.) * stitching: fix affine warper compensation calculation of rotation and translation extracted for plane warper was wrong * stitching test: enable surf for opencl integration tests * enable SURF with correct guard (HAVE_OPENCV_XFEATURES2D) * add OPENCL guard and correct namespace as usual for opencl tests * stitching: add ocl accuracy test for affine warper test consistent results with ocl on and off * stitching: add affine warper ocl perf test add affine warper to existing warper perf tests. Added new sanity data. * stitching: do not overwrite inliers in affine matcher * estimation is run second time on inliers only, inliers produces in second run will not be therefore correct for all matches * calib3d: add Levenberg–Marquardt refining to estimateAffine2D* functions this adds affine Levenberg–Marquardt refining to estimateAffine2D functions similar to what is done in findHomography. implements Levenberg–Marquardt refinig for both full affine and partial affine transformations. * stitching: remove reestimation step in affine matcher reestimation step is not needed. estimateAffine2D* functions are running their own reestimation on inliers using the Levenberg-Marquardt algorithm, which is better than simply rerunning RANSAC on inliers. * implement partial affine bundle adjuster bundle adjuster that expect affine transform with 4DOF. Refines parameters for all cameras together. stitching: fix bug in BundleAdjusterAffinePartial * use the invers properly * use static buffer for invers to speed it up * samples: add affine bundle adjuster option to stitching_detailed * add support for using affine bundle adjuster with 4DOF * improve logging of initial intristics * sttiching: add affine bundle adjuster test * fix build warnings * stitching: increase limit on sanity check prevents spurious test failures on mac. values are still pretty fine. * stitching: set affine bundle adjuster for SCANS mode * fix bug with AffineBestOf2NearestMatcher (we want to select affine partial mode) * select right bundle adjuster * stitching: increase error bound for matcher tests * this prevents failure on mac. tranformation is still ok. * stitching: implement affine bundle adjuster * implements affine bundle adjuster that is using full affine transform * existing test case modified to test both affinePartial an full affine bundle adjuster * add stitching tutorial * show basic usage of stitching api (Stitcher class) * stitching: add more integration test for affine stitching * added new datasets to existing testcase * removed unused include * calib3d: move `haveCollinearPoints` to common header * added comment to make that this also checks too close points * calib3d: redone checkSubset for estimateAffine* callback * use common function to check collinearity * this also ensures that point will not be too close to each other * calib3d: change estimateAffine* functions API * more similar to `findHomography`, `findFundamentalMat`, `findEssentialMat` and similar * follows standard recommended semantic INPUTS, OUTPUTS, FLAGS * allows to disable refining * supported LMEDS robust method (tests yet to come) along with RANSAC * extended docs with some tips * calib3d: rewrite estimateAffine2D test * rewrite in googletest style * parametrize to test both robust methods (RANSAC and LMEDS) * get rid of boilerplate * calib3d: rework estimateAffinePartial2D test * rework in googletest style * add testing for LMEDS * calib3d: rework estimateAffine*2D perf test * test for LMEDS speed * test with/without Levenberg-Marquart * remove sanity checking (this is covered by accuracy tests) * calib3d: improve estimateAffine*2D tests * test transformations in loop * improves test by testing more potential transformations * calib3d: rewrite kernels for estimateAffine*2D functions * use analytical solution instead of SVD * this version is faster especially for smaller amount of points * calib3d: tune up perf of estimateAffine*2D functions * avoid copying inliers * avoid converting input points if not necessary * check only `from` point for collinearity, as `to` does not affect stability of transform * tutorials: add commands examples to stitching tutorials * add some examples how to run stitcher sample code * mention stitching_detailed.cpp * calib3d: change computeError for estimateAffine*2D * do error computing in floats instead of doubles this have required precision + we were storing the result in float anyway. This make code faster and allows auto-vectorization by smart compilers. * documentation: mention estimateAffine*2D function * refer to new functions on appropriate places * prefer estimateAffine*2D over estimateRigidTransform * stitching: add camera models documentations * mention camera models in module documentation to give user a better overview and reduce confusion
8 years ago
typedef TestBaseWithParam<tuple<string, string> > stitchDatasets;
12 years ago
Merge pull request #6933 from hrnr:gsoc_all [GSOC] New camera model for stitching pipeline * implement estimateAffine2D estimates affine transformation using robust RANSAC method. * uses RANSAC framework in calib3d * includes accuracy test * uses SVD decomposition for solving 3 point equation * implement estimateAffinePartial2D estimates limited affine transformation * includes accuracy test * stitching: add affine matcher initial version of matcher that estimates affine transformation * stitching: added affine transform estimator initial version of estimator that simply chain transformations in homogeneous coordinates * calib3d: rename estimateAffine3D test test Calib3d_EstimateAffineTransform rename to Calib3d_EstimateAffine3D. This is more descriptive and prevents confusion with estimateAffine2D tests. * added perf test for estimateAffine functions tests both estimateAffine2D and estimateAffinePartial2D * calib3d: compare error in square in estimateAffine2D * incorporates fix from #6768 * rerun affine estimation on inliers * stitching: new API for parallel feature finding due to ABI breakage new functionality is added to `FeaturesFinder2`, `SurfFeaturesFinder2` and `OrbFeaturesFinder2` * stitching: add tests for parallel feature find API * perf test (about linear speed up) * accuracy test compares results with serial version * stitching: use dynamic_cast to overcome ABI issues adding parallel API to FeaturesFinder breaks ABI. This commit uses dynamic_cast and hardcodes thread-safe finders to avoid breaking ABI. This should be replaced by proper method similar to FeaturesMatcher on next ABI break. * use estimateAffinePartial2D in AffineBestOf2NearestMatcher * add constructor to AffineBestOf2NearestMatcher * allows to choose between full affine transform and partial affine transform. Other params are the as for BestOf2NearestMatcher * added protected field * samples: stitching_detailed support affine estimator and matcher * added new flags to choose matcher and estimator * stitching: rework affine matcher represent transformation in homogeneous coordinates affine matcher: remove duplicite code rework flow to get rid of duplicite code affine matcher: do not center points to (0, 0) it is not needed for affine model. it should not affect estimation in any way. affine matcher: remove unneeded cv namespacing * stitching: add stub bundle adjuster * adds stub bundle adjuster that does nothing * can be used in place of standard bundle adjusters to omit bundle adjusting step * samples: stitching detailed, support no budle adjust * uses new NoBundleAdjuster * added affine warper * uses R to get whole affine transformation and propagates rotation and translation to plane warper * add affine warper factory class * affine warper: compensate transformation * samples: stitching_detailed add support for affine warper * add Stitcher::create method this method follows similar constructor methods and returns smart pointer. This allows constructing Stitcher according to OpenCV guidelines. * supports multiple stitcher configurations (PANORAMA and SCANS) for convenient setup * returns cv::Ptr * stitcher: dynamicaly determine correct estimator we need to use affine estimator for affine matcher * preserves ABI (but add hints for ABI 4) * uses dynamic_cast hack to inject correct estimator * sample stitching: add support for multiple modes shows how to use different configurations of stitcher easily (panorama stitching and scans affine model) * stitcher: find features in parallel use new FeatureFinder API to find features in parallel. Parallelized using TBB. * stitching: disable parallel feature finding for OCL it does not bring much speedup to run features finder in parallel when OpenCL is enabled, because finder needs to wait for OCL device. Also, currently ORB is not thread-safe when OCL is enabled. * stitching: move matcher tests move matchers tests perf_stich.cpp -> perf_matchers.cpp * stitching: add affine stiching integration test test basic affine stitching (SCANS mode of stitcher) with images that have only translation between them * enable surf for stitching tests stitching.b12 test was failing with surf investigated the issue, surf is producing good result. Transformation is only slightly different from ORB, so that resulting pano does not exactly match ORB's result. That caused sanity check to fail. * added size checks similar to other tests * sanity check will be applied only for ORB * stitching: fix wrong estimator choice if case was exactly wrong, estimators were chosen wrong added logging for estimated transformation * enable surf for matchers stitching tests * enable SURF * rework sanity checking. Check estimated transform instead of matches. Est. transform should be more stable and comparable between SURF and ORB. * remove regression checking for VectorFeatures tests. It has a lot if data andtest is the same as previous except it test different vector size for performance, so sanity checking does not add any value here. Added basic sanity asserts instead. * stitching tests: allow relative error for transform * allows .01 relative error for estimated homography sanity check in stitching matchers tests * fix VS warning stitching tests: increase relative error increase relative error to make it pass on all platforms (results are still good). stitching test: allow bigger relative error transformation can differ in small values (with small absolute difference, but large relative difference). transformation output still looks usable for all platforms. This difference affects only mac and windows, linux passes fine with small difference. * stitching: add tests for affine matcher uses s1, s2 images. added also new sanity data. * stitching tests: use different data for matchers tests this data should yeild more stable transformation (it has much more matches, especially for surf). Sanity data regenerated. * stitching test: rework tests for matchers * separated rotation and translations as they are different by scale. * use appropriate absolute error for them separately. (relative error does not work for values near zero.) * stitching: fix affine warper compensation calculation of rotation and translation extracted for plane warper was wrong * stitching test: enable surf for opencl integration tests * enable SURF with correct guard (HAVE_OPENCV_XFEATURES2D) * add OPENCL guard and correct namespace as usual for opencl tests * stitching: add ocl accuracy test for affine warper test consistent results with ocl on and off * stitching: add affine warper ocl perf test add affine warper to existing warper perf tests. Added new sanity data. * stitching: do not overwrite inliers in affine matcher * estimation is run second time on inliers only, inliers produces in second run will not be therefore correct for all matches * calib3d: add Levenberg–Marquardt refining to estimateAffine2D* functions this adds affine Levenberg–Marquardt refining to estimateAffine2D functions similar to what is done in findHomography. implements Levenberg–Marquardt refinig for both full affine and partial affine transformations. * stitching: remove reestimation step in affine matcher reestimation step is not needed. estimateAffine2D* functions are running their own reestimation on inliers using the Levenberg-Marquardt algorithm, which is better than simply rerunning RANSAC on inliers. * implement partial affine bundle adjuster bundle adjuster that expect affine transform with 4DOF. Refines parameters for all cameras together. stitching: fix bug in BundleAdjusterAffinePartial * use the invers properly * use static buffer for invers to speed it up * samples: add affine bundle adjuster option to stitching_detailed * add support for using affine bundle adjuster with 4DOF * improve logging of initial intristics * sttiching: add affine bundle adjuster test * fix build warnings * stitching: increase limit on sanity check prevents spurious test failures on mac. values are still pretty fine. * stitching: set affine bundle adjuster for SCANS mode * fix bug with AffineBestOf2NearestMatcher (we want to select affine partial mode) * select right bundle adjuster * stitching: increase error bound for matcher tests * this prevents failure on mac. tranformation is still ok. * stitching: implement affine bundle adjuster * implements affine bundle adjuster that is using full affine transform * existing test case modified to test both affinePartial an full affine bundle adjuster * add stitching tutorial * show basic usage of stitching api (Stitcher class) * stitching: add more integration test for affine stitching * added new datasets to existing testcase * removed unused include * calib3d: move `haveCollinearPoints` to common header * added comment to make that this also checks too close points * calib3d: redone checkSubset for estimateAffine* callback * use common function to check collinearity * this also ensures that point will not be too close to each other * calib3d: change estimateAffine* functions API * more similar to `findHomography`, `findFundamentalMat`, `findEssentialMat` and similar * follows standard recommended semantic INPUTS, OUTPUTS, FLAGS * allows to disable refining * supported LMEDS robust method (tests yet to come) along with RANSAC * extended docs with some tips * calib3d: rewrite estimateAffine2D test * rewrite in googletest style * parametrize to test both robust methods (RANSAC and LMEDS) * get rid of boilerplate * calib3d: rework estimateAffinePartial2D test * rework in googletest style * add testing for LMEDS * calib3d: rework estimateAffine*2D perf test * test for LMEDS speed * test with/without Levenberg-Marquart * remove sanity checking (this is covered by accuracy tests) * calib3d: improve estimateAffine*2D tests * test transformations in loop * improves test by testing more potential transformations * calib3d: rewrite kernels for estimateAffine*2D functions * use analytical solution instead of SVD * this version is faster especially for smaller amount of points * calib3d: tune up perf of estimateAffine*2D functions * avoid copying inliers * avoid converting input points if not necessary * check only `from` point for collinearity, as `to` does not affect stability of transform * tutorials: add commands examples to stitching tutorials * add some examples how to run stitcher sample code * mention stitching_detailed.cpp * calib3d: change computeError for estimateAffine*2D * do error computing in floats instead of doubles this have required precision + we were storing the result in float anyway. This make code faster and allows auto-vectorization by smart compilers. * documentation: mention estimateAffine*2D function * refer to new functions on appropriate places * prefer estimateAffine*2D over estimateRigidTransform * stitching: add camera models documentations * mention camera models in module documentation to give user a better overview and reduce confusion
8 years ago
#ifdef HAVE_OPENCV_XFEATURES2D
Merge pull request #8869 from hrnr:akaze_part1 [GSOC] Speeding-up AKAZE, part #1 (#8869) * ts: expand arguments before stringifications in CV_ENUM and CV_FLAGS added protective macros to always force macro expansion of arguments. This allows using CV_ENUM and CV_FLAGS with macro arguments. * feature2d: unify perf test use the same test for all detectors/descriptors we have. * added AKAZE tests * features2d: extend perf tests * add BRISK, KAZE, MSER * run all extract tests on AKAZE keypoints, so that the test si more comparable for the speed of extraction * feature2d: rework opencl perf tests use the same configuration as cpu tests * feature2d: fix descriptors allocation for AKAZE and KAZE fix crash when descriptors are UMat * feature2d: name enum to fix build with older gcc * Revert "ts: expand arguments before stringifications in CV_ENUM and CV_FLAGS" This reverts commit 19538cac1e45b0cec98190cf06a5ecb07d9b596e. This wasn't a great idea after all. There is a lot of flags implemented as #define, that we don't want to expand. * feature2d: fix expansion problems with CV_ENUM in perf * expand arguments before passing them to CV_ENUM. This does not need modifications of CV_ENUM. * added include guards to `perf_feature2d.hpp` * feature2d: fix crash in AKAZE when using KAZE descriptors * out-of-bound access in Get_MSURF_Descriptor_64 * this happened reliably when running on provided keypoints (not computed by the same instance) * feature2d: added regression tests for AKAZE * test with both MLDB and KAZE keypoints * feature2d: do not compute keypoints orientation twice * always compute keypoints orientation, when computing keypoints * do not recompute keypoint orientation when computing descriptors this allows to test detection and extraction separately * features2d: fix crash in AKAZE * out-of-bound reads near the image edge * same as the bug in KAZE descriptors * feature2d: refactor invariance testing * split detectors and descriptors tests * rewrite to google test to simplify debugging * add tests for AKAZE and one test for ORB * stitching: add tests with AKAZE feature finder * added basic stitching cpu and ocl tests * fix bug in AKAZE wrapper for stitching pipeline causing lots of ! OPENCV warning: getUMat()/getMat() call chain possible problem. ! Base object is dead, while nested/derived object is still alive or processed. ! Please check lifetime of UMat/Mat objects!
8 years ago
#define TEST_DETECTORS testing::Values("surf", "orb", "akaze")
12 years ago
#else
Merge pull request #8869 from hrnr:akaze_part1 [GSOC] Speeding-up AKAZE, part #1 (#8869) * ts: expand arguments before stringifications in CV_ENUM and CV_FLAGS added protective macros to always force macro expansion of arguments. This allows using CV_ENUM and CV_FLAGS with macro arguments. * feature2d: unify perf test use the same test for all detectors/descriptors we have. * added AKAZE tests * features2d: extend perf tests * add BRISK, KAZE, MSER * run all extract tests on AKAZE keypoints, so that the test si more comparable for the speed of extraction * feature2d: rework opencl perf tests use the same configuration as cpu tests * feature2d: fix descriptors allocation for AKAZE and KAZE fix crash when descriptors are UMat * feature2d: name enum to fix build with older gcc * Revert "ts: expand arguments before stringifications in CV_ENUM and CV_FLAGS" This reverts commit 19538cac1e45b0cec98190cf06a5ecb07d9b596e. This wasn't a great idea after all. There is a lot of flags implemented as #define, that we don't want to expand. * feature2d: fix expansion problems with CV_ENUM in perf * expand arguments before passing them to CV_ENUM. This does not need modifications of CV_ENUM. * added include guards to `perf_feature2d.hpp` * feature2d: fix crash in AKAZE when using KAZE descriptors * out-of-bound access in Get_MSURF_Descriptor_64 * this happened reliably when running on provided keypoints (not computed by the same instance) * feature2d: added regression tests for AKAZE * test with both MLDB and KAZE keypoints * feature2d: do not compute keypoints orientation twice * always compute keypoints orientation, when computing keypoints * do not recompute keypoint orientation when computing descriptors this allows to test detection and extraction separately * features2d: fix crash in AKAZE * out-of-bound reads near the image edge * same as the bug in KAZE descriptors * feature2d: refactor invariance testing * split detectors and descriptors tests * rewrite to google test to simplify debugging * add tests for AKAZE and one test for ORB * stitching: add tests with AKAZE feature finder * added basic stitching cpu and ocl tests * fix bug in AKAZE wrapper for stitching pipeline causing lots of ! OPENCV warning: getUMat()/getMat() call chain possible problem. ! Base object is dead, while nested/derived object is still alive or processed. ! Please check lifetime of UMat/Mat objects!
8 years ago
#define TEST_DETECTORS testing::Values("orb", "akaze")
12 years ago
#endif
#define TEST_EXP_COMP_BS testing::Values(32, 16, 12, 10, 8)
Merge pull request #6933 from hrnr:gsoc_all [GSOC] New camera model for stitching pipeline * implement estimateAffine2D estimates affine transformation using robust RANSAC method. * uses RANSAC framework in calib3d * includes accuracy test * uses SVD decomposition for solving 3 point equation * implement estimateAffinePartial2D estimates limited affine transformation * includes accuracy test * stitching: add affine matcher initial version of matcher that estimates affine transformation * stitching: added affine transform estimator initial version of estimator that simply chain transformations in homogeneous coordinates * calib3d: rename estimateAffine3D test test Calib3d_EstimateAffineTransform rename to Calib3d_EstimateAffine3D. This is more descriptive and prevents confusion with estimateAffine2D tests. * added perf test for estimateAffine functions tests both estimateAffine2D and estimateAffinePartial2D * calib3d: compare error in square in estimateAffine2D * incorporates fix from #6768 * rerun affine estimation on inliers * stitching: new API for parallel feature finding due to ABI breakage new functionality is added to `FeaturesFinder2`, `SurfFeaturesFinder2` and `OrbFeaturesFinder2` * stitching: add tests for parallel feature find API * perf test (about linear speed up) * accuracy test compares results with serial version * stitching: use dynamic_cast to overcome ABI issues adding parallel API to FeaturesFinder breaks ABI. This commit uses dynamic_cast and hardcodes thread-safe finders to avoid breaking ABI. This should be replaced by proper method similar to FeaturesMatcher on next ABI break. * use estimateAffinePartial2D in AffineBestOf2NearestMatcher * add constructor to AffineBestOf2NearestMatcher * allows to choose between full affine transform and partial affine transform. Other params are the as for BestOf2NearestMatcher * added protected field * samples: stitching_detailed support affine estimator and matcher * added new flags to choose matcher and estimator * stitching: rework affine matcher represent transformation in homogeneous coordinates affine matcher: remove duplicite code rework flow to get rid of duplicite code affine matcher: do not center points to (0, 0) it is not needed for affine model. it should not affect estimation in any way. affine matcher: remove unneeded cv namespacing * stitching: add stub bundle adjuster * adds stub bundle adjuster that does nothing * can be used in place of standard bundle adjusters to omit bundle adjusting step * samples: stitching detailed, support no budle adjust * uses new NoBundleAdjuster * added affine warper * uses R to get whole affine transformation and propagates rotation and translation to plane warper * add affine warper factory class * affine warper: compensate transformation * samples: stitching_detailed add support for affine warper * add Stitcher::create method this method follows similar constructor methods and returns smart pointer. This allows constructing Stitcher according to OpenCV guidelines. * supports multiple stitcher configurations (PANORAMA and SCANS) for convenient setup * returns cv::Ptr * stitcher: dynamicaly determine correct estimator we need to use affine estimator for affine matcher * preserves ABI (but add hints for ABI 4) * uses dynamic_cast hack to inject correct estimator * sample stitching: add support for multiple modes shows how to use different configurations of stitcher easily (panorama stitching and scans affine model) * stitcher: find features in parallel use new FeatureFinder API to find features in parallel. Parallelized using TBB. * stitching: disable parallel feature finding for OCL it does not bring much speedup to run features finder in parallel when OpenCL is enabled, because finder needs to wait for OCL device. Also, currently ORB is not thread-safe when OCL is enabled. * stitching: move matcher tests move matchers tests perf_stich.cpp -> perf_matchers.cpp * stitching: add affine stiching integration test test basic affine stitching (SCANS mode of stitcher) with images that have only translation between them * enable surf for stitching tests stitching.b12 test was failing with surf investigated the issue, surf is producing good result. Transformation is only slightly different from ORB, so that resulting pano does not exactly match ORB's result. That caused sanity check to fail. * added size checks similar to other tests * sanity check will be applied only for ORB * stitching: fix wrong estimator choice if case was exactly wrong, estimators were chosen wrong added logging for estimated transformation * enable surf for matchers stitching tests * enable SURF * rework sanity checking. Check estimated transform instead of matches. Est. transform should be more stable and comparable between SURF and ORB. * remove regression checking for VectorFeatures tests. It has a lot if data andtest is the same as previous except it test different vector size for performance, so sanity checking does not add any value here. Added basic sanity asserts instead. * stitching tests: allow relative error for transform * allows .01 relative error for estimated homography sanity check in stitching matchers tests * fix VS warning stitching tests: increase relative error increase relative error to make it pass on all platforms (results are still good). stitching test: allow bigger relative error transformation can differ in small values (with small absolute difference, but large relative difference). transformation output still looks usable for all platforms. This difference affects only mac and windows, linux passes fine with small difference. * stitching: add tests for affine matcher uses s1, s2 images. added also new sanity data. * stitching tests: use different data for matchers tests this data should yeild more stable transformation (it has much more matches, especially for surf). Sanity data regenerated. * stitching test: rework tests for matchers * separated rotation and translations as they are different by scale. * use appropriate absolute error for them separately. (relative error does not work for values near zero.) * stitching: fix affine warper compensation calculation of rotation and translation extracted for plane warper was wrong * stitching test: enable surf for opencl integration tests * enable SURF with correct guard (HAVE_OPENCV_XFEATURES2D) * add OPENCL guard and correct namespace as usual for opencl tests * stitching: add ocl accuracy test for affine warper test consistent results with ocl on and off * stitching: add affine warper ocl perf test add affine warper to existing warper perf tests. Added new sanity data. * stitching: do not overwrite inliers in affine matcher * estimation is run second time on inliers only, inliers produces in second run will not be therefore correct for all matches * calib3d: add Levenberg–Marquardt refining to estimateAffine2D* functions this adds affine Levenberg–Marquardt refining to estimateAffine2D functions similar to what is done in findHomography. implements Levenberg–Marquardt refinig for both full affine and partial affine transformations. * stitching: remove reestimation step in affine matcher reestimation step is not needed. estimateAffine2D* functions are running their own reestimation on inliers using the Levenberg-Marquardt algorithm, which is better than simply rerunning RANSAC on inliers. * implement partial affine bundle adjuster bundle adjuster that expect affine transform with 4DOF. Refines parameters for all cameras together. stitching: fix bug in BundleAdjusterAffinePartial * use the invers properly * use static buffer for invers to speed it up * samples: add affine bundle adjuster option to stitching_detailed * add support for using affine bundle adjuster with 4DOF * improve logging of initial intristics * sttiching: add affine bundle adjuster test * fix build warnings * stitching: increase limit on sanity check prevents spurious test failures on mac. values are still pretty fine. * stitching: set affine bundle adjuster for SCANS mode * fix bug with AffineBestOf2NearestMatcher (we want to select affine partial mode) * select right bundle adjuster * stitching: increase error bound for matcher tests * this prevents failure on mac. tranformation is still ok. * stitching: implement affine bundle adjuster * implements affine bundle adjuster that is using full affine transform * existing test case modified to test both affinePartial an full affine bundle adjuster * add stitching tutorial * show basic usage of stitching api (Stitcher class) * stitching: add more integration test for affine stitching * added new datasets to existing testcase * removed unused include * calib3d: move `haveCollinearPoints` to common header * added comment to make that this also checks too close points * calib3d: redone checkSubset for estimateAffine* callback * use common function to check collinearity * this also ensures that point will not be too close to each other * calib3d: change estimateAffine* functions API * more similar to `findHomography`, `findFundamentalMat`, `findEssentialMat` and similar * follows standard recommended semantic INPUTS, OUTPUTS, FLAGS * allows to disable refining * supported LMEDS robust method (tests yet to come) along with RANSAC * extended docs with some tips * calib3d: rewrite estimateAffine2D test * rewrite in googletest style * parametrize to test both robust methods (RANSAC and LMEDS) * get rid of boilerplate * calib3d: rework estimateAffinePartial2D test * rework in googletest style * add testing for LMEDS * calib3d: rework estimateAffine*2D perf test * test for LMEDS speed * test with/without Levenberg-Marquart * remove sanity checking (this is covered by accuracy tests) * calib3d: improve estimateAffine*2D tests * test transformations in loop * improves test by testing more potential transformations * calib3d: rewrite kernels for estimateAffine*2D functions * use analytical solution instead of SVD * this version is faster especially for smaller amount of points * calib3d: tune up perf of estimateAffine*2D functions * avoid copying inliers * avoid converting input points if not necessary * check only `from` point for collinearity, as `to` does not affect stability of transform * tutorials: add commands examples to stitching tutorials * add some examples how to run stitcher sample code * mention stitching_detailed.cpp * calib3d: change computeError for estimateAffine*2D * do error computing in floats instead of doubles this have required precision + we were storing the result in float anyway. This make code faster and allows auto-vectorization by smart compilers. * documentation: mention estimateAffine*2D function * refer to new functions on appropriate places * prefer estimateAffine*2D over estimateRigidTransform * stitching: add camera models documentations * mention camera models in module documentation to give user a better overview and reduce confusion
8 years ago
#define AFFINE_DATASETS testing::Values("s", "budapest", "newspaper", "prague")
12 years ago
PERF_TEST_P(stitch, a123, TEST_DETECTORS)
{
Mat pano;
vector<Mat> imgs;
imgs.push_back( imread( getDataPath("stitching/a1.png") ) );
imgs.push_back( imread( getDataPath("stitching/a2.png") ) );
imgs.push_back( imread( getDataPath("stitching/a3.png") ) );
12 years ago
Merge pull request #8869 from hrnr:akaze_part1 [GSOC] Speeding-up AKAZE, part #1 (#8869) * ts: expand arguments before stringifications in CV_ENUM and CV_FLAGS added protective macros to always force macro expansion of arguments. This allows using CV_ENUM and CV_FLAGS with macro arguments. * feature2d: unify perf test use the same test for all detectors/descriptors we have. * added AKAZE tests * features2d: extend perf tests * add BRISK, KAZE, MSER * run all extract tests on AKAZE keypoints, so that the test si more comparable for the speed of extraction * feature2d: rework opencl perf tests use the same configuration as cpu tests * feature2d: fix descriptors allocation for AKAZE and KAZE fix crash when descriptors are UMat * feature2d: name enum to fix build with older gcc * Revert "ts: expand arguments before stringifications in CV_ENUM and CV_FLAGS" This reverts commit 19538cac1e45b0cec98190cf06a5ecb07d9b596e. This wasn't a great idea after all. There is a lot of flags implemented as #define, that we don't want to expand. * feature2d: fix expansion problems with CV_ENUM in perf * expand arguments before passing them to CV_ENUM. This does not need modifications of CV_ENUM. * added include guards to `perf_feature2d.hpp` * feature2d: fix crash in AKAZE when using KAZE descriptors * out-of-bound access in Get_MSURF_Descriptor_64 * this happened reliably when running on provided keypoints (not computed by the same instance) * feature2d: added regression tests for AKAZE * test with both MLDB and KAZE keypoints * feature2d: do not compute keypoints orientation twice * always compute keypoints orientation, when computing keypoints * do not recompute keypoint orientation when computing descriptors this allows to test detection and extraction separately * features2d: fix crash in AKAZE * out-of-bound reads near the image edge * same as the bug in KAZE descriptors * feature2d: refactor invariance testing * split detectors and descriptors tests * rewrite to google test to simplify debugging * add tests for AKAZE and one test for ORB * stitching: add tests with AKAZE feature finder * added basic stitching cpu and ocl tests * fix bug in AKAZE wrapper for stitching pipeline causing lots of ! OPENCV warning: getUMat()/getMat() call chain possible problem. ! Base object is dead, while nested/derived object is still alive or processed. ! Please check lifetime of UMat/Mat objects!
8 years ago
Ptr<detail::FeaturesFinder> featuresFinder = getFeatureFinder(GetParam());
12 years ago
Ptr<detail::FeaturesMatcher> featuresMatcher = GetParam() == "orb"
? makePtr<detail::BestOf2NearestMatcher>(false, ORB_MATCH_CONFIDENCE)
: makePtr<detail::BestOf2NearestMatcher>(false, SURF_MATCH_CONFIDENCE);
12 years ago
declare.time(30 * 20).iterations(20);
while(next())
{
Stitcher stitcher = Stitcher::createDefault();
stitcher.setFeaturesFinder(featuresFinder);
stitcher.setFeaturesMatcher(featuresMatcher);
stitcher.setWarper(makePtr<SphericalWarper>());
12 years ago
stitcher.setRegistrationResol(WORK_MEGAPIX);
startTimer();
stitcher.stitch(imgs, pano);
stopTimer();
}
EXPECT_NEAR(pano.size().width, 1182, 50);
EXPECT_NEAR(pano.size().height, 682, 30);
SANITY_CHECK_NOTHING();
12 years ago
}
PERF_TEST_P(stitchExposureCompensation, a123, TEST_EXP_COMP_BS)
{
Mat pano;
vector<Mat> imgs;
imgs.push_back( imread( getDataPath("stitching/a1.png") ) );
imgs.push_back( imread( getDataPath("stitching/a2.png") ) );
imgs.push_back( imread( getDataPath("stitching/a3.png") ) );
int bs = GetParam();
declare.time(30 * 10).iterations(10);
while(next())
{
Ptr<Stitcher> stitcher = Stitcher::create();
stitcher->setWarper(makePtr<SphericalWarper>());
stitcher->setRegistrationResol(WORK_MEGAPIX);
stitcher->setExposureCompensator(
makePtr<detail::BlocksGainCompensator>(bs, bs));
startTimer();
stitcher->stitch(imgs, pano);
stopTimer();
}
EXPECT_NEAR(pano.size().width, 1182, 50);
EXPECT_NEAR(pano.size().height, 682, 30);
SANITY_CHECK_NOTHING();
}
12 years ago
PERF_TEST_P(stitch, b12, TEST_DETECTORS)
{
Mat pano;
vector<Mat> imgs;
imgs.push_back( imread( getDataPath("stitching/b1.png") ) );
imgs.push_back( imread( getDataPath("stitching/b2.png") ) );
12 years ago
Merge pull request #8869 from hrnr:akaze_part1 [GSOC] Speeding-up AKAZE, part #1 (#8869) * ts: expand arguments before stringifications in CV_ENUM and CV_FLAGS added protective macros to always force macro expansion of arguments. This allows using CV_ENUM and CV_FLAGS with macro arguments. * feature2d: unify perf test use the same test for all detectors/descriptors we have. * added AKAZE tests * features2d: extend perf tests * add BRISK, KAZE, MSER * run all extract tests on AKAZE keypoints, so that the test si more comparable for the speed of extraction * feature2d: rework opencl perf tests use the same configuration as cpu tests * feature2d: fix descriptors allocation for AKAZE and KAZE fix crash when descriptors are UMat * feature2d: name enum to fix build with older gcc * Revert "ts: expand arguments before stringifications in CV_ENUM and CV_FLAGS" This reverts commit 19538cac1e45b0cec98190cf06a5ecb07d9b596e. This wasn't a great idea after all. There is a lot of flags implemented as #define, that we don't want to expand. * feature2d: fix expansion problems with CV_ENUM in perf * expand arguments before passing them to CV_ENUM. This does not need modifications of CV_ENUM. * added include guards to `perf_feature2d.hpp` * feature2d: fix crash in AKAZE when using KAZE descriptors * out-of-bound access in Get_MSURF_Descriptor_64 * this happened reliably when running on provided keypoints (not computed by the same instance) * feature2d: added regression tests for AKAZE * test with both MLDB and KAZE keypoints * feature2d: do not compute keypoints orientation twice * always compute keypoints orientation, when computing keypoints * do not recompute keypoint orientation when computing descriptors this allows to test detection and extraction separately * features2d: fix crash in AKAZE * out-of-bound reads near the image edge * same as the bug in KAZE descriptors * feature2d: refactor invariance testing * split detectors and descriptors tests * rewrite to google test to simplify debugging * add tests for AKAZE and one test for ORB * stitching: add tests with AKAZE feature finder * added basic stitching cpu and ocl tests * fix bug in AKAZE wrapper for stitching pipeline causing lots of ! OPENCV warning: getUMat()/getMat() call chain possible problem. ! Base object is dead, while nested/derived object is still alive or processed. ! Please check lifetime of UMat/Mat objects!
8 years ago
Ptr<detail::FeaturesFinder> featuresFinder = getFeatureFinder(GetParam());
12 years ago
Ptr<detail::FeaturesMatcher> featuresMatcher = GetParam() == "orb"
? makePtr<detail::BestOf2NearestMatcher>(false, ORB_MATCH_CONFIDENCE)
: makePtr<detail::BestOf2NearestMatcher>(false, SURF_MATCH_CONFIDENCE);
12 years ago
declare.time(30 * 20).iterations(20);
while(next())
{
Stitcher stitcher = Stitcher::createDefault();
stitcher.setFeaturesFinder(featuresFinder);
stitcher.setFeaturesMatcher(featuresMatcher);
stitcher.setWarper(makePtr<SphericalWarper>());
12 years ago
stitcher.setRegistrationResol(WORK_MEGAPIX);
startTimer();
stitcher.stitch(imgs, pano);
stopTimer();
}
EXPECT_NEAR(pano.size().width, 1117, GetParam() == "surf" ? 100 : 50);
EXPECT_NEAR(pano.size().height, 642, GetParam() == "surf" ? 60 : 30);
SANITY_CHECK_NOTHING();
12 years ago
}
Merge pull request #6933 from hrnr:gsoc_all [GSOC] New camera model for stitching pipeline * implement estimateAffine2D estimates affine transformation using robust RANSAC method. * uses RANSAC framework in calib3d * includes accuracy test * uses SVD decomposition for solving 3 point equation * implement estimateAffinePartial2D estimates limited affine transformation * includes accuracy test * stitching: add affine matcher initial version of matcher that estimates affine transformation * stitching: added affine transform estimator initial version of estimator that simply chain transformations in homogeneous coordinates * calib3d: rename estimateAffine3D test test Calib3d_EstimateAffineTransform rename to Calib3d_EstimateAffine3D. This is more descriptive and prevents confusion with estimateAffine2D tests. * added perf test for estimateAffine functions tests both estimateAffine2D and estimateAffinePartial2D * calib3d: compare error in square in estimateAffine2D * incorporates fix from #6768 * rerun affine estimation on inliers * stitching: new API for parallel feature finding due to ABI breakage new functionality is added to `FeaturesFinder2`, `SurfFeaturesFinder2` and `OrbFeaturesFinder2` * stitching: add tests for parallel feature find API * perf test (about linear speed up) * accuracy test compares results with serial version * stitching: use dynamic_cast to overcome ABI issues adding parallel API to FeaturesFinder breaks ABI. This commit uses dynamic_cast and hardcodes thread-safe finders to avoid breaking ABI. This should be replaced by proper method similar to FeaturesMatcher on next ABI break. * use estimateAffinePartial2D in AffineBestOf2NearestMatcher * add constructor to AffineBestOf2NearestMatcher * allows to choose between full affine transform and partial affine transform. Other params are the as for BestOf2NearestMatcher * added protected field * samples: stitching_detailed support affine estimator and matcher * added new flags to choose matcher and estimator * stitching: rework affine matcher represent transformation in homogeneous coordinates affine matcher: remove duplicite code rework flow to get rid of duplicite code affine matcher: do not center points to (0, 0) it is not needed for affine model. it should not affect estimation in any way. affine matcher: remove unneeded cv namespacing * stitching: add stub bundle adjuster * adds stub bundle adjuster that does nothing * can be used in place of standard bundle adjusters to omit bundle adjusting step * samples: stitching detailed, support no budle adjust * uses new NoBundleAdjuster * added affine warper * uses R to get whole affine transformation and propagates rotation and translation to plane warper * add affine warper factory class * affine warper: compensate transformation * samples: stitching_detailed add support for affine warper * add Stitcher::create method this method follows similar constructor methods and returns smart pointer. This allows constructing Stitcher according to OpenCV guidelines. * supports multiple stitcher configurations (PANORAMA and SCANS) for convenient setup * returns cv::Ptr * stitcher: dynamicaly determine correct estimator we need to use affine estimator for affine matcher * preserves ABI (but add hints for ABI 4) * uses dynamic_cast hack to inject correct estimator * sample stitching: add support for multiple modes shows how to use different configurations of stitcher easily (panorama stitching and scans affine model) * stitcher: find features in parallel use new FeatureFinder API to find features in parallel. Parallelized using TBB. * stitching: disable parallel feature finding for OCL it does not bring much speedup to run features finder in parallel when OpenCL is enabled, because finder needs to wait for OCL device. Also, currently ORB is not thread-safe when OCL is enabled. * stitching: move matcher tests move matchers tests perf_stich.cpp -> perf_matchers.cpp * stitching: add affine stiching integration test test basic affine stitching (SCANS mode of stitcher) with images that have only translation between them * enable surf for stitching tests stitching.b12 test was failing with surf investigated the issue, surf is producing good result. Transformation is only slightly different from ORB, so that resulting pano does not exactly match ORB's result. That caused sanity check to fail. * added size checks similar to other tests * sanity check will be applied only for ORB * stitching: fix wrong estimator choice if case was exactly wrong, estimators were chosen wrong added logging for estimated transformation * enable surf for matchers stitching tests * enable SURF * rework sanity checking. Check estimated transform instead of matches. Est. transform should be more stable and comparable between SURF and ORB. * remove regression checking for VectorFeatures tests. It has a lot if data andtest is the same as previous except it test different vector size for performance, so sanity checking does not add any value here. Added basic sanity asserts instead. * stitching tests: allow relative error for transform * allows .01 relative error for estimated homography sanity check in stitching matchers tests * fix VS warning stitching tests: increase relative error increase relative error to make it pass on all platforms (results are still good). stitching test: allow bigger relative error transformation can differ in small values (with small absolute difference, but large relative difference). transformation output still looks usable for all platforms. This difference affects only mac and windows, linux passes fine with small difference. * stitching: add tests for affine matcher uses s1, s2 images. added also new sanity data. * stitching tests: use different data for matchers tests this data should yeild more stable transformation (it has much more matches, especially for surf). Sanity data regenerated. * stitching test: rework tests for matchers * separated rotation and translations as they are different by scale. * use appropriate absolute error for them separately. (relative error does not work for values near zero.) * stitching: fix affine warper compensation calculation of rotation and translation extracted for plane warper was wrong * stitching test: enable surf for opencl integration tests * enable SURF with correct guard (HAVE_OPENCV_XFEATURES2D) * add OPENCL guard and correct namespace as usual for opencl tests * stitching: add ocl accuracy test for affine warper test consistent results with ocl on and off * stitching: add affine warper ocl perf test add affine warper to existing warper perf tests. Added new sanity data. * stitching: do not overwrite inliers in affine matcher * estimation is run second time on inliers only, inliers produces in second run will not be therefore correct for all matches * calib3d: add Levenberg–Marquardt refining to estimateAffine2D* functions this adds affine Levenberg–Marquardt refining to estimateAffine2D functions similar to what is done in findHomography. implements Levenberg–Marquardt refinig for both full affine and partial affine transformations. * stitching: remove reestimation step in affine matcher reestimation step is not needed. estimateAffine2D* functions are running their own reestimation on inliers using the Levenberg-Marquardt algorithm, which is better than simply rerunning RANSAC on inliers. * implement partial affine bundle adjuster bundle adjuster that expect affine transform with 4DOF. Refines parameters for all cameras together. stitching: fix bug in BundleAdjusterAffinePartial * use the invers properly * use static buffer for invers to speed it up * samples: add affine bundle adjuster option to stitching_detailed * add support for using affine bundle adjuster with 4DOF * improve logging of initial intristics * sttiching: add affine bundle adjuster test * fix build warnings * stitching: increase limit on sanity check prevents spurious test failures on mac. values are still pretty fine. * stitching: set affine bundle adjuster for SCANS mode * fix bug with AffineBestOf2NearestMatcher (we want to select affine partial mode) * select right bundle adjuster * stitching: increase error bound for matcher tests * this prevents failure on mac. tranformation is still ok. * stitching: implement affine bundle adjuster * implements affine bundle adjuster that is using full affine transform * existing test case modified to test both affinePartial an full affine bundle adjuster * add stitching tutorial * show basic usage of stitching api (Stitcher class) * stitching: add more integration test for affine stitching * added new datasets to existing testcase * removed unused include * calib3d: move `haveCollinearPoints` to common header * added comment to make that this also checks too close points * calib3d: redone checkSubset for estimateAffine* callback * use common function to check collinearity * this also ensures that point will not be too close to each other * calib3d: change estimateAffine* functions API * more similar to `findHomography`, `findFundamentalMat`, `findEssentialMat` and similar * follows standard recommended semantic INPUTS, OUTPUTS, FLAGS * allows to disable refining * supported LMEDS robust method (tests yet to come) along with RANSAC * extended docs with some tips * calib3d: rewrite estimateAffine2D test * rewrite in googletest style * parametrize to test both robust methods (RANSAC and LMEDS) * get rid of boilerplate * calib3d: rework estimateAffinePartial2D test * rework in googletest style * add testing for LMEDS * calib3d: rework estimateAffine*2D perf test * test for LMEDS speed * test with/without Levenberg-Marquart * remove sanity checking (this is covered by accuracy tests) * calib3d: improve estimateAffine*2D tests * test transformations in loop * improves test by testing more potential transformations * calib3d: rewrite kernels for estimateAffine*2D functions * use analytical solution instead of SVD * this version is faster especially for smaller amount of points * calib3d: tune up perf of estimateAffine*2D functions * avoid copying inliers * avoid converting input points if not necessary * check only `from` point for collinearity, as `to` does not affect stability of transform * tutorials: add commands examples to stitching tutorials * add some examples how to run stitcher sample code * mention stitching_detailed.cpp * calib3d: change computeError for estimateAffine*2D * do error computing in floats instead of doubles this have required precision + we were storing the result in float anyway. This make code faster and allows auto-vectorization by smart compilers. * documentation: mention estimateAffine*2D function * refer to new functions on appropriate places * prefer estimateAffine*2D over estimateRigidTransform * stitching: add camera models documentations * mention camera models in module documentation to give user a better overview and reduce confusion
8 years ago
PERF_TEST_P(stitchDatasets, affine, testing::Combine(AFFINE_DATASETS, TEST_DETECTORS))
12 years ago
{
Merge pull request #6933 from hrnr:gsoc_all [GSOC] New camera model for stitching pipeline * implement estimateAffine2D estimates affine transformation using robust RANSAC method. * uses RANSAC framework in calib3d * includes accuracy test * uses SVD decomposition for solving 3 point equation * implement estimateAffinePartial2D estimates limited affine transformation * includes accuracy test * stitching: add affine matcher initial version of matcher that estimates affine transformation * stitching: added affine transform estimator initial version of estimator that simply chain transformations in homogeneous coordinates * calib3d: rename estimateAffine3D test test Calib3d_EstimateAffineTransform rename to Calib3d_EstimateAffine3D. This is more descriptive and prevents confusion with estimateAffine2D tests. * added perf test for estimateAffine functions tests both estimateAffine2D and estimateAffinePartial2D * calib3d: compare error in square in estimateAffine2D * incorporates fix from #6768 * rerun affine estimation on inliers * stitching: new API for parallel feature finding due to ABI breakage new functionality is added to `FeaturesFinder2`, `SurfFeaturesFinder2` and `OrbFeaturesFinder2` * stitching: add tests for parallel feature find API * perf test (about linear speed up) * accuracy test compares results with serial version * stitching: use dynamic_cast to overcome ABI issues adding parallel API to FeaturesFinder breaks ABI. This commit uses dynamic_cast and hardcodes thread-safe finders to avoid breaking ABI. This should be replaced by proper method similar to FeaturesMatcher on next ABI break. * use estimateAffinePartial2D in AffineBestOf2NearestMatcher * add constructor to AffineBestOf2NearestMatcher * allows to choose between full affine transform and partial affine transform. Other params are the as for BestOf2NearestMatcher * added protected field * samples: stitching_detailed support affine estimator and matcher * added new flags to choose matcher and estimator * stitching: rework affine matcher represent transformation in homogeneous coordinates affine matcher: remove duplicite code rework flow to get rid of duplicite code affine matcher: do not center points to (0, 0) it is not needed for affine model. it should not affect estimation in any way. affine matcher: remove unneeded cv namespacing * stitching: add stub bundle adjuster * adds stub bundle adjuster that does nothing * can be used in place of standard bundle adjusters to omit bundle adjusting step * samples: stitching detailed, support no budle adjust * uses new NoBundleAdjuster * added affine warper * uses R to get whole affine transformation and propagates rotation and translation to plane warper * add affine warper factory class * affine warper: compensate transformation * samples: stitching_detailed add support for affine warper * add Stitcher::create method this method follows similar constructor methods and returns smart pointer. This allows constructing Stitcher according to OpenCV guidelines. * supports multiple stitcher configurations (PANORAMA and SCANS) for convenient setup * returns cv::Ptr * stitcher: dynamicaly determine correct estimator we need to use affine estimator for affine matcher * preserves ABI (but add hints for ABI 4) * uses dynamic_cast hack to inject correct estimator * sample stitching: add support for multiple modes shows how to use different configurations of stitcher easily (panorama stitching and scans affine model) * stitcher: find features in parallel use new FeatureFinder API to find features in parallel. Parallelized using TBB. * stitching: disable parallel feature finding for OCL it does not bring much speedup to run features finder in parallel when OpenCL is enabled, because finder needs to wait for OCL device. Also, currently ORB is not thread-safe when OCL is enabled. * stitching: move matcher tests move matchers tests perf_stich.cpp -> perf_matchers.cpp * stitching: add affine stiching integration test test basic affine stitching (SCANS mode of stitcher) with images that have only translation between them * enable surf for stitching tests stitching.b12 test was failing with surf investigated the issue, surf is producing good result. Transformation is only slightly different from ORB, so that resulting pano does not exactly match ORB's result. That caused sanity check to fail. * added size checks similar to other tests * sanity check will be applied only for ORB * stitching: fix wrong estimator choice if case was exactly wrong, estimators were chosen wrong added logging for estimated transformation * enable surf for matchers stitching tests * enable SURF * rework sanity checking. Check estimated transform instead of matches. Est. transform should be more stable and comparable between SURF and ORB. * remove regression checking for VectorFeatures tests. It has a lot if data andtest is the same as previous except it test different vector size for performance, so sanity checking does not add any value here. Added basic sanity asserts instead. * stitching tests: allow relative error for transform * allows .01 relative error for estimated homography sanity check in stitching matchers tests * fix VS warning stitching tests: increase relative error increase relative error to make it pass on all platforms (results are still good). stitching test: allow bigger relative error transformation can differ in small values (with small absolute difference, but large relative difference). transformation output still looks usable for all platforms. This difference affects only mac and windows, linux passes fine with small difference. * stitching: add tests for affine matcher uses s1, s2 images. added also new sanity data. * stitching tests: use different data for matchers tests this data should yeild more stable transformation (it has much more matches, especially for surf). Sanity data regenerated. * stitching test: rework tests for matchers * separated rotation and translations as they are different by scale. * use appropriate absolute error for them separately. (relative error does not work for values near zero.) * stitching: fix affine warper compensation calculation of rotation and translation extracted for plane warper was wrong * stitching test: enable surf for opencl integration tests * enable SURF with correct guard (HAVE_OPENCV_XFEATURES2D) * add OPENCL guard and correct namespace as usual for opencl tests * stitching: add ocl accuracy test for affine warper test consistent results with ocl on and off * stitching: add affine warper ocl perf test add affine warper to existing warper perf tests. Added new sanity data. * stitching: do not overwrite inliers in affine matcher * estimation is run second time on inliers only, inliers produces in second run will not be therefore correct for all matches * calib3d: add Levenberg–Marquardt refining to estimateAffine2D* functions this adds affine Levenberg–Marquardt refining to estimateAffine2D functions similar to what is done in findHomography. implements Levenberg–Marquardt refinig for both full affine and partial affine transformations. * stitching: remove reestimation step in affine matcher reestimation step is not needed. estimateAffine2D* functions are running their own reestimation on inliers using the Levenberg-Marquardt algorithm, which is better than simply rerunning RANSAC on inliers. * implement partial affine bundle adjuster bundle adjuster that expect affine transform with 4DOF. Refines parameters for all cameras together. stitching: fix bug in BundleAdjusterAffinePartial * use the invers properly * use static buffer for invers to speed it up * samples: add affine bundle adjuster option to stitching_detailed * add support for using affine bundle adjuster with 4DOF * improve logging of initial intristics * sttiching: add affine bundle adjuster test * fix build warnings * stitching: increase limit on sanity check prevents spurious test failures on mac. values are still pretty fine. * stitching: set affine bundle adjuster for SCANS mode * fix bug with AffineBestOf2NearestMatcher (we want to select affine partial mode) * select right bundle adjuster * stitching: increase error bound for matcher tests * this prevents failure on mac. tranformation is still ok. * stitching: implement affine bundle adjuster * implements affine bundle adjuster that is using full affine transform * existing test case modified to test both affinePartial an full affine bundle adjuster * add stitching tutorial * show basic usage of stitching api (Stitcher class) * stitching: add more integration test for affine stitching * added new datasets to existing testcase * removed unused include * calib3d: move `haveCollinearPoints` to common header * added comment to make that this also checks too close points * calib3d: redone checkSubset for estimateAffine* callback * use common function to check collinearity * this also ensures that point will not be too close to each other * calib3d: change estimateAffine* functions API * more similar to `findHomography`, `findFundamentalMat`, `findEssentialMat` and similar * follows standard recommended semantic INPUTS, OUTPUTS, FLAGS * allows to disable refining * supported LMEDS robust method (tests yet to come) along with RANSAC * extended docs with some tips * calib3d: rewrite estimateAffine2D test * rewrite in googletest style * parametrize to test both robust methods (RANSAC and LMEDS) * get rid of boilerplate * calib3d: rework estimateAffinePartial2D test * rework in googletest style * add testing for LMEDS * calib3d: rework estimateAffine*2D perf test * test for LMEDS speed * test with/without Levenberg-Marquart * remove sanity checking (this is covered by accuracy tests) * calib3d: improve estimateAffine*2D tests * test transformations in loop * improves test by testing more potential transformations * calib3d: rewrite kernels for estimateAffine*2D functions * use analytical solution instead of SVD * this version is faster especially for smaller amount of points * calib3d: tune up perf of estimateAffine*2D functions * avoid copying inliers * avoid converting input points if not necessary * check only `from` point for collinearity, as `to` does not affect stability of transform * tutorials: add commands examples to stitching tutorials * add some examples how to run stitcher sample code * mention stitching_detailed.cpp * calib3d: change computeError for estimateAffine*2D * do error computing in floats instead of doubles this have required precision + we were storing the result in float anyway. This make code faster and allows auto-vectorization by smart compilers. * documentation: mention estimateAffine*2D function * refer to new functions on appropriate places * prefer estimateAffine*2D over estimateRigidTransform * stitching: add camera models documentations * mention camera models in module documentation to give user a better overview and reduce confusion
8 years ago
string dataset = get<0>(GetParam());
string detector = get<1>(GetParam());
12 years ago
Merge pull request #6933 from hrnr:gsoc_all [GSOC] New camera model for stitching pipeline * implement estimateAffine2D estimates affine transformation using robust RANSAC method. * uses RANSAC framework in calib3d * includes accuracy test * uses SVD decomposition for solving 3 point equation * implement estimateAffinePartial2D estimates limited affine transformation * includes accuracy test * stitching: add affine matcher initial version of matcher that estimates affine transformation * stitching: added affine transform estimator initial version of estimator that simply chain transformations in homogeneous coordinates * calib3d: rename estimateAffine3D test test Calib3d_EstimateAffineTransform rename to Calib3d_EstimateAffine3D. This is more descriptive and prevents confusion with estimateAffine2D tests. * added perf test for estimateAffine functions tests both estimateAffine2D and estimateAffinePartial2D * calib3d: compare error in square in estimateAffine2D * incorporates fix from #6768 * rerun affine estimation on inliers * stitching: new API for parallel feature finding due to ABI breakage new functionality is added to `FeaturesFinder2`, `SurfFeaturesFinder2` and `OrbFeaturesFinder2` * stitching: add tests for parallel feature find API * perf test (about linear speed up) * accuracy test compares results with serial version * stitching: use dynamic_cast to overcome ABI issues adding parallel API to FeaturesFinder breaks ABI. This commit uses dynamic_cast and hardcodes thread-safe finders to avoid breaking ABI. This should be replaced by proper method similar to FeaturesMatcher on next ABI break. * use estimateAffinePartial2D in AffineBestOf2NearestMatcher * add constructor to AffineBestOf2NearestMatcher * allows to choose between full affine transform and partial affine transform. Other params are the as for BestOf2NearestMatcher * added protected field * samples: stitching_detailed support affine estimator and matcher * added new flags to choose matcher and estimator * stitching: rework affine matcher represent transformation in homogeneous coordinates affine matcher: remove duplicite code rework flow to get rid of duplicite code affine matcher: do not center points to (0, 0) it is not needed for affine model. it should not affect estimation in any way. affine matcher: remove unneeded cv namespacing * stitching: add stub bundle adjuster * adds stub bundle adjuster that does nothing * can be used in place of standard bundle adjusters to omit bundle adjusting step * samples: stitching detailed, support no budle adjust * uses new NoBundleAdjuster * added affine warper * uses R to get whole affine transformation and propagates rotation and translation to plane warper * add affine warper factory class * affine warper: compensate transformation * samples: stitching_detailed add support for affine warper * add Stitcher::create method this method follows similar constructor methods and returns smart pointer. This allows constructing Stitcher according to OpenCV guidelines. * supports multiple stitcher configurations (PANORAMA and SCANS) for convenient setup * returns cv::Ptr * stitcher: dynamicaly determine correct estimator we need to use affine estimator for affine matcher * preserves ABI (but add hints for ABI 4) * uses dynamic_cast hack to inject correct estimator * sample stitching: add support for multiple modes shows how to use different configurations of stitcher easily (panorama stitching and scans affine model) * stitcher: find features in parallel use new FeatureFinder API to find features in parallel. Parallelized using TBB. * stitching: disable parallel feature finding for OCL it does not bring much speedup to run features finder in parallel when OpenCL is enabled, because finder needs to wait for OCL device. Also, currently ORB is not thread-safe when OCL is enabled. * stitching: move matcher tests move matchers tests perf_stich.cpp -> perf_matchers.cpp * stitching: add affine stiching integration test test basic affine stitching (SCANS mode of stitcher) with images that have only translation between them * enable surf for stitching tests stitching.b12 test was failing with surf investigated the issue, surf is producing good result. Transformation is only slightly different from ORB, so that resulting pano does not exactly match ORB's result. That caused sanity check to fail. * added size checks similar to other tests * sanity check will be applied only for ORB * stitching: fix wrong estimator choice if case was exactly wrong, estimators were chosen wrong added logging for estimated transformation * enable surf for matchers stitching tests * enable SURF * rework sanity checking. Check estimated transform instead of matches. Est. transform should be more stable and comparable between SURF and ORB. * remove regression checking for VectorFeatures tests. It has a lot if data andtest is the same as previous except it test different vector size for performance, so sanity checking does not add any value here. Added basic sanity asserts instead. * stitching tests: allow relative error for transform * allows .01 relative error for estimated homography sanity check in stitching matchers tests * fix VS warning stitching tests: increase relative error increase relative error to make it pass on all platforms (results are still good). stitching test: allow bigger relative error transformation can differ in small values (with small absolute difference, but large relative difference). transformation output still looks usable for all platforms. This difference affects only mac and windows, linux passes fine with small difference. * stitching: add tests for affine matcher uses s1, s2 images. added also new sanity data. * stitching tests: use different data for matchers tests this data should yeild more stable transformation (it has much more matches, especially for surf). Sanity data regenerated. * stitching test: rework tests for matchers * separated rotation and translations as they are different by scale. * use appropriate absolute error for them separately. (relative error does not work for values near zero.) * stitching: fix affine warper compensation calculation of rotation and translation extracted for plane warper was wrong * stitching test: enable surf for opencl integration tests * enable SURF with correct guard (HAVE_OPENCV_XFEATURES2D) * add OPENCL guard and correct namespace as usual for opencl tests * stitching: add ocl accuracy test for affine warper test consistent results with ocl on and off * stitching: add affine warper ocl perf test add affine warper to existing warper perf tests. Added new sanity data. * stitching: do not overwrite inliers in affine matcher * estimation is run second time on inliers only, inliers produces in second run will not be therefore correct for all matches * calib3d: add Levenberg–Marquardt refining to estimateAffine2D* functions this adds affine Levenberg–Marquardt refining to estimateAffine2D functions similar to what is done in findHomography. implements Levenberg–Marquardt refinig for both full affine and partial affine transformations. * stitching: remove reestimation step in affine matcher reestimation step is not needed. estimateAffine2D* functions are running their own reestimation on inliers using the Levenberg-Marquardt algorithm, which is better than simply rerunning RANSAC on inliers. * implement partial affine bundle adjuster bundle adjuster that expect affine transform with 4DOF. Refines parameters for all cameras together. stitching: fix bug in BundleAdjusterAffinePartial * use the invers properly * use static buffer for invers to speed it up * samples: add affine bundle adjuster option to stitching_detailed * add support for using affine bundle adjuster with 4DOF * improve logging of initial intristics * sttiching: add affine bundle adjuster test * fix build warnings * stitching: increase limit on sanity check prevents spurious test failures on mac. values are still pretty fine. * stitching: set affine bundle adjuster for SCANS mode * fix bug with AffineBestOf2NearestMatcher (we want to select affine partial mode) * select right bundle adjuster * stitching: increase error bound for matcher tests * this prevents failure on mac. tranformation is still ok. * stitching: implement affine bundle adjuster * implements affine bundle adjuster that is using full affine transform * existing test case modified to test both affinePartial an full affine bundle adjuster * add stitching tutorial * show basic usage of stitching api (Stitcher class) * stitching: add more integration test for affine stitching * added new datasets to existing testcase * removed unused include * calib3d: move `haveCollinearPoints` to common header * added comment to make that this also checks too close points * calib3d: redone checkSubset for estimateAffine* callback * use common function to check collinearity * this also ensures that point will not be too close to each other * calib3d: change estimateAffine* functions API * more similar to `findHomography`, `findFundamentalMat`, `findEssentialMat` and similar * follows standard recommended semantic INPUTS, OUTPUTS, FLAGS * allows to disable refining * supported LMEDS robust method (tests yet to come) along with RANSAC * extended docs with some tips * calib3d: rewrite estimateAffine2D test * rewrite in googletest style * parametrize to test both robust methods (RANSAC and LMEDS) * get rid of boilerplate * calib3d: rework estimateAffinePartial2D test * rework in googletest style * add testing for LMEDS * calib3d: rework estimateAffine*2D perf test * test for LMEDS speed * test with/without Levenberg-Marquart * remove sanity checking (this is covered by accuracy tests) * calib3d: improve estimateAffine*2D tests * test transformations in loop * improves test by testing more potential transformations * calib3d: rewrite kernels for estimateAffine*2D functions * use analytical solution instead of SVD * this version is faster especially for smaller amount of points * calib3d: tune up perf of estimateAffine*2D functions * avoid copying inliers * avoid converting input points if not necessary * check only `from` point for collinearity, as `to` does not affect stability of transform * tutorials: add commands examples to stitching tutorials * add some examples how to run stitcher sample code * mention stitching_detailed.cpp * calib3d: change computeError for estimateAffine*2D * do error computing in floats instead of doubles this have required precision + we were storing the result in float anyway. This make code faster and allows auto-vectorization by smart compilers. * documentation: mention estimateAffine*2D function * refer to new functions on appropriate places * prefer estimateAffine*2D over estimateRigidTransform * stitching: add camera models documentations * mention camera models in module documentation to give user a better overview and reduce confusion
8 years ago
Mat pano;
vector<Mat> imgs;
int width, height, allowed_diff = 20;
Merge pull request #8869 from hrnr:akaze_part1 [GSOC] Speeding-up AKAZE, part #1 (#8869) * ts: expand arguments before stringifications in CV_ENUM and CV_FLAGS added protective macros to always force macro expansion of arguments. This allows using CV_ENUM and CV_FLAGS with macro arguments. * feature2d: unify perf test use the same test for all detectors/descriptors we have. * added AKAZE tests * features2d: extend perf tests * add BRISK, KAZE, MSER * run all extract tests on AKAZE keypoints, so that the test si more comparable for the speed of extraction * feature2d: rework opencl perf tests use the same configuration as cpu tests * feature2d: fix descriptors allocation for AKAZE and KAZE fix crash when descriptors are UMat * feature2d: name enum to fix build with older gcc * Revert "ts: expand arguments before stringifications in CV_ENUM and CV_FLAGS" This reverts commit 19538cac1e45b0cec98190cf06a5ecb07d9b596e. This wasn't a great idea after all. There is a lot of flags implemented as #define, that we don't want to expand. * feature2d: fix expansion problems with CV_ENUM in perf * expand arguments before passing them to CV_ENUM. This does not need modifications of CV_ENUM. * added include guards to `perf_feature2d.hpp` * feature2d: fix crash in AKAZE when using KAZE descriptors * out-of-bound access in Get_MSURF_Descriptor_64 * this happened reliably when running on provided keypoints (not computed by the same instance) * feature2d: added regression tests for AKAZE * test with both MLDB and KAZE keypoints * feature2d: do not compute keypoints orientation twice * always compute keypoints orientation, when computing keypoints * do not recompute keypoint orientation when computing descriptors this allows to test detection and extraction separately * features2d: fix crash in AKAZE * out-of-bound reads near the image edge * same as the bug in KAZE descriptors * feature2d: refactor invariance testing * split detectors and descriptors tests * rewrite to google test to simplify debugging * add tests for AKAZE and one test for ORB * stitching: add tests with AKAZE feature finder * added basic stitching cpu and ocl tests * fix bug in AKAZE wrapper for stitching pipeline causing lots of ! OPENCV warning: getUMat()/getMat() call chain possible problem. ! Base object is dead, while nested/derived object is still alive or processed. ! Please check lifetime of UMat/Mat objects!
8 years ago
Ptr<detail::FeaturesFinder> featuresFinder = getFeatureFinder(detector);
12 years ago
Merge pull request #6933 from hrnr:gsoc_all [GSOC] New camera model for stitching pipeline * implement estimateAffine2D estimates affine transformation using robust RANSAC method. * uses RANSAC framework in calib3d * includes accuracy test * uses SVD decomposition for solving 3 point equation * implement estimateAffinePartial2D estimates limited affine transformation * includes accuracy test * stitching: add affine matcher initial version of matcher that estimates affine transformation * stitching: added affine transform estimator initial version of estimator that simply chain transformations in homogeneous coordinates * calib3d: rename estimateAffine3D test test Calib3d_EstimateAffineTransform rename to Calib3d_EstimateAffine3D. This is more descriptive and prevents confusion with estimateAffine2D tests. * added perf test for estimateAffine functions tests both estimateAffine2D and estimateAffinePartial2D * calib3d: compare error in square in estimateAffine2D * incorporates fix from #6768 * rerun affine estimation on inliers * stitching: new API for parallel feature finding due to ABI breakage new functionality is added to `FeaturesFinder2`, `SurfFeaturesFinder2` and `OrbFeaturesFinder2` * stitching: add tests for parallel feature find API * perf test (about linear speed up) * accuracy test compares results with serial version * stitching: use dynamic_cast to overcome ABI issues adding parallel API to FeaturesFinder breaks ABI. This commit uses dynamic_cast and hardcodes thread-safe finders to avoid breaking ABI. This should be replaced by proper method similar to FeaturesMatcher on next ABI break. * use estimateAffinePartial2D in AffineBestOf2NearestMatcher * add constructor to AffineBestOf2NearestMatcher * allows to choose between full affine transform and partial affine transform. Other params are the as for BestOf2NearestMatcher * added protected field * samples: stitching_detailed support affine estimator and matcher * added new flags to choose matcher and estimator * stitching: rework affine matcher represent transformation in homogeneous coordinates affine matcher: remove duplicite code rework flow to get rid of duplicite code affine matcher: do not center points to (0, 0) it is not needed for affine model. it should not affect estimation in any way. affine matcher: remove unneeded cv namespacing * stitching: add stub bundle adjuster * adds stub bundle adjuster that does nothing * can be used in place of standard bundle adjusters to omit bundle adjusting step * samples: stitching detailed, support no budle adjust * uses new NoBundleAdjuster * added affine warper * uses R to get whole affine transformation and propagates rotation and translation to plane warper * add affine warper factory class * affine warper: compensate transformation * samples: stitching_detailed add support for affine warper * add Stitcher::create method this method follows similar constructor methods and returns smart pointer. This allows constructing Stitcher according to OpenCV guidelines. * supports multiple stitcher configurations (PANORAMA and SCANS) for convenient setup * returns cv::Ptr * stitcher: dynamicaly determine correct estimator we need to use affine estimator for affine matcher * preserves ABI (but add hints for ABI 4) * uses dynamic_cast hack to inject correct estimator * sample stitching: add support for multiple modes shows how to use different configurations of stitcher easily (panorama stitching and scans affine model) * stitcher: find features in parallel use new FeatureFinder API to find features in parallel. Parallelized using TBB. * stitching: disable parallel feature finding for OCL it does not bring much speedup to run features finder in parallel when OpenCL is enabled, because finder needs to wait for OCL device. Also, currently ORB is not thread-safe when OCL is enabled. * stitching: move matcher tests move matchers tests perf_stich.cpp -> perf_matchers.cpp * stitching: add affine stiching integration test test basic affine stitching (SCANS mode of stitcher) with images that have only translation between them * enable surf for stitching tests stitching.b12 test was failing with surf investigated the issue, surf is producing good result. Transformation is only slightly different from ORB, so that resulting pano does not exactly match ORB's result. That caused sanity check to fail. * added size checks similar to other tests * sanity check will be applied only for ORB * stitching: fix wrong estimator choice if case was exactly wrong, estimators were chosen wrong added logging for estimated transformation * enable surf for matchers stitching tests * enable SURF * rework sanity checking. Check estimated transform instead of matches. Est. transform should be more stable and comparable between SURF and ORB. * remove regression checking for VectorFeatures tests. It has a lot if data andtest is the same as previous except it test different vector size for performance, so sanity checking does not add any value here. Added basic sanity asserts instead. * stitching tests: allow relative error for transform * allows .01 relative error for estimated homography sanity check in stitching matchers tests * fix VS warning stitching tests: increase relative error increase relative error to make it pass on all platforms (results are still good). stitching test: allow bigger relative error transformation can differ in small values (with small absolute difference, but large relative difference). transformation output still looks usable for all platforms. This difference affects only mac and windows, linux passes fine with small difference. * stitching: add tests for affine matcher uses s1, s2 images. added also new sanity data. * stitching tests: use different data for matchers tests this data should yeild more stable transformation (it has much more matches, especially for surf). Sanity data regenerated. * stitching test: rework tests for matchers * separated rotation and translations as they are different by scale. * use appropriate absolute error for them separately. (relative error does not work for values near zero.) * stitching: fix affine warper compensation calculation of rotation and translation extracted for plane warper was wrong * stitching test: enable surf for opencl integration tests * enable SURF with correct guard (HAVE_OPENCV_XFEATURES2D) * add OPENCL guard and correct namespace as usual for opencl tests * stitching: add ocl accuracy test for affine warper test consistent results with ocl on and off * stitching: add affine warper ocl perf test add affine warper to existing warper perf tests. Added new sanity data. * stitching: do not overwrite inliers in affine matcher * estimation is run second time on inliers only, inliers produces in second run will not be therefore correct for all matches * calib3d: add Levenberg–Marquardt refining to estimateAffine2D* functions this adds affine Levenberg–Marquardt refining to estimateAffine2D functions similar to what is done in findHomography. implements Levenberg–Marquardt refinig for both full affine and partial affine transformations. * stitching: remove reestimation step in affine matcher reestimation step is not needed. estimateAffine2D* functions are running their own reestimation on inliers using the Levenberg-Marquardt algorithm, which is better than simply rerunning RANSAC on inliers. * implement partial affine bundle adjuster bundle adjuster that expect affine transform with 4DOF. Refines parameters for all cameras together. stitching: fix bug in BundleAdjusterAffinePartial * use the invers properly * use static buffer for invers to speed it up * samples: add affine bundle adjuster option to stitching_detailed * add support for using affine bundle adjuster with 4DOF * improve logging of initial intristics * sttiching: add affine bundle adjuster test * fix build warnings * stitching: increase limit on sanity check prevents spurious test failures on mac. values are still pretty fine. * stitching: set affine bundle adjuster for SCANS mode * fix bug with AffineBestOf2NearestMatcher (we want to select affine partial mode) * select right bundle adjuster * stitching: increase error bound for matcher tests * this prevents failure on mac. tranformation is still ok. * stitching: implement affine bundle adjuster * implements affine bundle adjuster that is using full affine transform * existing test case modified to test both affinePartial an full affine bundle adjuster * add stitching tutorial * show basic usage of stitching api (Stitcher class) * stitching: add more integration test for affine stitching * added new datasets to existing testcase * removed unused include * calib3d: move `haveCollinearPoints` to common header * added comment to make that this also checks too close points * calib3d: redone checkSubset for estimateAffine* callback * use common function to check collinearity * this also ensures that point will not be too close to each other * calib3d: change estimateAffine* functions API * more similar to `findHomography`, `findFundamentalMat`, `findEssentialMat` and similar * follows standard recommended semantic INPUTS, OUTPUTS, FLAGS * allows to disable refining * supported LMEDS robust method (tests yet to come) along with RANSAC * extended docs with some tips * calib3d: rewrite estimateAffine2D test * rewrite in googletest style * parametrize to test both robust methods (RANSAC and LMEDS) * get rid of boilerplate * calib3d: rework estimateAffinePartial2D test * rework in googletest style * add testing for LMEDS * calib3d: rework estimateAffine*2D perf test * test for LMEDS speed * test with/without Levenberg-Marquart * remove sanity checking (this is covered by accuracy tests) * calib3d: improve estimateAffine*2D tests * test transformations in loop * improves test by testing more potential transformations * calib3d: rewrite kernels for estimateAffine*2D functions * use analytical solution instead of SVD * this version is faster especially for smaller amount of points * calib3d: tune up perf of estimateAffine*2D functions * avoid copying inliers * avoid converting input points if not necessary * check only `from` point for collinearity, as `to` does not affect stability of transform * tutorials: add commands examples to stitching tutorials * add some examples how to run stitcher sample code * mention stitching_detailed.cpp * calib3d: change computeError for estimateAffine*2D * do error computing in floats instead of doubles this have required precision + we were storing the result in float anyway. This make code faster and allows auto-vectorization by smart compilers. * documentation: mention estimateAffine*2D function * refer to new functions on appropriate places * prefer estimateAffine*2D over estimateRigidTransform * stitching: add camera models documentations * mention camera models in module documentation to give user a better overview and reduce confusion
8 years ago
if(dataset == "budapest")
12 years ago
{
Merge pull request #6933 from hrnr:gsoc_all [GSOC] New camera model for stitching pipeline * implement estimateAffine2D estimates affine transformation using robust RANSAC method. * uses RANSAC framework in calib3d * includes accuracy test * uses SVD decomposition for solving 3 point equation * implement estimateAffinePartial2D estimates limited affine transformation * includes accuracy test * stitching: add affine matcher initial version of matcher that estimates affine transformation * stitching: added affine transform estimator initial version of estimator that simply chain transformations in homogeneous coordinates * calib3d: rename estimateAffine3D test test Calib3d_EstimateAffineTransform rename to Calib3d_EstimateAffine3D. This is more descriptive and prevents confusion with estimateAffine2D tests. * added perf test for estimateAffine functions tests both estimateAffine2D and estimateAffinePartial2D * calib3d: compare error in square in estimateAffine2D * incorporates fix from #6768 * rerun affine estimation on inliers * stitching: new API for parallel feature finding due to ABI breakage new functionality is added to `FeaturesFinder2`, `SurfFeaturesFinder2` and `OrbFeaturesFinder2` * stitching: add tests for parallel feature find API * perf test (about linear speed up) * accuracy test compares results with serial version * stitching: use dynamic_cast to overcome ABI issues adding parallel API to FeaturesFinder breaks ABI. This commit uses dynamic_cast and hardcodes thread-safe finders to avoid breaking ABI. This should be replaced by proper method similar to FeaturesMatcher on next ABI break. * use estimateAffinePartial2D in AffineBestOf2NearestMatcher * add constructor to AffineBestOf2NearestMatcher * allows to choose between full affine transform and partial affine transform. Other params are the as for BestOf2NearestMatcher * added protected field * samples: stitching_detailed support affine estimator and matcher * added new flags to choose matcher and estimator * stitching: rework affine matcher represent transformation in homogeneous coordinates affine matcher: remove duplicite code rework flow to get rid of duplicite code affine matcher: do not center points to (0, 0) it is not needed for affine model. it should not affect estimation in any way. affine matcher: remove unneeded cv namespacing * stitching: add stub bundle adjuster * adds stub bundle adjuster that does nothing * can be used in place of standard bundle adjusters to omit bundle adjusting step * samples: stitching detailed, support no budle adjust * uses new NoBundleAdjuster * added affine warper * uses R to get whole affine transformation and propagates rotation and translation to plane warper * add affine warper factory class * affine warper: compensate transformation * samples: stitching_detailed add support for affine warper * add Stitcher::create method this method follows similar constructor methods and returns smart pointer. This allows constructing Stitcher according to OpenCV guidelines. * supports multiple stitcher configurations (PANORAMA and SCANS) for convenient setup * returns cv::Ptr * stitcher: dynamicaly determine correct estimator we need to use affine estimator for affine matcher * preserves ABI (but add hints for ABI 4) * uses dynamic_cast hack to inject correct estimator * sample stitching: add support for multiple modes shows how to use different configurations of stitcher easily (panorama stitching and scans affine model) * stitcher: find features in parallel use new FeatureFinder API to find features in parallel. Parallelized using TBB. * stitching: disable parallel feature finding for OCL it does not bring much speedup to run features finder in parallel when OpenCL is enabled, because finder needs to wait for OCL device. Also, currently ORB is not thread-safe when OCL is enabled. * stitching: move matcher tests move matchers tests perf_stich.cpp -> perf_matchers.cpp * stitching: add affine stiching integration test test basic affine stitching (SCANS mode of stitcher) with images that have only translation between them * enable surf for stitching tests stitching.b12 test was failing with surf investigated the issue, surf is producing good result. Transformation is only slightly different from ORB, so that resulting pano does not exactly match ORB's result. That caused sanity check to fail. * added size checks similar to other tests * sanity check will be applied only for ORB * stitching: fix wrong estimator choice if case was exactly wrong, estimators were chosen wrong added logging for estimated transformation * enable surf for matchers stitching tests * enable SURF * rework sanity checking. Check estimated transform instead of matches. Est. transform should be more stable and comparable between SURF and ORB. * remove regression checking for VectorFeatures tests. It has a lot if data andtest is the same as previous except it test different vector size for performance, so sanity checking does not add any value here. Added basic sanity asserts instead. * stitching tests: allow relative error for transform * allows .01 relative error for estimated homography sanity check in stitching matchers tests * fix VS warning stitching tests: increase relative error increase relative error to make it pass on all platforms (results are still good). stitching test: allow bigger relative error transformation can differ in small values (with small absolute difference, but large relative difference). transformation output still looks usable for all platforms. This difference affects only mac and windows, linux passes fine with small difference. * stitching: add tests for affine matcher uses s1, s2 images. added also new sanity data. * stitching tests: use different data for matchers tests this data should yeild more stable transformation (it has much more matches, especially for surf). Sanity data regenerated. * stitching test: rework tests for matchers * separated rotation and translations as they are different by scale. * use appropriate absolute error for them separately. (relative error does not work for values near zero.) * stitching: fix affine warper compensation calculation of rotation and translation extracted for plane warper was wrong * stitching test: enable surf for opencl integration tests * enable SURF with correct guard (HAVE_OPENCV_XFEATURES2D) * add OPENCL guard and correct namespace as usual for opencl tests * stitching: add ocl accuracy test for affine warper test consistent results with ocl on and off * stitching: add affine warper ocl perf test add affine warper to existing warper perf tests. Added new sanity data. * stitching: do not overwrite inliers in affine matcher * estimation is run second time on inliers only, inliers produces in second run will not be therefore correct for all matches * calib3d: add Levenberg–Marquardt refining to estimateAffine2D* functions this adds affine Levenberg–Marquardt refining to estimateAffine2D functions similar to what is done in findHomography. implements Levenberg–Marquardt refinig for both full affine and partial affine transformations. * stitching: remove reestimation step in affine matcher reestimation step is not needed. estimateAffine2D* functions are running their own reestimation on inliers using the Levenberg-Marquardt algorithm, which is better than simply rerunning RANSAC on inliers. * implement partial affine bundle adjuster bundle adjuster that expect affine transform with 4DOF. Refines parameters for all cameras together. stitching: fix bug in BundleAdjusterAffinePartial * use the invers properly * use static buffer for invers to speed it up * samples: add affine bundle adjuster option to stitching_detailed * add support for using affine bundle adjuster with 4DOF * improve logging of initial intristics * sttiching: add affine bundle adjuster test * fix build warnings * stitching: increase limit on sanity check prevents spurious test failures on mac. values are still pretty fine. * stitching: set affine bundle adjuster for SCANS mode * fix bug with AffineBestOf2NearestMatcher (we want to select affine partial mode) * select right bundle adjuster * stitching: increase error bound for matcher tests * this prevents failure on mac. tranformation is still ok. * stitching: implement affine bundle adjuster * implements affine bundle adjuster that is using full affine transform * existing test case modified to test both affinePartial an full affine bundle adjuster * add stitching tutorial * show basic usage of stitching api (Stitcher class) * stitching: add more integration test for affine stitching * added new datasets to existing testcase * removed unused include * calib3d: move `haveCollinearPoints` to common header * added comment to make that this also checks too close points * calib3d: redone checkSubset for estimateAffine* callback * use common function to check collinearity * this also ensures that point will not be too close to each other * calib3d: change estimateAffine* functions API * more similar to `findHomography`, `findFundamentalMat`, `findEssentialMat` and similar * follows standard recommended semantic INPUTS, OUTPUTS, FLAGS * allows to disable refining * supported LMEDS robust method (tests yet to come) along with RANSAC * extended docs with some tips * calib3d: rewrite estimateAffine2D test * rewrite in googletest style * parametrize to test both robust methods (RANSAC and LMEDS) * get rid of boilerplate * calib3d: rework estimateAffinePartial2D test * rework in googletest style * add testing for LMEDS * calib3d: rework estimateAffine*2D perf test * test for LMEDS speed * test with/without Levenberg-Marquart * remove sanity checking (this is covered by accuracy tests) * calib3d: improve estimateAffine*2D tests * test transformations in loop * improves test by testing more potential transformations * calib3d: rewrite kernels for estimateAffine*2D functions * use analytical solution instead of SVD * this version is faster especially for smaller amount of points * calib3d: tune up perf of estimateAffine*2D functions * avoid copying inliers * avoid converting input points if not necessary * check only `from` point for collinearity, as `to` does not affect stability of transform * tutorials: add commands examples to stitching tutorials * add some examples how to run stitcher sample code * mention stitching_detailed.cpp * calib3d: change computeError for estimateAffine*2D * do error computing in floats instead of doubles this have required precision + we were storing the result in float anyway. This make code faster and allows auto-vectorization by smart compilers. * documentation: mention estimateAffine*2D function * refer to new functions on appropriate places * prefer estimateAffine*2D over estimateRigidTransform * stitching: add camera models documentations * mention camera models in module documentation to give user a better overview and reduce confusion
8 years ago
imgs.push_back(imread(getDataPath("stitching/budapest1.jpg")));
imgs.push_back(imread(getDataPath("stitching/budapest2.jpg")));
imgs.push_back(imread(getDataPath("stitching/budapest3.jpg")));
imgs.push_back(imread(getDataPath("stitching/budapest4.jpg")));
imgs.push_back(imread(getDataPath("stitching/budapest5.jpg")));
imgs.push_back(imread(getDataPath("stitching/budapest6.jpg")));
width = 2313;
height = 1158;
// this dataset is big, the results between surf and orb differ slightly,
// but both are still good
allowed_diff = 50;
12 years ago
}
Merge pull request #6933 from hrnr:gsoc_all [GSOC] New camera model for stitching pipeline * implement estimateAffine2D estimates affine transformation using robust RANSAC method. * uses RANSAC framework in calib3d * includes accuracy test * uses SVD decomposition for solving 3 point equation * implement estimateAffinePartial2D estimates limited affine transformation * includes accuracy test * stitching: add affine matcher initial version of matcher that estimates affine transformation * stitching: added affine transform estimator initial version of estimator that simply chain transformations in homogeneous coordinates * calib3d: rename estimateAffine3D test test Calib3d_EstimateAffineTransform rename to Calib3d_EstimateAffine3D. This is more descriptive and prevents confusion with estimateAffine2D tests. * added perf test for estimateAffine functions tests both estimateAffine2D and estimateAffinePartial2D * calib3d: compare error in square in estimateAffine2D * incorporates fix from #6768 * rerun affine estimation on inliers * stitching: new API for parallel feature finding due to ABI breakage new functionality is added to `FeaturesFinder2`, `SurfFeaturesFinder2` and `OrbFeaturesFinder2` * stitching: add tests for parallel feature find API * perf test (about linear speed up) * accuracy test compares results with serial version * stitching: use dynamic_cast to overcome ABI issues adding parallel API to FeaturesFinder breaks ABI. This commit uses dynamic_cast and hardcodes thread-safe finders to avoid breaking ABI. This should be replaced by proper method similar to FeaturesMatcher on next ABI break. * use estimateAffinePartial2D in AffineBestOf2NearestMatcher * add constructor to AffineBestOf2NearestMatcher * allows to choose between full affine transform and partial affine transform. Other params are the as for BestOf2NearestMatcher * added protected field * samples: stitching_detailed support affine estimator and matcher * added new flags to choose matcher and estimator * stitching: rework affine matcher represent transformation in homogeneous coordinates affine matcher: remove duplicite code rework flow to get rid of duplicite code affine matcher: do not center points to (0, 0) it is not needed for affine model. it should not affect estimation in any way. affine matcher: remove unneeded cv namespacing * stitching: add stub bundle adjuster * adds stub bundle adjuster that does nothing * can be used in place of standard bundle adjusters to omit bundle adjusting step * samples: stitching detailed, support no budle adjust * uses new NoBundleAdjuster * added affine warper * uses R to get whole affine transformation and propagates rotation and translation to plane warper * add affine warper factory class * affine warper: compensate transformation * samples: stitching_detailed add support for affine warper * add Stitcher::create method this method follows similar constructor methods and returns smart pointer. This allows constructing Stitcher according to OpenCV guidelines. * supports multiple stitcher configurations (PANORAMA and SCANS) for convenient setup * returns cv::Ptr * stitcher: dynamicaly determine correct estimator we need to use affine estimator for affine matcher * preserves ABI (but add hints for ABI 4) * uses dynamic_cast hack to inject correct estimator * sample stitching: add support for multiple modes shows how to use different configurations of stitcher easily (panorama stitching and scans affine model) * stitcher: find features in parallel use new FeatureFinder API to find features in parallel. Parallelized using TBB. * stitching: disable parallel feature finding for OCL it does not bring much speedup to run features finder in parallel when OpenCL is enabled, because finder needs to wait for OCL device. Also, currently ORB is not thread-safe when OCL is enabled. * stitching: move matcher tests move matchers tests perf_stich.cpp -> perf_matchers.cpp * stitching: add affine stiching integration test test basic affine stitching (SCANS mode of stitcher) with images that have only translation between them * enable surf for stitching tests stitching.b12 test was failing with surf investigated the issue, surf is producing good result. Transformation is only slightly different from ORB, so that resulting pano does not exactly match ORB's result. That caused sanity check to fail. * added size checks similar to other tests * sanity check will be applied only for ORB * stitching: fix wrong estimator choice if case was exactly wrong, estimators were chosen wrong added logging for estimated transformation * enable surf for matchers stitching tests * enable SURF * rework sanity checking. Check estimated transform instead of matches. Est. transform should be more stable and comparable between SURF and ORB. * remove regression checking for VectorFeatures tests. It has a lot if data andtest is the same as previous except it test different vector size for performance, so sanity checking does not add any value here. Added basic sanity asserts instead. * stitching tests: allow relative error for transform * allows .01 relative error for estimated homography sanity check in stitching matchers tests * fix VS warning stitching tests: increase relative error increase relative error to make it pass on all platforms (results are still good). stitching test: allow bigger relative error transformation can differ in small values (with small absolute difference, but large relative difference). transformation output still looks usable for all platforms. This difference affects only mac and windows, linux passes fine with small difference. * stitching: add tests for affine matcher uses s1, s2 images. added also new sanity data. * stitching tests: use different data for matchers tests this data should yeild more stable transformation (it has much more matches, especially for surf). Sanity data regenerated. * stitching test: rework tests for matchers * separated rotation and translations as they are different by scale. * use appropriate absolute error for them separately. (relative error does not work for values near zero.) * stitching: fix affine warper compensation calculation of rotation and translation extracted for plane warper was wrong * stitching test: enable surf for opencl integration tests * enable SURF with correct guard (HAVE_OPENCV_XFEATURES2D) * add OPENCL guard and correct namespace as usual for opencl tests * stitching: add ocl accuracy test for affine warper test consistent results with ocl on and off * stitching: add affine warper ocl perf test add affine warper to existing warper perf tests. Added new sanity data. * stitching: do not overwrite inliers in affine matcher * estimation is run second time on inliers only, inliers produces in second run will not be therefore correct for all matches * calib3d: add Levenberg–Marquardt refining to estimateAffine2D* functions this adds affine Levenberg–Marquardt refining to estimateAffine2D functions similar to what is done in findHomography. implements Levenberg–Marquardt refinig for both full affine and partial affine transformations. * stitching: remove reestimation step in affine matcher reestimation step is not needed. estimateAffine2D* functions are running their own reestimation on inliers using the Levenberg-Marquardt algorithm, which is better than simply rerunning RANSAC on inliers. * implement partial affine bundle adjuster bundle adjuster that expect affine transform with 4DOF. Refines parameters for all cameras together. stitching: fix bug in BundleAdjusterAffinePartial * use the invers properly * use static buffer for invers to speed it up * samples: add affine bundle adjuster option to stitching_detailed * add support for using affine bundle adjuster with 4DOF * improve logging of initial intristics * sttiching: add affine bundle adjuster test * fix build warnings * stitching: increase limit on sanity check prevents spurious test failures on mac. values are still pretty fine. * stitching: set affine bundle adjuster for SCANS mode * fix bug with AffineBestOf2NearestMatcher (we want to select affine partial mode) * select right bundle adjuster * stitching: increase error bound for matcher tests * this prevents failure on mac. tranformation is still ok. * stitching: implement affine bundle adjuster * implements affine bundle adjuster that is using full affine transform * existing test case modified to test both affinePartial an full affine bundle adjuster * add stitching tutorial * show basic usage of stitching api (Stitcher class) * stitching: add more integration test for affine stitching * added new datasets to existing testcase * removed unused include * calib3d: move `haveCollinearPoints` to common header * added comment to make that this also checks too close points * calib3d: redone checkSubset for estimateAffine* callback * use common function to check collinearity * this also ensures that point will not be too close to each other * calib3d: change estimateAffine* functions API * more similar to `findHomography`, `findFundamentalMat`, `findEssentialMat` and similar * follows standard recommended semantic INPUTS, OUTPUTS, FLAGS * allows to disable refining * supported LMEDS robust method (tests yet to come) along with RANSAC * extended docs with some tips * calib3d: rewrite estimateAffine2D test * rewrite in googletest style * parametrize to test both robust methods (RANSAC and LMEDS) * get rid of boilerplate * calib3d: rework estimateAffinePartial2D test * rework in googletest style * add testing for LMEDS * calib3d: rework estimateAffine*2D perf test * test for LMEDS speed * test with/without Levenberg-Marquart * remove sanity checking (this is covered by accuracy tests) * calib3d: improve estimateAffine*2D tests * test transformations in loop * improves test by testing more potential transformations * calib3d: rewrite kernels for estimateAffine*2D functions * use analytical solution instead of SVD * this version is faster especially for smaller amount of points * calib3d: tune up perf of estimateAffine*2D functions * avoid copying inliers * avoid converting input points if not necessary * check only `from` point for collinearity, as `to` does not affect stability of transform * tutorials: add commands examples to stitching tutorials * add some examples how to run stitcher sample code * mention stitching_detailed.cpp * calib3d: change computeError for estimateAffine*2D * do error computing in floats instead of doubles this have required precision + we were storing the result in float anyway. This make code faster and allows auto-vectorization by smart compilers. * documentation: mention estimateAffine*2D function * refer to new functions on appropriate places * prefer estimateAffine*2D over estimateRigidTransform * stitching: add camera models documentations * mention camera models in module documentation to give user a better overview and reduce confusion
8 years ago
else if (dataset == "newspaper")
12 years ago
{
Merge pull request #6933 from hrnr:gsoc_all [GSOC] New camera model for stitching pipeline * implement estimateAffine2D estimates affine transformation using robust RANSAC method. * uses RANSAC framework in calib3d * includes accuracy test * uses SVD decomposition for solving 3 point equation * implement estimateAffinePartial2D estimates limited affine transformation * includes accuracy test * stitching: add affine matcher initial version of matcher that estimates affine transformation * stitching: added affine transform estimator initial version of estimator that simply chain transformations in homogeneous coordinates * calib3d: rename estimateAffine3D test test Calib3d_EstimateAffineTransform rename to Calib3d_EstimateAffine3D. This is more descriptive and prevents confusion with estimateAffine2D tests. * added perf test for estimateAffine functions tests both estimateAffine2D and estimateAffinePartial2D * calib3d: compare error in square in estimateAffine2D * incorporates fix from #6768 * rerun affine estimation on inliers * stitching: new API for parallel feature finding due to ABI breakage new functionality is added to `FeaturesFinder2`, `SurfFeaturesFinder2` and `OrbFeaturesFinder2` * stitching: add tests for parallel feature find API * perf test (about linear speed up) * accuracy test compares results with serial version * stitching: use dynamic_cast to overcome ABI issues adding parallel API to FeaturesFinder breaks ABI. This commit uses dynamic_cast and hardcodes thread-safe finders to avoid breaking ABI. This should be replaced by proper method similar to FeaturesMatcher on next ABI break. * use estimateAffinePartial2D in AffineBestOf2NearestMatcher * add constructor to AffineBestOf2NearestMatcher * allows to choose between full affine transform and partial affine transform. Other params are the as for BestOf2NearestMatcher * added protected field * samples: stitching_detailed support affine estimator and matcher * added new flags to choose matcher and estimator * stitching: rework affine matcher represent transformation in homogeneous coordinates affine matcher: remove duplicite code rework flow to get rid of duplicite code affine matcher: do not center points to (0, 0) it is not needed for affine model. it should not affect estimation in any way. affine matcher: remove unneeded cv namespacing * stitching: add stub bundle adjuster * adds stub bundle adjuster that does nothing * can be used in place of standard bundle adjusters to omit bundle adjusting step * samples: stitching detailed, support no budle adjust * uses new NoBundleAdjuster * added affine warper * uses R to get whole affine transformation and propagates rotation and translation to plane warper * add affine warper factory class * affine warper: compensate transformation * samples: stitching_detailed add support for affine warper * add Stitcher::create method this method follows similar constructor methods and returns smart pointer. This allows constructing Stitcher according to OpenCV guidelines. * supports multiple stitcher configurations (PANORAMA and SCANS) for convenient setup * returns cv::Ptr * stitcher: dynamicaly determine correct estimator we need to use affine estimator for affine matcher * preserves ABI (but add hints for ABI 4) * uses dynamic_cast hack to inject correct estimator * sample stitching: add support for multiple modes shows how to use different configurations of stitcher easily (panorama stitching and scans affine model) * stitcher: find features in parallel use new FeatureFinder API to find features in parallel. Parallelized using TBB. * stitching: disable parallel feature finding for OCL it does not bring much speedup to run features finder in parallel when OpenCL is enabled, because finder needs to wait for OCL device. Also, currently ORB is not thread-safe when OCL is enabled. * stitching: move matcher tests move matchers tests perf_stich.cpp -> perf_matchers.cpp * stitching: add affine stiching integration test test basic affine stitching (SCANS mode of stitcher) with images that have only translation between them * enable surf for stitching tests stitching.b12 test was failing with surf investigated the issue, surf is producing good result. Transformation is only slightly different from ORB, so that resulting pano does not exactly match ORB's result. That caused sanity check to fail. * added size checks similar to other tests * sanity check will be applied only for ORB * stitching: fix wrong estimator choice if case was exactly wrong, estimators were chosen wrong added logging for estimated transformation * enable surf for matchers stitching tests * enable SURF * rework sanity checking. Check estimated transform instead of matches. Est. transform should be more stable and comparable between SURF and ORB. * remove regression checking for VectorFeatures tests. It has a lot if data andtest is the same as previous except it test different vector size for performance, so sanity checking does not add any value here. Added basic sanity asserts instead. * stitching tests: allow relative error for transform * allows .01 relative error for estimated homography sanity check in stitching matchers tests * fix VS warning stitching tests: increase relative error increase relative error to make it pass on all platforms (results are still good). stitching test: allow bigger relative error transformation can differ in small values (with small absolute difference, but large relative difference). transformation output still looks usable for all platforms. This difference affects only mac and windows, linux passes fine with small difference. * stitching: add tests for affine matcher uses s1, s2 images. added also new sanity data. * stitching tests: use different data for matchers tests this data should yeild more stable transformation (it has much more matches, especially for surf). Sanity data regenerated. * stitching test: rework tests for matchers * separated rotation and translations as they are different by scale. * use appropriate absolute error for them separately. (relative error does not work for values near zero.) * stitching: fix affine warper compensation calculation of rotation and translation extracted for plane warper was wrong * stitching test: enable surf for opencl integration tests * enable SURF with correct guard (HAVE_OPENCV_XFEATURES2D) * add OPENCL guard and correct namespace as usual for opencl tests * stitching: add ocl accuracy test for affine warper test consistent results with ocl on and off * stitching: add affine warper ocl perf test add affine warper to existing warper perf tests. Added new sanity data. * stitching: do not overwrite inliers in affine matcher * estimation is run second time on inliers only, inliers produces in second run will not be therefore correct for all matches * calib3d: add Levenberg–Marquardt refining to estimateAffine2D* functions this adds affine Levenberg–Marquardt refining to estimateAffine2D functions similar to what is done in findHomography. implements Levenberg–Marquardt refinig for both full affine and partial affine transformations. * stitching: remove reestimation step in affine matcher reestimation step is not needed. estimateAffine2D* functions are running their own reestimation on inliers using the Levenberg-Marquardt algorithm, which is better than simply rerunning RANSAC on inliers. * implement partial affine bundle adjuster bundle adjuster that expect affine transform with 4DOF. Refines parameters for all cameras together. stitching: fix bug in BundleAdjusterAffinePartial * use the invers properly * use static buffer for invers to speed it up * samples: add affine bundle adjuster option to stitching_detailed * add support for using affine bundle adjuster with 4DOF * improve logging of initial intristics * sttiching: add affine bundle adjuster test * fix build warnings * stitching: increase limit on sanity check prevents spurious test failures on mac. values are still pretty fine. * stitching: set affine bundle adjuster for SCANS mode * fix bug with AffineBestOf2NearestMatcher (we want to select affine partial mode) * select right bundle adjuster * stitching: increase error bound for matcher tests * this prevents failure on mac. tranformation is still ok. * stitching: implement affine bundle adjuster * implements affine bundle adjuster that is using full affine transform * existing test case modified to test both affinePartial an full affine bundle adjuster * add stitching tutorial * show basic usage of stitching api (Stitcher class) * stitching: add more integration test for affine stitching * added new datasets to existing testcase * removed unused include * calib3d: move `haveCollinearPoints` to common header * added comment to make that this also checks too close points * calib3d: redone checkSubset for estimateAffine* callback * use common function to check collinearity * this also ensures that point will not be too close to each other * calib3d: change estimateAffine* functions API * more similar to `findHomography`, `findFundamentalMat`, `findEssentialMat` and similar * follows standard recommended semantic INPUTS, OUTPUTS, FLAGS * allows to disable refining * supported LMEDS robust method (tests yet to come) along with RANSAC * extended docs with some tips * calib3d: rewrite estimateAffine2D test * rewrite in googletest style * parametrize to test both robust methods (RANSAC and LMEDS) * get rid of boilerplate * calib3d: rework estimateAffinePartial2D test * rework in googletest style * add testing for LMEDS * calib3d: rework estimateAffine*2D perf test * test for LMEDS speed * test with/without Levenberg-Marquart * remove sanity checking (this is covered by accuracy tests) * calib3d: improve estimateAffine*2D tests * test transformations in loop * improves test by testing more potential transformations * calib3d: rewrite kernels for estimateAffine*2D functions * use analytical solution instead of SVD * this version is faster especially for smaller amount of points * calib3d: tune up perf of estimateAffine*2D functions * avoid copying inliers * avoid converting input points if not necessary * check only `from` point for collinearity, as `to` does not affect stability of transform * tutorials: add commands examples to stitching tutorials * add some examples how to run stitcher sample code * mention stitching_detailed.cpp * calib3d: change computeError for estimateAffine*2D * do error computing in floats instead of doubles this have required precision + we were storing the result in float anyway. This make code faster and allows auto-vectorization by smart compilers. * documentation: mention estimateAffine*2D function * refer to new functions on appropriate places * prefer estimateAffine*2D over estimateRigidTransform * stitching: add camera models documentations * mention camera models in module documentation to give user a better overview and reduce confusion
8 years ago
imgs.push_back(imread(getDataPath("stitching/newspaper1.jpg")));
imgs.push_back(imread(getDataPath("stitching/newspaper2.jpg")));
imgs.push_back(imread(getDataPath("stitching/newspaper3.jpg")));
imgs.push_back(imread(getDataPath("stitching/newspaper4.jpg")));
width = 1791;
height = 1136;
// we need to boost ORB number of features to be able to stitch this dataset
// SURF works just fine with default settings
if(detector == "orb")
featuresFinder = makePtr<detail::OrbFeaturesFinder>(Size(3,1), 3000);
12 years ago
}
Merge pull request #6933 from hrnr:gsoc_all [GSOC] New camera model for stitching pipeline * implement estimateAffine2D estimates affine transformation using robust RANSAC method. * uses RANSAC framework in calib3d * includes accuracy test * uses SVD decomposition for solving 3 point equation * implement estimateAffinePartial2D estimates limited affine transformation * includes accuracy test * stitching: add affine matcher initial version of matcher that estimates affine transformation * stitching: added affine transform estimator initial version of estimator that simply chain transformations in homogeneous coordinates * calib3d: rename estimateAffine3D test test Calib3d_EstimateAffineTransform rename to Calib3d_EstimateAffine3D. This is more descriptive and prevents confusion with estimateAffine2D tests. * added perf test for estimateAffine functions tests both estimateAffine2D and estimateAffinePartial2D * calib3d: compare error in square in estimateAffine2D * incorporates fix from #6768 * rerun affine estimation on inliers * stitching: new API for parallel feature finding due to ABI breakage new functionality is added to `FeaturesFinder2`, `SurfFeaturesFinder2` and `OrbFeaturesFinder2` * stitching: add tests for parallel feature find API * perf test (about linear speed up) * accuracy test compares results with serial version * stitching: use dynamic_cast to overcome ABI issues adding parallel API to FeaturesFinder breaks ABI. This commit uses dynamic_cast and hardcodes thread-safe finders to avoid breaking ABI. This should be replaced by proper method similar to FeaturesMatcher on next ABI break. * use estimateAffinePartial2D in AffineBestOf2NearestMatcher * add constructor to AffineBestOf2NearestMatcher * allows to choose between full affine transform and partial affine transform. Other params are the as for BestOf2NearestMatcher * added protected field * samples: stitching_detailed support affine estimator and matcher * added new flags to choose matcher and estimator * stitching: rework affine matcher represent transformation in homogeneous coordinates affine matcher: remove duplicite code rework flow to get rid of duplicite code affine matcher: do not center points to (0, 0) it is not needed for affine model. it should not affect estimation in any way. affine matcher: remove unneeded cv namespacing * stitching: add stub bundle adjuster * adds stub bundle adjuster that does nothing * can be used in place of standard bundle adjusters to omit bundle adjusting step * samples: stitching detailed, support no budle adjust * uses new NoBundleAdjuster * added affine warper * uses R to get whole affine transformation and propagates rotation and translation to plane warper * add affine warper factory class * affine warper: compensate transformation * samples: stitching_detailed add support for affine warper * add Stitcher::create method this method follows similar constructor methods and returns smart pointer. This allows constructing Stitcher according to OpenCV guidelines. * supports multiple stitcher configurations (PANORAMA and SCANS) for convenient setup * returns cv::Ptr * stitcher: dynamicaly determine correct estimator we need to use affine estimator for affine matcher * preserves ABI (but add hints for ABI 4) * uses dynamic_cast hack to inject correct estimator * sample stitching: add support for multiple modes shows how to use different configurations of stitcher easily (panorama stitching and scans affine model) * stitcher: find features in parallel use new FeatureFinder API to find features in parallel. Parallelized using TBB. * stitching: disable parallel feature finding for OCL it does not bring much speedup to run features finder in parallel when OpenCL is enabled, because finder needs to wait for OCL device. Also, currently ORB is not thread-safe when OCL is enabled. * stitching: move matcher tests move matchers tests perf_stich.cpp -> perf_matchers.cpp * stitching: add affine stiching integration test test basic affine stitching (SCANS mode of stitcher) with images that have only translation between them * enable surf for stitching tests stitching.b12 test was failing with surf investigated the issue, surf is producing good result. Transformation is only slightly different from ORB, so that resulting pano does not exactly match ORB's result. That caused sanity check to fail. * added size checks similar to other tests * sanity check will be applied only for ORB * stitching: fix wrong estimator choice if case was exactly wrong, estimators were chosen wrong added logging for estimated transformation * enable surf for matchers stitching tests * enable SURF * rework sanity checking. Check estimated transform instead of matches. Est. transform should be more stable and comparable between SURF and ORB. * remove regression checking for VectorFeatures tests. It has a lot if data andtest is the same as previous except it test different vector size for performance, so sanity checking does not add any value here. Added basic sanity asserts instead. * stitching tests: allow relative error for transform * allows .01 relative error for estimated homography sanity check in stitching matchers tests * fix VS warning stitching tests: increase relative error increase relative error to make it pass on all platforms (results are still good). stitching test: allow bigger relative error transformation can differ in small values (with small absolute difference, but large relative difference). transformation output still looks usable for all platforms. This difference affects only mac and windows, linux passes fine with small difference. * stitching: add tests for affine matcher uses s1, s2 images. added also new sanity data. * stitching tests: use different data for matchers tests this data should yeild more stable transformation (it has much more matches, especially for surf). Sanity data regenerated. * stitching test: rework tests for matchers * separated rotation and translations as they are different by scale. * use appropriate absolute error for them separately. (relative error does not work for values near zero.) * stitching: fix affine warper compensation calculation of rotation and translation extracted for plane warper was wrong * stitching test: enable surf for opencl integration tests * enable SURF with correct guard (HAVE_OPENCV_XFEATURES2D) * add OPENCL guard and correct namespace as usual for opencl tests * stitching: add ocl accuracy test for affine warper test consistent results with ocl on and off * stitching: add affine warper ocl perf test add affine warper to existing warper perf tests. Added new sanity data. * stitching: do not overwrite inliers in affine matcher * estimation is run second time on inliers only, inliers produces in second run will not be therefore correct for all matches * calib3d: add Levenberg–Marquardt refining to estimateAffine2D* functions this adds affine Levenberg–Marquardt refining to estimateAffine2D functions similar to what is done in findHomography. implements Levenberg–Marquardt refinig for both full affine and partial affine transformations. * stitching: remove reestimation step in affine matcher reestimation step is not needed. estimateAffine2D* functions are running their own reestimation on inliers using the Levenberg-Marquardt algorithm, which is better than simply rerunning RANSAC on inliers. * implement partial affine bundle adjuster bundle adjuster that expect affine transform with 4DOF. Refines parameters for all cameras together. stitching: fix bug in BundleAdjusterAffinePartial * use the invers properly * use static buffer for invers to speed it up * samples: add affine bundle adjuster option to stitching_detailed * add support for using affine bundle adjuster with 4DOF * improve logging of initial intristics * sttiching: add affine bundle adjuster test * fix build warnings * stitching: increase limit on sanity check prevents spurious test failures on mac. values are still pretty fine. * stitching: set affine bundle adjuster for SCANS mode * fix bug with AffineBestOf2NearestMatcher (we want to select affine partial mode) * select right bundle adjuster * stitching: increase error bound for matcher tests * this prevents failure on mac. tranformation is still ok. * stitching: implement affine bundle adjuster * implements affine bundle adjuster that is using full affine transform * existing test case modified to test both affinePartial an full affine bundle adjuster * add stitching tutorial * show basic usage of stitching api (Stitcher class) * stitching: add more integration test for affine stitching * added new datasets to existing testcase * removed unused include * calib3d: move `haveCollinearPoints` to common header * added comment to make that this also checks too close points * calib3d: redone checkSubset for estimateAffine* callback * use common function to check collinearity * this also ensures that point will not be too close to each other * calib3d: change estimateAffine* functions API * more similar to `findHomography`, `findFundamentalMat`, `findEssentialMat` and similar * follows standard recommended semantic INPUTS, OUTPUTS, FLAGS * allows to disable refining * supported LMEDS robust method (tests yet to come) along with RANSAC * extended docs with some tips * calib3d: rewrite estimateAffine2D test * rewrite in googletest style * parametrize to test both robust methods (RANSAC and LMEDS) * get rid of boilerplate * calib3d: rework estimateAffinePartial2D test * rework in googletest style * add testing for LMEDS * calib3d: rework estimateAffine*2D perf test * test for LMEDS speed * test with/without Levenberg-Marquart * remove sanity checking (this is covered by accuracy tests) * calib3d: improve estimateAffine*2D tests * test transformations in loop * improves test by testing more potential transformations * calib3d: rewrite kernels for estimateAffine*2D functions * use analytical solution instead of SVD * this version is faster especially for smaller amount of points * calib3d: tune up perf of estimateAffine*2D functions * avoid copying inliers * avoid converting input points if not necessary * check only `from` point for collinearity, as `to` does not affect stability of transform * tutorials: add commands examples to stitching tutorials * add some examples how to run stitcher sample code * mention stitching_detailed.cpp * calib3d: change computeError for estimateAffine*2D * do error computing in floats instead of doubles this have required precision + we were storing the result in float anyway. This make code faster and allows auto-vectorization by smart compilers. * documentation: mention estimateAffine*2D function * refer to new functions on appropriate places * prefer estimateAffine*2D over estimateRigidTransform * stitching: add camera models documentations * mention camera models in module documentation to give user a better overview and reduce confusion
8 years ago
else if (dataset == "prague")
12 years ago
{
Merge pull request #6933 from hrnr:gsoc_all [GSOC] New camera model for stitching pipeline * implement estimateAffine2D estimates affine transformation using robust RANSAC method. * uses RANSAC framework in calib3d * includes accuracy test * uses SVD decomposition for solving 3 point equation * implement estimateAffinePartial2D estimates limited affine transformation * includes accuracy test * stitching: add affine matcher initial version of matcher that estimates affine transformation * stitching: added affine transform estimator initial version of estimator that simply chain transformations in homogeneous coordinates * calib3d: rename estimateAffine3D test test Calib3d_EstimateAffineTransform rename to Calib3d_EstimateAffine3D. This is more descriptive and prevents confusion with estimateAffine2D tests. * added perf test for estimateAffine functions tests both estimateAffine2D and estimateAffinePartial2D * calib3d: compare error in square in estimateAffine2D * incorporates fix from #6768 * rerun affine estimation on inliers * stitching: new API for parallel feature finding due to ABI breakage new functionality is added to `FeaturesFinder2`, `SurfFeaturesFinder2` and `OrbFeaturesFinder2` * stitching: add tests for parallel feature find API * perf test (about linear speed up) * accuracy test compares results with serial version * stitching: use dynamic_cast to overcome ABI issues adding parallel API to FeaturesFinder breaks ABI. This commit uses dynamic_cast and hardcodes thread-safe finders to avoid breaking ABI. This should be replaced by proper method similar to FeaturesMatcher on next ABI break. * use estimateAffinePartial2D in AffineBestOf2NearestMatcher * add constructor to AffineBestOf2NearestMatcher * allows to choose between full affine transform and partial affine transform. Other params are the as for BestOf2NearestMatcher * added protected field * samples: stitching_detailed support affine estimator and matcher * added new flags to choose matcher and estimator * stitching: rework affine matcher represent transformation in homogeneous coordinates affine matcher: remove duplicite code rework flow to get rid of duplicite code affine matcher: do not center points to (0, 0) it is not needed for affine model. it should not affect estimation in any way. affine matcher: remove unneeded cv namespacing * stitching: add stub bundle adjuster * adds stub bundle adjuster that does nothing * can be used in place of standard bundle adjusters to omit bundle adjusting step * samples: stitching detailed, support no budle adjust * uses new NoBundleAdjuster * added affine warper * uses R to get whole affine transformation and propagates rotation and translation to plane warper * add affine warper factory class * affine warper: compensate transformation * samples: stitching_detailed add support for affine warper * add Stitcher::create method this method follows similar constructor methods and returns smart pointer. This allows constructing Stitcher according to OpenCV guidelines. * supports multiple stitcher configurations (PANORAMA and SCANS) for convenient setup * returns cv::Ptr * stitcher: dynamicaly determine correct estimator we need to use affine estimator for affine matcher * preserves ABI (but add hints for ABI 4) * uses dynamic_cast hack to inject correct estimator * sample stitching: add support for multiple modes shows how to use different configurations of stitcher easily (panorama stitching and scans affine model) * stitcher: find features in parallel use new FeatureFinder API to find features in parallel. Parallelized using TBB. * stitching: disable parallel feature finding for OCL it does not bring much speedup to run features finder in parallel when OpenCL is enabled, because finder needs to wait for OCL device. Also, currently ORB is not thread-safe when OCL is enabled. * stitching: move matcher tests move matchers tests perf_stich.cpp -> perf_matchers.cpp * stitching: add affine stiching integration test test basic affine stitching (SCANS mode of stitcher) with images that have only translation between them * enable surf for stitching tests stitching.b12 test was failing with surf investigated the issue, surf is producing good result. Transformation is only slightly different from ORB, so that resulting pano does not exactly match ORB's result. That caused sanity check to fail. * added size checks similar to other tests * sanity check will be applied only for ORB * stitching: fix wrong estimator choice if case was exactly wrong, estimators were chosen wrong added logging for estimated transformation * enable surf for matchers stitching tests * enable SURF * rework sanity checking. Check estimated transform instead of matches. Est. transform should be more stable and comparable between SURF and ORB. * remove regression checking for VectorFeatures tests. It has a lot if data andtest is the same as previous except it test different vector size for performance, so sanity checking does not add any value here. Added basic sanity asserts instead. * stitching tests: allow relative error for transform * allows .01 relative error for estimated homography sanity check in stitching matchers tests * fix VS warning stitching tests: increase relative error increase relative error to make it pass on all platforms (results are still good). stitching test: allow bigger relative error transformation can differ in small values (with small absolute difference, but large relative difference). transformation output still looks usable for all platforms. This difference affects only mac and windows, linux passes fine with small difference. * stitching: add tests for affine matcher uses s1, s2 images. added also new sanity data. * stitching tests: use different data for matchers tests this data should yeild more stable transformation (it has much more matches, especially for surf). Sanity data regenerated. * stitching test: rework tests for matchers * separated rotation and translations as they are different by scale. * use appropriate absolute error for them separately. (relative error does not work for values near zero.) * stitching: fix affine warper compensation calculation of rotation and translation extracted for plane warper was wrong * stitching test: enable surf for opencl integration tests * enable SURF with correct guard (HAVE_OPENCV_XFEATURES2D) * add OPENCL guard and correct namespace as usual for opencl tests * stitching: add ocl accuracy test for affine warper test consistent results with ocl on and off * stitching: add affine warper ocl perf test add affine warper to existing warper perf tests. Added new sanity data. * stitching: do not overwrite inliers in affine matcher * estimation is run second time on inliers only, inliers produces in second run will not be therefore correct for all matches * calib3d: add Levenberg–Marquardt refining to estimateAffine2D* functions this adds affine Levenberg–Marquardt refining to estimateAffine2D functions similar to what is done in findHomography. implements Levenberg–Marquardt refinig for both full affine and partial affine transformations. * stitching: remove reestimation step in affine matcher reestimation step is not needed. estimateAffine2D* functions are running their own reestimation on inliers using the Levenberg-Marquardt algorithm, which is better than simply rerunning RANSAC on inliers. * implement partial affine bundle adjuster bundle adjuster that expect affine transform with 4DOF. Refines parameters for all cameras together. stitching: fix bug in BundleAdjusterAffinePartial * use the invers properly * use static buffer for invers to speed it up * samples: add affine bundle adjuster option to stitching_detailed * add support for using affine bundle adjuster with 4DOF * improve logging of initial intristics * sttiching: add affine bundle adjuster test * fix build warnings * stitching: increase limit on sanity check prevents spurious test failures on mac. values are still pretty fine. * stitching: set affine bundle adjuster for SCANS mode * fix bug with AffineBestOf2NearestMatcher (we want to select affine partial mode) * select right bundle adjuster * stitching: increase error bound for matcher tests * this prevents failure on mac. tranformation is still ok. * stitching: implement affine bundle adjuster * implements affine bundle adjuster that is using full affine transform * existing test case modified to test both affinePartial an full affine bundle adjuster * add stitching tutorial * show basic usage of stitching api (Stitcher class) * stitching: add more integration test for affine stitching * added new datasets to existing testcase * removed unused include * calib3d: move `haveCollinearPoints` to common header * added comment to make that this also checks too close points * calib3d: redone checkSubset for estimateAffine* callback * use common function to check collinearity * this also ensures that point will not be too close to each other * calib3d: change estimateAffine* functions API * more similar to `findHomography`, `findFundamentalMat`, `findEssentialMat` and similar * follows standard recommended semantic INPUTS, OUTPUTS, FLAGS * allows to disable refining * supported LMEDS robust method (tests yet to come) along with RANSAC * extended docs with some tips * calib3d: rewrite estimateAffine2D test * rewrite in googletest style * parametrize to test both robust methods (RANSAC and LMEDS) * get rid of boilerplate * calib3d: rework estimateAffinePartial2D test * rework in googletest style * add testing for LMEDS * calib3d: rework estimateAffine*2D perf test * test for LMEDS speed * test with/without Levenberg-Marquart * remove sanity checking (this is covered by accuracy tests) * calib3d: improve estimateAffine*2D tests * test transformations in loop * improves test by testing more potential transformations * calib3d: rewrite kernels for estimateAffine*2D functions * use analytical solution instead of SVD * this version is faster especially for smaller amount of points * calib3d: tune up perf of estimateAffine*2D functions * avoid copying inliers * avoid converting input points if not necessary * check only `from` point for collinearity, as `to` does not affect stability of transform * tutorials: add commands examples to stitching tutorials * add some examples how to run stitcher sample code * mention stitching_detailed.cpp * calib3d: change computeError for estimateAffine*2D * do error computing in floats instead of doubles this have required precision + we were storing the result in float anyway. This make code faster and allows auto-vectorization by smart compilers. * documentation: mention estimateAffine*2D function * refer to new functions on appropriate places * prefer estimateAffine*2D over estimateRigidTransform * stitching: add camera models documentations * mention camera models in module documentation to give user a better overview and reduce confusion
8 years ago
imgs.push_back(imread(getDataPath("stitching/prague1.jpg")));
imgs.push_back(imread(getDataPath("stitching/prague2.jpg")));
width = 983;
height = 1759;
12 years ago
}
Merge pull request #6933 from hrnr:gsoc_all [GSOC] New camera model for stitching pipeline * implement estimateAffine2D estimates affine transformation using robust RANSAC method. * uses RANSAC framework in calib3d * includes accuracy test * uses SVD decomposition for solving 3 point equation * implement estimateAffinePartial2D estimates limited affine transformation * includes accuracy test * stitching: add affine matcher initial version of matcher that estimates affine transformation * stitching: added affine transform estimator initial version of estimator that simply chain transformations in homogeneous coordinates * calib3d: rename estimateAffine3D test test Calib3d_EstimateAffineTransform rename to Calib3d_EstimateAffine3D. This is more descriptive and prevents confusion with estimateAffine2D tests. * added perf test for estimateAffine functions tests both estimateAffine2D and estimateAffinePartial2D * calib3d: compare error in square in estimateAffine2D * incorporates fix from #6768 * rerun affine estimation on inliers * stitching: new API for parallel feature finding due to ABI breakage new functionality is added to `FeaturesFinder2`, `SurfFeaturesFinder2` and `OrbFeaturesFinder2` * stitching: add tests for parallel feature find API * perf test (about linear speed up) * accuracy test compares results with serial version * stitching: use dynamic_cast to overcome ABI issues adding parallel API to FeaturesFinder breaks ABI. This commit uses dynamic_cast and hardcodes thread-safe finders to avoid breaking ABI. This should be replaced by proper method similar to FeaturesMatcher on next ABI break. * use estimateAffinePartial2D in AffineBestOf2NearestMatcher * add constructor to AffineBestOf2NearestMatcher * allows to choose between full affine transform and partial affine transform. Other params are the as for BestOf2NearestMatcher * added protected field * samples: stitching_detailed support affine estimator and matcher * added new flags to choose matcher and estimator * stitching: rework affine matcher represent transformation in homogeneous coordinates affine matcher: remove duplicite code rework flow to get rid of duplicite code affine matcher: do not center points to (0, 0) it is not needed for affine model. it should not affect estimation in any way. affine matcher: remove unneeded cv namespacing * stitching: add stub bundle adjuster * adds stub bundle adjuster that does nothing * can be used in place of standard bundle adjusters to omit bundle adjusting step * samples: stitching detailed, support no budle adjust * uses new NoBundleAdjuster * added affine warper * uses R to get whole affine transformation and propagates rotation and translation to plane warper * add affine warper factory class * affine warper: compensate transformation * samples: stitching_detailed add support for affine warper * add Stitcher::create method this method follows similar constructor methods and returns smart pointer. This allows constructing Stitcher according to OpenCV guidelines. * supports multiple stitcher configurations (PANORAMA and SCANS) for convenient setup * returns cv::Ptr * stitcher: dynamicaly determine correct estimator we need to use affine estimator for affine matcher * preserves ABI (but add hints for ABI 4) * uses dynamic_cast hack to inject correct estimator * sample stitching: add support for multiple modes shows how to use different configurations of stitcher easily (panorama stitching and scans affine model) * stitcher: find features in parallel use new FeatureFinder API to find features in parallel. Parallelized using TBB. * stitching: disable parallel feature finding for OCL it does not bring much speedup to run features finder in parallel when OpenCL is enabled, because finder needs to wait for OCL device. Also, currently ORB is not thread-safe when OCL is enabled. * stitching: move matcher tests move matchers tests perf_stich.cpp -> perf_matchers.cpp * stitching: add affine stiching integration test test basic affine stitching (SCANS mode of stitcher) with images that have only translation between them * enable surf for stitching tests stitching.b12 test was failing with surf investigated the issue, surf is producing good result. Transformation is only slightly different from ORB, so that resulting pano does not exactly match ORB's result. That caused sanity check to fail. * added size checks similar to other tests * sanity check will be applied only for ORB * stitching: fix wrong estimator choice if case was exactly wrong, estimators were chosen wrong added logging for estimated transformation * enable surf for matchers stitching tests * enable SURF * rework sanity checking. Check estimated transform instead of matches. Est. transform should be more stable and comparable between SURF and ORB. * remove regression checking for VectorFeatures tests. It has a lot if data andtest is the same as previous except it test different vector size for performance, so sanity checking does not add any value here. Added basic sanity asserts instead. * stitching tests: allow relative error for transform * allows .01 relative error for estimated homography sanity check in stitching matchers tests * fix VS warning stitching tests: increase relative error increase relative error to make it pass on all platforms (results are still good). stitching test: allow bigger relative error transformation can differ in small values (with small absolute difference, but large relative difference). transformation output still looks usable for all platforms. This difference affects only mac and windows, linux passes fine with small difference. * stitching: add tests for affine matcher uses s1, s2 images. added also new sanity data. * stitching tests: use different data for matchers tests this data should yeild more stable transformation (it has much more matches, especially for surf). Sanity data regenerated. * stitching test: rework tests for matchers * separated rotation and translations as they are different by scale. * use appropriate absolute error for them separately. (relative error does not work for values near zero.) * stitching: fix affine warper compensation calculation of rotation and translation extracted for plane warper was wrong * stitching test: enable surf for opencl integration tests * enable SURF with correct guard (HAVE_OPENCV_XFEATURES2D) * add OPENCL guard and correct namespace as usual for opencl tests * stitching: add ocl accuracy test for affine warper test consistent results with ocl on and off * stitching: add affine warper ocl perf test add affine warper to existing warper perf tests. Added new sanity data. * stitching: do not overwrite inliers in affine matcher * estimation is run second time on inliers only, inliers produces in second run will not be therefore correct for all matches * calib3d: add Levenberg–Marquardt refining to estimateAffine2D* functions this adds affine Levenberg–Marquardt refining to estimateAffine2D functions similar to what is done in findHomography. implements Levenberg–Marquardt refinig for both full affine and partial affine transformations. * stitching: remove reestimation step in affine matcher reestimation step is not needed. estimateAffine2D* functions are running their own reestimation on inliers using the Levenberg-Marquardt algorithm, which is better than simply rerunning RANSAC on inliers. * implement partial affine bundle adjuster bundle adjuster that expect affine transform with 4DOF. Refines parameters for all cameras together. stitching: fix bug in BundleAdjusterAffinePartial * use the invers properly * use static buffer for invers to speed it up * samples: add affine bundle adjuster option to stitching_detailed * add support for using affine bundle adjuster with 4DOF * improve logging of initial intristics * sttiching: add affine bundle adjuster test * fix build warnings * stitching: increase limit on sanity check prevents spurious test failures on mac. values are still pretty fine. * stitching: set affine bundle adjuster for SCANS mode * fix bug with AffineBestOf2NearestMatcher (we want to select affine partial mode) * select right bundle adjuster * stitching: increase error bound for matcher tests * this prevents failure on mac. tranformation is still ok. * stitching: implement affine bundle adjuster * implements affine bundle adjuster that is using full affine transform * existing test case modified to test both affinePartial an full affine bundle adjuster * add stitching tutorial * show basic usage of stitching api (Stitcher class) * stitching: add more integration test for affine stitching * added new datasets to existing testcase * removed unused include * calib3d: move `haveCollinearPoints` to common header * added comment to make that this also checks too close points * calib3d: redone checkSubset for estimateAffine* callback * use common function to check collinearity * this also ensures that point will not be too close to each other * calib3d: change estimateAffine* functions API * more similar to `findHomography`, `findFundamentalMat`, `findEssentialMat` and similar * follows standard recommended semantic INPUTS, OUTPUTS, FLAGS * allows to disable refining * supported LMEDS robust method (tests yet to come) along with RANSAC * extended docs with some tips * calib3d: rewrite estimateAffine2D test * rewrite in googletest style * parametrize to test both robust methods (RANSAC and LMEDS) * get rid of boilerplate * calib3d: rework estimateAffinePartial2D test * rework in googletest style * add testing for LMEDS * calib3d: rework estimateAffine*2D perf test * test for LMEDS speed * test with/without Levenberg-Marquart * remove sanity checking (this is covered by accuracy tests) * calib3d: improve estimateAffine*2D tests * test transformations in loop * improves test by testing more potential transformations * calib3d: rewrite kernels for estimateAffine*2D functions * use analytical solution instead of SVD * this version is faster especially for smaller amount of points * calib3d: tune up perf of estimateAffine*2D functions * avoid copying inliers * avoid converting input points if not necessary * check only `from` point for collinearity, as `to` does not affect stability of transform * tutorials: add commands examples to stitching tutorials * add some examples how to run stitcher sample code * mention stitching_detailed.cpp * calib3d: change computeError for estimateAffine*2D * do error computing in floats instead of doubles this have required precision + we were storing the result in float anyway. This make code faster and allows auto-vectorization by smart compilers. * documentation: mention estimateAffine*2D function * refer to new functions on appropriate places * prefer estimateAffine*2D over estimateRigidTransform * stitching: add camera models documentations * mention camera models in module documentation to give user a better overview and reduce confusion
8 years ago
else // dataset == "s"
12 years ago
{
Merge pull request #6933 from hrnr:gsoc_all [GSOC] New camera model for stitching pipeline * implement estimateAffine2D estimates affine transformation using robust RANSAC method. * uses RANSAC framework in calib3d * includes accuracy test * uses SVD decomposition for solving 3 point equation * implement estimateAffinePartial2D estimates limited affine transformation * includes accuracy test * stitching: add affine matcher initial version of matcher that estimates affine transformation * stitching: added affine transform estimator initial version of estimator that simply chain transformations in homogeneous coordinates * calib3d: rename estimateAffine3D test test Calib3d_EstimateAffineTransform rename to Calib3d_EstimateAffine3D. This is more descriptive and prevents confusion with estimateAffine2D tests. * added perf test for estimateAffine functions tests both estimateAffine2D and estimateAffinePartial2D * calib3d: compare error in square in estimateAffine2D * incorporates fix from #6768 * rerun affine estimation on inliers * stitching: new API for parallel feature finding due to ABI breakage new functionality is added to `FeaturesFinder2`, `SurfFeaturesFinder2` and `OrbFeaturesFinder2` * stitching: add tests for parallel feature find API * perf test (about linear speed up) * accuracy test compares results with serial version * stitching: use dynamic_cast to overcome ABI issues adding parallel API to FeaturesFinder breaks ABI. This commit uses dynamic_cast and hardcodes thread-safe finders to avoid breaking ABI. This should be replaced by proper method similar to FeaturesMatcher on next ABI break. * use estimateAffinePartial2D in AffineBestOf2NearestMatcher * add constructor to AffineBestOf2NearestMatcher * allows to choose between full affine transform and partial affine transform. Other params are the as for BestOf2NearestMatcher * added protected field * samples: stitching_detailed support affine estimator and matcher * added new flags to choose matcher and estimator * stitching: rework affine matcher represent transformation in homogeneous coordinates affine matcher: remove duplicite code rework flow to get rid of duplicite code affine matcher: do not center points to (0, 0) it is not needed for affine model. it should not affect estimation in any way. affine matcher: remove unneeded cv namespacing * stitching: add stub bundle adjuster * adds stub bundle adjuster that does nothing * can be used in place of standard bundle adjusters to omit bundle adjusting step * samples: stitching detailed, support no budle adjust * uses new NoBundleAdjuster * added affine warper * uses R to get whole affine transformation and propagates rotation and translation to plane warper * add affine warper factory class * affine warper: compensate transformation * samples: stitching_detailed add support for affine warper * add Stitcher::create method this method follows similar constructor methods and returns smart pointer. This allows constructing Stitcher according to OpenCV guidelines. * supports multiple stitcher configurations (PANORAMA and SCANS) for convenient setup * returns cv::Ptr * stitcher: dynamicaly determine correct estimator we need to use affine estimator for affine matcher * preserves ABI (but add hints for ABI 4) * uses dynamic_cast hack to inject correct estimator * sample stitching: add support for multiple modes shows how to use different configurations of stitcher easily (panorama stitching and scans affine model) * stitcher: find features in parallel use new FeatureFinder API to find features in parallel. Parallelized using TBB. * stitching: disable parallel feature finding for OCL it does not bring much speedup to run features finder in parallel when OpenCL is enabled, because finder needs to wait for OCL device. Also, currently ORB is not thread-safe when OCL is enabled. * stitching: move matcher tests move matchers tests perf_stich.cpp -> perf_matchers.cpp * stitching: add affine stiching integration test test basic affine stitching (SCANS mode of stitcher) with images that have only translation between them * enable surf for stitching tests stitching.b12 test was failing with surf investigated the issue, surf is producing good result. Transformation is only slightly different from ORB, so that resulting pano does not exactly match ORB's result. That caused sanity check to fail. * added size checks similar to other tests * sanity check will be applied only for ORB * stitching: fix wrong estimator choice if case was exactly wrong, estimators were chosen wrong added logging for estimated transformation * enable surf for matchers stitching tests * enable SURF * rework sanity checking. Check estimated transform instead of matches. Est. transform should be more stable and comparable between SURF and ORB. * remove regression checking for VectorFeatures tests. It has a lot if data andtest is the same as previous except it test different vector size for performance, so sanity checking does not add any value here. Added basic sanity asserts instead. * stitching tests: allow relative error for transform * allows .01 relative error for estimated homography sanity check in stitching matchers tests * fix VS warning stitching tests: increase relative error increase relative error to make it pass on all platforms (results are still good). stitching test: allow bigger relative error transformation can differ in small values (with small absolute difference, but large relative difference). transformation output still looks usable for all platforms. This difference affects only mac and windows, linux passes fine with small difference. * stitching: add tests for affine matcher uses s1, s2 images. added also new sanity data. * stitching tests: use different data for matchers tests this data should yeild more stable transformation (it has much more matches, especially for surf). Sanity data regenerated. * stitching test: rework tests for matchers * separated rotation and translations as they are different by scale. * use appropriate absolute error for them separately. (relative error does not work for values near zero.) * stitching: fix affine warper compensation calculation of rotation and translation extracted for plane warper was wrong * stitching test: enable surf for opencl integration tests * enable SURF with correct guard (HAVE_OPENCV_XFEATURES2D) * add OPENCL guard and correct namespace as usual for opencl tests * stitching: add ocl accuracy test for affine warper test consistent results with ocl on and off * stitching: add affine warper ocl perf test add affine warper to existing warper perf tests. Added new sanity data. * stitching: do not overwrite inliers in affine matcher * estimation is run second time on inliers only, inliers produces in second run will not be therefore correct for all matches * calib3d: add Levenberg–Marquardt refining to estimateAffine2D* functions this adds affine Levenberg–Marquardt refining to estimateAffine2D functions similar to what is done in findHomography. implements Levenberg–Marquardt refinig for both full affine and partial affine transformations. * stitching: remove reestimation step in affine matcher reestimation step is not needed. estimateAffine2D* functions are running their own reestimation on inliers using the Levenberg-Marquardt algorithm, which is better than simply rerunning RANSAC on inliers. * implement partial affine bundle adjuster bundle adjuster that expect affine transform with 4DOF. Refines parameters for all cameras together. stitching: fix bug in BundleAdjusterAffinePartial * use the invers properly * use static buffer for invers to speed it up * samples: add affine bundle adjuster option to stitching_detailed * add support for using affine bundle adjuster with 4DOF * improve logging of initial intristics * sttiching: add affine bundle adjuster test * fix build warnings * stitching: increase limit on sanity check prevents spurious test failures on mac. values are still pretty fine. * stitching: set affine bundle adjuster for SCANS mode * fix bug with AffineBestOf2NearestMatcher (we want to select affine partial mode) * select right bundle adjuster * stitching: increase error bound for matcher tests * this prevents failure on mac. tranformation is still ok. * stitching: implement affine bundle adjuster * implements affine bundle adjuster that is using full affine transform * existing test case modified to test both affinePartial an full affine bundle adjuster * add stitching tutorial * show basic usage of stitching api (Stitcher class) * stitching: add more integration test for affine stitching * added new datasets to existing testcase * removed unused include * calib3d: move `haveCollinearPoints` to common header * added comment to make that this also checks too close points * calib3d: redone checkSubset for estimateAffine* callback * use common function to check collinearity * this also ensures that point will not be too close to each other * calib3d: change estimateAffine* functions API * more similar to `findHomography`, `findFundamentalMat`, `findEssentialMat` and similar * follows standard recommended semantic INPUTS, OUTPUTS, FLAGS * allows to disable refining * supported LMEDS robust method (tests yet to come) along with RANSAC * extended docs with some tips * calib3d: rewrite estimateAffine2D test * rewrite in googletest style * parametrize to test both robust methods (RANSAC and LMEDS) * get rid of boilerplate * calib3d: rework estimateAffinePartial2D test * rework in googletest style * add testing for LMEDS * calib3d: rework estimateAffine*2D perf test * test for LMEDS speed * test with/without Levenberg-Marquart * remove sanity checking (this is covered by accuracy tests) * calib3d: improve estimateAffine*2D tests * test transformations in loop * improves test by testing more potential transformations * calib3d: rewrite kernels for estimateAffine*2D functions * use analytical solution instead of SVD * this version is faster especially for smaller amount of points * calib3d: tune up perf of estimateAffine*2D functions * avoid copying inliers * avoid converting input points if not necessary * check only `from` point for collinearity, as `to` does not affect stability of transform * tutorials: add commands examples to stitching tutorials * add some examples how to run stitcher sample code * mention stitching_detailed.cpp * calib3d: change computeError for estimateAffine*2D * do error computing in floats instead of doubles this have required precision + we were storing the result in float anyway. This make code faster and allows auto-vectorization by smart compilers. * documentation: mention estimateAffine*2D function * refer to new functions on appropriate places * prefer estimateAffine*2D over estimateRigidTransform * stitching: add camera models documentations * mention camera models in module documentation to give user a better overview and reduce confusion
8 years ago
imgs.push_back(imread(getDataPath("stitching/s1.jpg")));
imgs.push_back(imread(getDataPath("stitching/s2.jpg")));
width = 1815;
height = 700;
12 years ago
}
Merge pull request #6933 from hrnr:gsoc_all [GSOC] New camera model for stitching pipeline * implement estimateAffine2D estimates affine transformation using robust RANSAC method. * uses RANSAC framework in calib3d * includes accuracy test * uses SVD decomposition for solving 3 point equation * implement estimateAffinePartial2D estimates limited affine transformation * includes accuracy test * stitching: add affine matcher initial version of matcher that estimates affine transformation * stitching: added affine transform estimator initial version of estimator that simply chain transformations in homogeneous coordinates * calib3d: rename estimateAffine3D test test Calib3d_EstimateAffineTransform rename to Calib3d_EstimateAffine3D. This is more descriptive and prevents confusion with estimateAffine2D tests. * added perf test for estimateAffine functions tests both estimateAffine2D and estimateAffinePartial2D * calib3d: compare error in square in estimateAffine2D * incorporates fix from #6768 * rerun affine estimation on inliers * stitching: new API for parallel feature finding due to ABI breakage new functionality is added to `FeaturesFinder2`, `SurfFeaturesFinder2` and `OrbFeaturesFinder2` * stitching: add tests for parallel feature find API * perf test (about linear speed up) * accuracy test compares results with serial version * stitching: use dynamic_cast to overcome ABI issues adding parallel API to FeaturesFinder breaks ABI. This commit uses dynamic_cast and hardcodes thread-safe finders to avoid breaking ABI. This should be replaced by proper method similar to FeaturesMatcher on next ABI break. * use estimateAffinePartial2D in AffineBestOf2NearestMatcher * add constructor to AffineBestOf2NearestMatcher * allows to choose between full affine transform and partial affine transform. Other params are the as for BestOf2NearestMatcher * added protected field * samples: stitching_detailed support affine estimator and matcher * added new flags to choose matcher and estimator * stitching: rework affine matcher represent transformation in homogeneous coordinates affine matcher: remove duplicite code rework flow to get rid of duplicite code affine matcher: do not center points to (0, 0) it is not needed for affine model. it should not affect estimation in any way. affine matcher: remove unneeded cv namespacing * stitching: add stub bundle adjuster * adds stub bundle adjuster that does nothing * can be used in place of standard bundle adjusters to omit bundle adjusting step * samples: stitching detailed, support no budle adjust * uses new NoBundleAdjuster * added affine warper * uses R to get whole affine transformation and propagates rotation and translation to plane warper * add affine warper factory class * affine warper: compensate transformation * samples: stitching_detailed add support for affine warper * add Stitcher::create method this method follows similar constructor methods and returns smart pointer. This allows constructing Stitcher according to OpenCV guidelines. * supports multiple stitcher configurations (PANORAMA and SCANS) for convenient setup * returns cv::Ptr * stitcher: dynamicaly determine correct estimator we need to use affine estimator for affine matcher * preserves ABI (but add hints for ABI 4) * uses dynamic_cast hack to inject correct estimator * sample stitching: add support for multiple modes shows how to use different configurations of stitcher easily (panorama stitching and scans affine model) * stitcher: find features in parallel use new FeatureFinder API to find features in parallel. Parallelized using TBB. * stitching: disable parallel feature finding for OCL it does not bring much speedup to run features finder in parallel when OpenCL is enabled, because finder needs to wait for OCL device. Also, currently ORB is not thread-safe when OCL is enabled. * stitching: move matcher tests move matchers tests perf_stich.cpp -> perf_matchers.cpp * stitching: add affine stiching integration test test basic affine stitching (SCANS mode of stitcher) with images that have only translation between them * enable surf for stitching tests stitching.b12 test was failing with surf investigated the issue, surf is producing good result. Transformation is only slightly different from ORB, so that resulting pano does not exactly match ORB's result. That caused sanity check to fail. * added size checks similar to other tests * sanity check will be applied only for ORB * stitching: fix wrong estimator choice if case was exactly wrong, estimators were chosen wrong added logging for estimated transformation * enable surf for matchers stitching tests * enable SURF * rework sanity checking. Check estimated transform instead of matches. Est. transform should be more stable and comparable between SURF and ORB. * remove regression checking for VectorFeatures tests. It has a lot if data andtest is the same as previous except it test different vector size for performance, so sanity checking does not add any value here. Added basic sanity asserts instead. * stitching tests: allow relative error for transform * allows .01 relative error for estimated homography sanity check in stitching matchers tests * fix VS warning stitching tests: increase relative error increase relative error to make it pass on all platforms (results are still good). stitching test: allow bigger relative error transformation can differ in small values (with small absolute difference, but large relative difference). transformation output still looks usable for all platforms. This difference affects only mac and windows, linux passes fine with small difference. * stitching: add tests for affine matcher uses s1, s2 images. added also new sanity data. * stitching tests: use different data for matchers tests this data should yeild more stable transformation (it has much more matches, especially for surf). Sanity data regenerated. * stitching test: rework tests for matchers * separated rotation and translations as they are different by scale. * use appropriate absolute error for them separately. (relative error does not work for values near zero.) * stitching: fix affine warper compensation calculation of rotation and translation extracted for plane warper was wrong * stitching test: enable surf for opencl integration tests * enable SURF with correct guard (HAVE_OPENCV_XFEATURES2D) * add OPENCL guard and correct namespace as usual for opencl tests * stitching: add ocl accuracy test for affine warper test consistent results with ocl on and off * stitching: add affine warper ocl perf test add affine warper to existing warper perf tests. Added new sanity data. * stitching: do not overwrite inliers in affine matcher * estimation is run second time on inliers only, inliers produces in second run will not be therefore correct for all matches * calib3d: add Levenberg–Marquardt refining to estimateAffine2D* functions this adds affine Levenberg–Marquardt refining to estimateAffine2D functions similar to what is done in findHomography. implements Levenberg–Marquardt refinig for both full affine and partial affine transformations. * stitching: remove reestimation step in affine matcher reestimation step is not needed. estimateAffine2D* functions are running their own reestimation on inliers using the Levenberg-Marquardt algorithm, which is better than simply rerunning RANSAC on inliers. * implement partial affine bundle adjuster bundle adjuster that expect affine transform with 4DOF. Refines parameters for all cameras together. stitching: fix bug in BundleAdjusterAffinePartial * use the invers properly * use static buffer for invers to speed it up * samples: add affine bundle adjuster option to stitching_detailed * add support for using affine bundle adjuster with 4DOF * improve logging of initial intristics * sttiching: add affine bundle adjuster test * fix build warnings * stitching: increase limit on sanity check prevents spurious test failures on mac. values are still pretty fine. * stitching: set affine bundle adjuster for SCANS mode * fix bug with AffineBestOf2NearestMatcher (we want to select affine partial mode) * select right bundle adjuster * stitching: increase error bound for matcher tests * this prevents failure on mac. tranformation is still ok. * stitching: implement affine bundle adjuster * implements affine bundle adjuster that is using full affine transform * existing test case modified to test both affinePartial an full affine bundle adjuster * add stitching tutorial * show basic usage of stitching api (Stitcher class) * stitching: add more integration test for affine stitching * added new datasets to existing testcase * removed unused include * calib3d: move `haveCollinearPoints` to common header * added comment to make that this also checks too close points * calib3d: redone checkSubset for estimateAffine* callback * use common function to check collinearity * this also ensures that point will not be too close to each other * calib3d: change estimateAffine* functions API * more similar to `findHomography`, `findFundamentalMat`, `findEssentialMat` and similar * follows standard recommended semantic INPUTS, OUTPUTS, FLAGS * allows to disable refining * supported LMEDS robust method (tests yet to come) along with RANSAC * extended docs with some tips * calib3d: rewrite estimateAffine2D test * rewrite in googletest style * parametrize to test both robust methods (RANSAC and LMEDS) * get rid of boilerplate * calib3d: rework estimateAffinePartial2D test * rework in googletest style * add testing for LMEDS * calib3d: rework estimateAffine*2D perf test * test for LMEDS speed * test with/without Levenberg-Marquart * remove sanity checking (this is covered by accuracy tests) * calib3d: improve estimateAffine*2D tests * test transformations in loop * improves test by testing more potential transformations * calib3d: rewrite kernels for estimateAffine*2D functions * use analytical solution instead of SVD * this version is faster especially for smaller amount of points * calib3d: tune up perf of estimateAffine*2D functions * avoid copying inliers * avoid converting input points if not necessary * check only `from` point for collinearity, as `to` does not affect stability of transform * tutorials: add commands examples to stitching tutorials * add some examples how to run stitcher sample code * mention stitching_detailed.cpp * calib3d: change computeError for estimateAffine*2D * do error computing in floats instead of doubles this have required precision + we were storing the result in float anyway. This make code faster and allows auto-vectorization by smart compilers. * documentation: mention estimateAffine*2D function * refer to new functions on appropriate places * prefer estimateAffine*2D over estimateRigidTransform * stitching: add camera models documentations * mention camera models in module documentation to give user a better overview and reduce confusion
8 years ago
declare.time(30 * 20).iterations(20);
12 years ago
while(next())
{
Merge pull request #6933 from hrnr:gsoc_all [GSOC] New camera model for stitching pipeline * implement estimateAffine2D estimates affine transformation using robust RANSAC method. * uses RANSAC framework in calib3d * includes accuracy test * uses SVD decomposition for solving 3 point equation * implement estimateAffinePartial2D estimates limited affine transformation * includes accuracy test * stitching: add affine matcher initial version of matcher that estimates affine transformation * stitching: added affine transform estimator initial version of estimator that simply chain transformations in homogeneous coordinates * calib3d: rename estimateAffine3D test test Calib3d_EstimateAffineTransform rename to Calib3d_EstimateAffine3D. This is more descriptive and prevents confusion with estimateAffine2D tests. * added perf test for estimateAffine functions tests both estimateAffine2D and estimateAffinePartial2D * calib3d: compare error in square in estimateAffine2D * incorporates fix from #6768 * rerun affine estimation on inliers * stitching: new API for parallel feature finding due to ABI breakage new functionality is added to `FeaturesFinder2`, `SurfFeaturesFinder2` and `OrbFeaturesFinder2` * stitching: add tests for parallel feature find API * perf test (about linear speed up) * accuracy test compares results with serial version * stitching: use dynamic_cast to overcome ABI issues adding parallel API to FeaturesFinder breaks ABI. This commit uses dynamic_cast and hardcodes thread-safe finders to avoid breaking ABI. This should be replaced by proper method similar to FeaturesMatcher on next ABI break. * use estimateAffinePartial2D in AffineBestOf2NearestMatcher * add constructor to AffineBestOf2NearestMatcher * allows to choose between full affine transform and partial affine transform. Other params are the as for BestOf2NearestMatcher * added protected field * samples: stitching_detailed support affine estimator and matcher * added new flags to choose matcher and estimator * stitching: rework affine matcher represent transformation in homogeneous coordinates affine matcher: remove duplicite code rework flow to get rid of duplicite code affine matcher: do not center points to (0, 0) it is not needed for affine model. it should not affect estimation in any way. affine matcher: remove unneeded cv namespacing * stitching: add stub bundle adjuster * adds stub bundle adjuster that does nothing * can be used in place of standard bundle adjusters to omit bundle adjusting step * samples: stitching detailed, support no budle adjust * uses new NoBundleAdjuster * added affine warper * uses R to get whole affine transformation and propagates rotation and translation to plane warper * add affine warper factory class * affine warper: compensate transformation * samples: stitching_detailed add support for affine warper * add Stitcher::create method this method follows similar constructor methods and returns smart pointer. This allows constructing Stitcher according to OpenCV guidelines. * supports multiple stitcher configurations (PANORAMA and SCANS) for convenient setup * returns cv::Ptr * stitcher: dynamicaly determine correct estimator we need to use affine estimator for affine matcher * preserves ABI (but add hints for ABI 4) * uses dynamic_cast hack to inject correct estimator * sample stitching: add support for multiple modes shows how to use different configurations of stitcher easily (panorama stitching and scans affine model) * stitcher: find features in parallel use new FeatureFinder API to find features in parallel. Parallelized using TBB. * stitching: disable parallel feature finding for OCL it does not bring much speedup to run features finder in parallel when OpenCL is enabled, because finder needs to wait for OCL device. Also, currently ORB is not thread-safe when OCL is enabled. * stitching: move matcher tests move matchers tests perf_stich.cpp -> perf_matchers.cpp * stitching: add affine stiching integration test test basic affine stitching (SCANS mode of stitcher) with images that have only translation between them * enable surf for stitching tests stitching.b12 test was failing with surf investigated the issue, surf is producing good result. Transformation is only slightly different from ORB, so that resulting pano does not exactly match ORB's result. That caused sanity check to fail. * added size checks similar to other tests * sanity check will be applied only for ORB * stitching: fix wrong estimator choice if case was exactly wrong, estimators were chosen wrong added logging for estimated transformation * enable surf for matchers stitching tests * enable SURF * rework sanity checking. Check estimated transform instead of matches. Est. transform should be more stable and comparable between SURF and ORB. * remove regression checking for VectorFeatures tests. It has a lot if data andtest is the same as previous except it test different vector size for performance, so sanity checking does not add any value here. Added basic sanity asserts instead. * stitching tests: allow relative error for transform * allows .01 relative error for estimated homography sanity check in stitching matchers tests * fix VS warning stitching tests: increase relative error increase relative error to make it pass on all platforms (results are still good). stitching test: allow bigger relative error transformation can differ in small values (with small absolute difference, but large relative difference). transformation output still looks usable for all platforms. This difference affects only mac and windows, linux passes fine with small difference. * stitching: add tests for affine matcher uses s1, s2 images. added also new sanity data. * stitching tests: use different data for matchers tests this data should yeild more stable transformation (it has much more matches, especially for surf). Sanity data regenerated. * stitching test: rework tests for matchers * separated rotation and translations as they are different by scale. * use appropriate absolute error for them separately. (relative error does not work for values near zero.) * stitching: fix affine warper compensation calculation of rotation and translation extracted for plane warper was wrong * stitching test: enable surf for opencl integration tests * enable SURF with correct guard (HAVE_OPENCV_XFEATURES2D) * add OPENCL guard and correct namespace as usual for opencl tests * stitching: add ocl accuracy test for affine warper test consistent results with ocl on and off * stitching: add affine warper ocl perf test add affine warper to existing warper perf tests. Added new sanity data. * stitching: do not overwrite inliers in affine matcher * estimation is run second time on inliers only, inliers produces in second run will not be therefore correct for all matches * calib3d: add Levenberg–Marquardt refining to estimateAffine2D* functions this adds affine Levenberg–Marquardt refining to estimateAffine2D functions similar to what is done in findHomography. implements Levenberg–Marquardt refinig for both full affine and partial affine transformations. * stitching: remove reestimation step in affine matcher reestimation step is not needed. estimateAffine2D* functions are running their own reestimation on inliers using the Levenberg-Marquardt algorithm, which is better than simply rerunning RANSAC on inliers. * implement partial affine bundle adjuster bundle adjuster that expect affine transform with 4DOF. Refines parameters for all cameras together. stitching: fix bug in BundleAdjusterAffinePartial * use the invers properly * use static buffer for invers to speed it up * samples: add affine bundle adjuster option to stitching_detailed * add support for using affine bundle adjuster with 4DOF * improve logging of initial intristics * sttiching: add affine bundle adjuster test * fix build warnings * stitching: increase limit on sanity check prevents spurious test failures on mac. values are still pretty fine. * stitching: set affine bundle adjuster for SCANS mode * fix bug with AffineBestOf2NearestMatcher (we want to select affine partial mode) * select right bundle adjuster * stitching: increase error bound for matcher tests * this prevents failure on mac. tranformation is still ok. * stitching: implement affine bundle adjuster * implements affine bundle adjuster that is using full affine transform * existing test case modified to test both affinePartial an full affine bundle adjuster * add stitching tutorial * show basic usage of stitching api (Stitcher class) * stitching: add more integration test for affine stitching * added new datasets to existing testcase * removed unused include * calib3d: move `haveCollinearPoints` to common header * added comment to make that this also checks too close points * calib3d: redone checkSubset for estimateAffine* callback * use common function to check collinearity * this also ensures that point will not be too close to each other * calib3d: change estimateAffine* functions API * more similar to `findHomography`, `findFundamentalMat`, `findEssentialMat` and similar * follows standard recommended semantic INPUTS, OUTPUTS, FLAGS * allows to disable refining * supported LMEDS robust method (tests yet to come) along with RANSAC * extended docs with some tips * calib3d: rewrite estimateAffine2D test * rewrite in googletest style * parametrize to test both robust methods (RANSAC and LMEDS) * get rid of boilerplate * calib3d: rework estimateAffinePartial2D test * rework in googletest style * add testing for LMEDS * calib3d: rework estimateAffine*2D perf test * test for LMEDS speed * test with/without Levenberg-Marquart * remove sanity checking (this is covered by accuracy tests) * calib3d: improve estimateAffine*2D tests * test transformations in loop * improves test by testing more potential transformations * calib3d: rewrite kernels for estimateAffine*2D functions * use analytical solution instead of SVD * this version is faster especially for smaller amount of points * calib3d: tune up perf of estimateAffine*2D functions * avoid copying inliers * avoid converting input points if not necessary * check only `from` point for collinearity, as `to` does not affect stability of transform * tutorials: add commands examples to stitching tutorials * add some examples how to run stitcher sample code * mention stitching_detailed.cpp * calib3d: change computeError for estimateAffine*2D * do error computing in floats instead of doubles this have required precision + we were storing the result in float anyway. This make code faster and allows auto-vectorization by smart compilers. * documentation: mention estimateAffine*2D function * refer to new functions on appropriate places * prefer estimateAffine*2D over estimateRigidTransform * stitching: add camera models documentations * mention camera models in module documentation to give user a better overview and reduce confusion
8 years ago
Ptr<Stitcher> stitcher = Stitcher::create(Stitcher::SCANS, false);
stitcher->setFeaturesFinder(featuresFinder);
if (cv::ocl::useOpenCL())
cv::theRNG() = cv::RNG(12345); // prevent fails of Windows OpenCL builds (see #8294)
12 years ago
startTimer();
Merge pull request #6933 from hrnr:gsoc_all [GSOC] New camera model for stitching pipeline * implement estimateAffine2D estimates affine transformation using robust RANSAC method. * uses RANSAC framework in calib3d * includes accuracy test * uses SVD decomposition for solving 3 point equation * implement estimateAffinePartial2D estimates limited affine transformation * includes accuracy test * stitching: add affine matcher initial version of matcher that estimates affine transformation * stitching: added affine transform estimator initial version of estimator that simply chain transformations in homogeneous coordinates * calib3d: rename estimateAffine3D test test Calib3d_EstimateAffineTransform rename to Calib3d_EstimateAffine3D. This is more descriptive and prevents confusion with estimateAffine2D tests. * added perf test for estimateAffine functions tests both estimateAffine2D and estimateAffinePartial2D * calib3d: compare error in square in estimateAffine2D * incorporates fix from #6768 * rerun affine estimation on inliers * stitching: new API for parallel feature finding due to ABI breakage new functionality is added to `FeaturesFinder2`, `SurfFeaturesFinder2` and `OrbFeaturesFinder2` * stitching: add tests for parallel feature find API * perf test (about linear speed up) * accuracy test compares results with serial version * stitching: use dynamic_cast to overcome ABI issues adding parallel API to FeaturesFinder breaks ABI. This commit uses dynamic_cast and hardcodes thread-safe finders to avoid breaking ABI. This should be replaced by proper method similar to FeaturesMatcher on next ABI break. * use estimateAffinePartial2D in AffineBestOf2NearestMatcher * add constructor to AffineBestOf2NearestMatcher * allows to choose between full affine transform and partial affine transform. Other params are the as for BestOf2NearestMatcher * added protected field * samples: stitching_detailed support affine estimator and matcher * added new flags to choose matcher and estimator * stitching: rework affine matcher represent transformation in homogeneous coordinates affine matcher: remove duplicite code rework flow to get rid of duplicite code affine matcher: do not center points to (0, 0) it is not needed for affine model. it should not affect estimation in any way. affine matcher: remove unneeded cv namespacing * stitching: add stub bundle adjuster * adds stub bundle adjuster that does nothing * can be used in place of standard bundle adjusters to omit bundle adjusting step * samples: stitching detailed, support no budle adjust * uses new NoBundleAdjuster * added affine warper * uses R to get whole affine transformation and propagates rotation and translation to plane warper * add affine warper factory class * affine warper: compensate transformation * samples: stitching_detailed add support for affine warper * add Stitcher::create method this method follows similar constructor methods and returns smart pointer. This allows constructing Stitcher according to OpenCV guidelines. * supports multiple stitcher configurations (PANORAMA and SCANS) for convenient setup * returns cv::Ptr * stitcher: dynamicaly determine correct estimator we need to use affine estimator for affine matcher * preserves ABI (but add hints for ABI 4) * uses dynamic_cast hack to inject correct estimator * sample stitching: add support for multiple modes shows how to use different configurations of stitcher easily (panorama stitching and scans affine model) * stitcher: find features in parallel use new FeatureFinder API to find features in parallel. Parallelized using TBB. * stitching: disable parallel feature finding for OCL it does not bring much speedup to run features finder in parallel when OpenCL is enabled, because finder needs to wait for OCL device. Also, currently ORB is not thread-safe when OCL is enabled. * stitching: move matcher tests move matchers tests perf_stich.cpp -> perf_matchers.cpp * stitching: add affine stiching integration test test basic affine stitching (SCANS mode of stitcher) with images that have only translation between them * enable surf for stitching tests stitching.b12 test was failing with surf investigated the issue, surf is producing good result. Transformation is only slightly different from ORB, so that resulting pano does not exactly match ORB's result. That caused sanity check to fail. * added size checks similar to other tests * sanity check will be applied only for ORB * stitching: fix wrong estimator choice if case was exactly wrong, estimators were chosen wrong added logging for estimated transformation * enable surf for matchers stitching tests * enable SURF * rework sanity checking. Check estimated transform instead of matches. Est. transform should be more stable and comparable between SURF and ORB. * remove regression checking for VectorFeatures tests. It has a lot if data andtest is the same as previous except it test different vector size for performance, so sanity checking does not add any value here. Added basic sanity asserts instead. * stitching tests: allow relative error for transform * allows .01 relative error for estimated homography sanity check in stitching matchers tests * fix VS warning stitching tests: increase relative error increase relative error to make it pass on all platforms (results are still good). stitching test: allow bigger relative error transformation can differ in small values (with small absolute difference, but large relative difference). transformation output still looks usable for all platforms. This difference affects only mac and windows, linux passes fine with small difference. * stitching: add tests for affine matcher uses s1, s2 images. added also new sanity data. * stitching tests: use different data for matchers tests this data should yeild more stable transformation (it has much more matches, especially for surf). Sanity data regenerated. * stitching test: rework tests for matchers * separated rotation and translations as they are different by scale. * use appropriate absolute error for them separately. (relative error does not work for values near zero.) * stitching: fix affine warper compensation calculation of rotation and translation extracted for plane warper was wrong * stitching test: enable surf for opencl integration tests * enable SURF with correct guard (HAVE_OPENCV_XFEATURES2D) * add OPENCL guard and correct namespace as usual for opencl tests * stitching: add ocl accuracy test for affine warper test consistent results with ocl on and off * stitching: add affine warper ocl perf test add affine warper to existing warper perf tests. Added new sanity data. * stitching: do not overwrite inliers in affine matcher * estimation is run second time on inliers only, inliers produces in second run will not be therefore correct for all matches * calib3d: add Levenberg–Marquardt refining to estimateAffine2D* functions this adds affine Levenberg–Marquardt refining to estimateAffine2D functions similar to what is done in findHomography. implements Levenberg–Marquardt refinig for both full affine and partial affine transformations. * stitching: remove reestimation step in affine matcher reestimation step is not needed. estimateAffine2D* functions are running their own reestimation on inliers using the Levenberg-Marquardt algorithm, which is better than simply rerunning RANSAC on inliers. * implement partial affine bundle adjuster bundle adjuster that expect affine transform with 4DOF. Refines parameters for all cameras together. stitching: fix bug in BundleAdjusterAffinePartial * use the invers properly * use static buffer for invers to speed it up * samples: add affine bundle adjuster option to stitching_detailed * add support for using affine bundle adjuster with 4DOF * improve logging of initial intristics * sttiching: add affine bundle adjuster test * fix build warnings * stitching: increase limit on sanity check prevents spurious test failures on mac. values are still pretty fine. * stitching: set affine bundle adjuster for SCANS mode * fix bug with AffineBestOf2NearestMatcher (we want to select affine partial mode) * select right bundle adjuster * stitching: increase error bound for matcher tests * this prevents failure on mac. tranformation is still ok. * stitching: implement affine bundle adjuster * implements affine bundle adjuster that is using full affine transform * existing test case modified to test both affinePartial an full affine bundle adjuster * add stitching tutorial * show basic usage of stitching api (Stitcher class) * stitching: add more integration test for affine stitching * added new datasets to existing testcase * removed unused include * calib3d: move `haveCollinearPoints` to common header * added comment to make that this also checks too close points * calib3d: redone checkSubset for estimateAffine* callback * use common function to check collinearity * this also ensures that point will not be too close to each other * calib3d: change estimateAffine* functions API * more similar to `findHomography`, `findFundamentalMat`, `findEssentialMat` and similar * follows standard recommended semantic INPUTS, OUTPUTS, FLAGS * allows to disable refining * supported LMEDS robust method (tests yet to come) along with RANSAC * extended docs with some tips * calib3d: rewrite estimateAffine2D test * rewrite in googletest style * parametrize to test both robust methods (RANSAC and LMEDS) * get rid of boilerplate * calib3d: rework estimateAffinePartial2D test * rework in googletest style * add testing for LMEDS * calib3d: rework estimateAffine*2D perf test * test for LMEDS speed * test with/without Levenberg-Marquart * remove sanity checking (this is covered by accuracy tests) * calib3d: improve estimateAffine*2D tests * test transformations in loop * improves test by testing more potential transformations * calib3d: rewrite kernels for estimateAffine*2D functions * use analytical solution instead of SVD * this version is faster especially for smaller amount of points * calib3d: tune up perf of estimateAffine*2D functions * avoid copying inliers * avoid converting input points if not necessary * check only `from` point for collinearity, as `to` does not affect stability of transform * tutorials: add commands examples to stitching tutorials * add some examples how to run stitcher sample code * mention stitching_detailed.cpp * calib3d: change computeError for estimateAffine*2D * do error computing in floats instead of doubles this have required precision + we were storing the result in float anyway. This make code faster and allows auto-vectorization by smart compilers. * documentation: mention estimateAffine*2D function * refer to new functions on appropriate places * prefer estimateAffine*2D over estimateRigidTransform * stitching: add camera models documentations * mention camera models in module documentation to give user a better overview and reduce confusion
8 years ago
stitcher->stitch(imgs, pano);
12 years ago
stopTimer();
}
Merge pull request #6933 from hrnr:gsoc_all [GSOC] New camera model for stitching pipeline * implement estimateAffine2D estimates affine transformation using robust RANSAC method. * uses RANSAC framework in calib3d * includes accuracy test * uses SVD decomposition for solving 3 point equation * implement estimateAffinePartial2D estimates limited affine transformation * includes accuracy test * stitching: add affine matcher initial version of matcher that estimates affine transformation * stitching: added affine transform estimator initial version of estimator that simply chain transformations in homogeneous coordinates * calib3d: rename estimateAffine3D test test Calib3d_EstimateAffineTransform rename to Calib3d_EstimateAffine3D. This is more descriptive and prevents confusion with estimateAffine2D tests. * added perf test for estimateAffine functions tests both estimateAffine2D and estimateAffinePartial2D * calib3d: compare error in square in estimateAffine2D * incorporates fix from #6768 * rerun affine estimation on inliers * stitching: new API for parallel feature finding due to ABI breakage new functionality is added to `FeaturesFinder2`, `SurfFeaturesFinder2` and `OrbFeaturesFinder2` * stitching: add tests for parallel feature find API * perf test (about linear speed up) * accuracy test compares results with serial version * stitching: use dynamic_cast to overcome ABI issues adding parallel API to FeaturesFinder breaks ABI. This commit uses dynamic_cast and hardcodes thread-safe finders to avoid breaking ABI. This should be replaced by proper method similar to FeaturesMatcher on next ABI break. * use estimateAffinePartial2D in AffineBestOf2NearestMatcher * add constructor to AffineBestOf2NearestMatcher * allows to choose between full affine transform and partial affine transform. Other params are the as for BestOf2NearestMatcher * added protected field * samples: stitching_detailed support affine estimator and matcher * added new flags to choose matcher and estimator * stitching: rework affine matcher represent transformation in homogeneous coordinates affine matcher: remove duplicite code rework flow to get rid of duplicite code affine matcher: do not center points to (0, 0) it is not needed for affine model. it should not affect estimation in any way. affine matcher: remove unneeded cv namespacing * stitching: add stub bundle adjuster * adds stub bundle adjuster that does nothing * can be used in place of standard bundle adjusters to omit bundle adjusting step * samples: stitching detailed, support no budle adjust * uses new NoBundleAdjuster * added affine warper * uses R to get whole affine transformation and propagates rotation and translation to plane warper * add affine warper factory class * affine warper: compensate transformation * samples: stitching_detailed add support for affine warper * add Stitcher::create method this method follows similar constructor methods and returns smart pointer. This allows constructing Stitcher according to OpenCV guidelines. * supports multiple stitcher configurations (PANORAMA and SCANS) for convenient setup * returns cv::Ptr * stitcher: dynamicaly determine correct estimator we need to use affine estimator for affine matcher * preserves ABI (but add hints for ABI 4) * uses dynamic_cast hack to inject correct estimator * sample stitching: add support for multiple modes shows how to use different configurations of stitcher easily (panorama stitching and scans affine model) * stitcher: find features in parallel use new FeatureFinder API to find features in parallel. Parallelized using TBB. * stitching: disable parallel feature finding for OCL it does not bring much speedup to run features finder in parallel when OpenCL is enabled, because finder needs to wait for OCL device. Also, currently ORB is not thread-safe when OCL is enabled. * stitching: move matcher tests move matchers tests perf_stich.cpp -> perf_matchers.cpp * stitching: add affine stiching integration test test basic affine stitching (SCANS mode of stitcher) with images that have only translation between them * enable surf for stitching tests stitching.b12 test was failing with surf investigated the issue, surf is producing good result. Transformation is only slightly different from ORB, so that resulting pano does not exactly match ORB's result. That caused sanity check to fail. * added size checks similar to other tests * sanity check will be applied only for ORB * stitching: fix wrong estimator choice if case was exactly wrong, estimators were chosen wrong added logging for estimated transformation * enable surf for matchers stitching tests * enable SURF * rework sanity checking. Check estimated transform instead of matches. Est. transform should be more stable and comparable between SURF and ORB. * remove regression checking for VectorFeatures tests. It has a lot if data andtest is the same as previous except it test different vector size for performance, so sanity checking does not add any value here. Added basic sanity asserts instead. * stitching tests: allow relative error for transform * allows .01 relative error for estimated homography sanity check in stitching matchers tests * fix VS warning stitching tests: increase relative error increase relative error to make it pass on all platforms (results are still good). stitching test: allow bigger relative error transformation can differ in small values (with small absolute difference, but large relative difference). transformation output still looks usable for all platforms. This difference affects only mac and windows, linux passes fine with small difference. * stitching: add tests for affine matcher uses s1, s2 images. added also new sanity data. * stitching tests: use different data for matchers tests this data should yeild more stable transformation (it has much more matches, especially for surf). Sanity data regenerated. * stitching test: rework tests for matchers * separated rotation and translations as they are different by scale. * use appropriate absolute error for them separately. (relative error does not work for values near zero.) * stitching: fix affine warper compensation calculation of rotation and translation extracted for plane warper was wrong * stitching test: enable surf for opencl integration tests * enable SURF with correct guard (HAVE_OPENCV_XFEATURES2D) * add OPENCL guard and correct namespace as usual for opencl tests * stitching: add ocl accuracy test for affine warper test consistent results with ocl on and off * stitching: add affine warper ocl perf test add affine warper to existing warper perf tests. Added new sanity data. * stitching: do not overwrite inliers in affine matcher * estimation is run second time on inliers only, inliers produces in second run will not be therefore correct for all matches * calib3d: add Levenberg–Marquardt refining to estimateAffine2D* functions this adds affine Levenberg–Marquardt refining to estimateAffine2D functions similar to what is done in findHomography. implements Levenberg–Marquardt refinig for both full affine and partial affine transformations. * stitching: remove reestimation step in affine matcher reestimation step is not needed. estimateAffine2D* functions are running their own reestimation on inliers using the Levenberg-Marquardt algorithm, which is better than simply rerunning RANSAC on inliers. * implement partial affine bundle adjuster bundle adjuster that expect affine transform with 4DOF. Refines parameters for all cameras together. stitching: fix bug in BundleAdjusterAffinePartial * use the invers properly * use static buffer for invers to speed it up * samples: add affine bundle adjuster option to stitching_detailed * add support for using affine bundle adjuster with 4DOF * improve logging of initial intristics * sttiching: add affine bundle adjuster test * fix build warnings * stitching: increase limit on sanity check prevents spurious test failures on mac. values are still pretty fine. * stitching: set affine bundle adjuster for SCANS mode * fix bug with AffineBestOf2NearestMatcher (we want to select affine partial mode) * select right bundle adjuster * stitching: increase error bound for matcher tests * this prevents failure on mac. tranformation is still ok. * stitching: implement affine bundle adjuster * implements affine bundle adjuster that is using full affine transform * existing test case modified to test both affinePartial an full affine bundle adjuster * add stitching tutorial * show basic usage of stitching api (Stitcher class) * stitching: add more integration test for affine stitching * added new datasets to existing testcase * removed unused include * calib3d: move `haveCollinearPoints` to common header * added comment to make that this also checks too close points * calib3d: redone checkSubset for estimateAffine* callback * use common function to check collinearity * this also ensures that point will not be too close to each other * calib3d: change estimateAffine* functions API * more similar to `findHomography`, `findFundamentalMat`, `findEssentialMat` and similar * follows standard recommended semantic INPUTS, OUTPUTS, FLAGS * allows to disable refining * supported LMEDS robust method (tests yet to come) along with RANSAC * extended docs with some tips * calib3d: rewrite estimateAffine2D test * rewrite in googletest style * parametrize to test both robust methods (RANSAC and LMEDS) * get rid of boilerplate * calib3d: rework estimateAffinePartial2D test * rework in googletest style * add testing for LMEDS * calib3d: rework estimateAffine*2D perf test * test for LMEDS speed * test with/without Levenberg-Marquart * remove sanity checking (this is covered by accuracy tests) * calib3d: improve estimateAffine*2D tests * test transformations in loop * improves test by testing more potential transformations * calib3d: rewrite kernels for estimateAffine*2D functions * use analytical solution instead of SVD * this version is faster especially for smaller amount of points * calib3d: tune up perf of estimateAffine*2D functions * avoid copying inliers * avoid converting input points if not necessary * check only `from` point for collinearity, as `to` does not affect stability of transform * tutorials: add commands examples to stitching tutorials * add some examples how to run stitcher sample code * mention stitching_detailed.cpp * calib3d: change computeError for estimateAffine*2D * do error computing in floats instead of doubles this have required precision + we were storing the result in float anyway. This make code faster and allows auto-vectorization by smart compilers. * documentation: mention estimateAffine*2D function * refer to new functions on appropriate places * prefer estimateAffine*2D over estimateRigidTransform * stitching: add camera models documentations * mention camera models in module documentation to give user a better overview and reduce confusion
8 years ago
EXPECT_NEAR(pano.size().width, width, allowed_diff);
EXPECT_NEAR(pano.size().height, height, allowed_diff);
Merge pull request #6933 from hrnr:gsoc_all [GSOC] New camera model for stitching pipeline * implement estimateAffine2D estimates affine transformation using robust RANSAC method. * uses RANSAC framework in calib3d * includes accuracy test * uses SVD decomposition for solving 3 point equation * implement estimateAffinePartial2D estimates limited affine transformation * includes accuracy test * stitching: add affine matcher initial version of matcher that estimates affine transformation * stitching: added affine transform estimator initial version of estimator that simply chain transformations in homogeneous coordinates * calib3d: rename estimateAffine3D test test Calib3d_EstimateAffineTransform rename to Calib3d_EstimateAffine3D. This is more descriptive and prevents confusion with estimateAffine2D tests. * added perf test for estimateAffine functions tests both estimateAffine2D and estimateAffinePartial2D * calib3d: compare error in square in estimateAffine2D * incorporates fix from #6768 * rerun affine estimation on inliers * stitching: new API for parallel feature finding due to ABI breakage new functionality is added to `FeaturesFinder2`, `SurfFeaturesFinder2` and `OrbFeaturesFinder2` * stitching: add tests for parallel feature find API * perf test (about linear speed up) * accuracy test compares results with serial version * stitching: use dynamic_cast to overcome ABI issues adding parallel API to FeaturesFinder breaks ABI. This commit uses dynamic_cast and hardcodes thread-safe finders to avoid breaking ABI. This should be replaced by proper method similar to FeaturesMatcher on next ABI break. * use estimateAffinePartial2D in AffineBestOf2NearestMatcher * add constructor to AffineBestOf2NearestMatcher * allows to choose between full affine transform and partial affine transform. Other params are the as for BestOf2NearestMatcher * added protected field * samples: stitching_detailed support affine estimator and matcher * added new flags to choose matcher and estimator * stitching: rework affine matcher represent transformation in homogeneous coordinates affine matcher: remove duplicite code rework flow to get rid of duplicite code affine matcher: do not center points to (0, 0) it is not needed for affine model. it should not affect estimation in any way. affine matcher: remove unneeded cv namespacing * stitching: add stub bundle adjuster * adds stub bundle adjuster that does nothing * can be used in place of standard bundle adjusters to omit bundle adjusting step * samples: stitching detailed, support no budle adjust * uses new NoBundleAdjuster * added affine warper * uses R to get whole affine transformation and propagates rotation and translation to plane warper * add affine warper factory class * affine warper: compensate transformation * samples: stitching_detailed add support for affine warper * add Stitcher::create method this method follows similar constructor methods and returns smart pointer. This allows constructing Stitcher according to OpenCV guidelines. * supports multiple stitcher configurations (PANORAMA and SCANS) for convenient setup * returns cv::Ptr * stitcher: dynamicaly determine correct estimator we need to use affine estimator for affine matcher * preserves ABI (but add hints for ABI 4) * uses dynamic_cast hack to inject correct estimator * sample stitching: add support for multiple modes shows how to use different configurations of stitcher easily (panorama stitching and scans affine model) * stitcher: find features in parallel use new FeatureFinder API to find features in parallel. Parallelized using TBB. * stitching: disable parallel feature finding for OCL it does not bring much speedup to run features finder in parallel when OpenCL is enabled, because finder needs to wait for OCL device. Also, currently ORB is not thread-safe when OCL is enabled. * stitching: move matcher tests move matchers tests perf_stich.cpp -> perf_matchers.cpp * stitching: add affine stiching integration test test basic affine stitching (SCANS mode of stitcher) with images that have only translation between them * enable surf for stitching tests stitching.b12 test was failing with surf investigated the issue, surf is producing good result. Transformation is only slightly different from ORB, so that resulting pano does not exactly match ORB's result. That caused sanity check to fail. * added size checks similar to other tests * sanity check will be applied only for ORB * stitching: fix wrong estimator choice if case was exactly wrong, estimators were chosen wrong added logging for estimated transformation * enable surf for matchers stitching tests * enable SURF * rework sanity checking. Check estimated transform instead of matches. Est. transform should be more stable and comparable between SURF and ORB. * remove regression checking for VectorFeatures tests. It has a lot if data andtest is the same as previous except it test different vector size for performance, so sanity checking does not add any value here. Added basic sanity asserts instead. * stitching tests: allow relative error for transform * allows .01 relative error for estimated homography sanity check in stitching matchers tests * fix VS warning stitching tests: increase relative error increase relative error to make it pass on all platforms (results are still good). stitching test: allow bigger relative error transformation can differ in small values (with small absolute difference, but large relative difference). transformation output still looks usable for all platforms. This difference affects only mac and windows, linux passes fine with small difference. * stitching: add tests for affine matcher uses s1, s2 images. added also new sanity data. * stitching tests: use different data for matchers tests this data should yeild more stable transformation (it has much more matches, especially for surf). Sanity data regenerated. * stitching test: rework tests for matchers * separated rotation and translations as they are different by scale. * use appropriate absolute error for them separately. (relative error does not work for values near zero.) * stitching: fix affine warper compensation calculation of rotation and translation extracted for plane warper was wrong * stitching test: enable surf for opencl integration tests * enable SURF with correct guard (HAVE_OPENCV_XFEATURES2D) * add OPENCL guard and correct namespace as usual for opencl tests * stitching: add ocl accuracy test for affine warper test consistent results with ocl on and off * stitching: add affine warper ocl perf test add affine warper to existing warper perf tests. Added new sanity data. * stitching: do not overwrite inliers in affine matcher * estimation is run second time on inliers only, inliers produces in second run will not be therefore correct for all matches * calib3d: add Levenberg–Marquardt refining to estimateAffine2D* functions this adds affine Levenberg–Marquardt refining to estimateAffine2D functions similar to what is done in findHomography. implements Levenberg–Marquardt refinig for both full affine and partial affine transformations. * stitching: remove reestimation step in affine matcher reestimation step is not needed. estimateAffine2D* functions are running their own reestimation on inliers using the Levenberg-Marquardt algorithm, which is better than simply rerunning RANSAC on inliers. * implement partial affine bundle adjuster bundle adjuster that expect affine transform with 4DOF. Refines parameters for all cameras together. stitching: fix bug in BundleAdjusterAffinePartial * use the invers properly * use static buffer for invers to speed it up * samples: add affine bundle adjuster option to stitching_detailed * add support for using affine bundle adjuster with 4DOF * improve logging of initial intristics * sttiching: add affine bundle adjuster test * fix build warnings * stitching: increase limit on sanity check prevents spurious test failures on mac. values are still pretty fine. * stitching: set affine bundle adjuster for SCANS mode * fix bug with AffineBestOf2NearestMatcher (we want to select affine partial mode) * select right bundle adjuster * stitching: increase error bound for matcher tests * this prevents failure on mac. tranformation is still ok. * stitching: implement affine bundle adjuster * implements affine bundle adjuster that is using full affine transform * existing test case modified to test both affinePartial an full affine bundle adjuster * add stitching tutorial * show basic usage of stitching api (Stitcher class) * stitching: add more integration test for affine stitching * added new datasets to existing testcase * removed unused include * calib3d: move `haveCollinearPoints` to common header * added comment to make that this also checks too close points * calib3d: redone checkSubset for estimateAffine* callback * use common function to check collinearity * this also ensures that point will not be too close to each other * calib3d: change estimateAffine* functions API * more similar to `findHomography`, `findFundamentalMat`, `findEssentialMat` and similar * follows standard recommended semantic INPUTS, OUTPUTS, FLAGS * allows to disable refining * supported LMEDS robust method (tests yet to come) along with RANSAC * extended docs with some tips * calib3d: rewrite estimateAffine2D test * rewrite in googletest style * parametrize to test both robust methods (RANSAC and LMEDS) * get rid of boilerplate * calib3d: rework estimateAffinePartial2D test * rework in googletest style * add testing for LMEDS * calib3d: rework estimateAffine*2D perf test * test for LMEDS speed * test with/without Levenberg-Marquart * remove sanity checking (this is covered by accuracy tests) * calib3d: improve estimateAffine*2D tests * test transformations in loop * improves test by testing more potential transformations * calib3d: rewrite kernels for estimateAffine*2D functions * use analytical solution instead of SVD * this version is faster especially for smaller amount of points * calib3d: tune up perf of estimateAffine*2D functions * avoid copying inliers * avoid converting input points if not necessary * check only `from` point for collinearity, as `to` does not affect stability of transform * tutorials: add commands examples to stitching tutorials * add some examples how to run stitcher sample code * mention stitching_detailed.cpp * calib3d: change computeError for estimateAffine*2D * do error computing in floats instead of doubles this have required precision + we were storing the result in float anyway. This make code faster and allows auto-vectorization by smart compilers. * documentation: mention estimateAffine*2D function * refer to new functions on appropriate places * prefer estimateAffine*2D over estimateRigidTransform * stitching: add camera models documentations * mention camera models in module documentation to give user a better overview and reduce confusion
8 years ago
SANITY_CHECK_NOTHING();
12 years ago
}
} // namespace