Commit Graph

56 Commits

Author SHA1 Message Date
Vitaly Tuzov
51cb56ef2c Implementation of bit-exact resize. Internal calls to linear resize updated to use bit-exact version. (#9468) 2017-12-13 15:00:38 +03:00
Jiri Horner
c17afe0fab 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
2016-10-22 19:10:42 +03:00
Alexander Alekhin
60676dbbe8 fix build: move LOG macro from stitching public headers 2016-07-20 18:10:26 +03:00
LaurentBerger
bef009c9dd fixed #5005: stitching_detailed.cpp 2015-11-23 21:55:59 +01:00
Vladislav Vinogradov
124ac15f1e remove cuda module 2015-01-22 15:02:21 +03:00
StevenPuttemans
564a8ed208 adapted all nonfree header inclusion since it doesn't exist anymore as a module 2014-08-25 21:31:34 +02:00
Vadim Pisarevsky
ee90b88dd7 Merge pull request #2720 from pglotov:master 2014-07-25 12:54:22 +00:00
Petr Glotov
7a77cf584a added timelapse 2014-07-15 09:32:47 -07:00
Vadim Pisarevsky
b1793e2fb9 Merge pull request #2939 from adishavit:sample-fix_stitching_pipeline 2014-07-15 08:09:04 +00:00
vbystricky
4286f60387 Extract imgcodecs module from highgui 2014-07-07 16:28:08 +04:00
Adi Shavit
7674f3ddbf Added call to clone() to avoid unexpected change to external data.
- Fix both stitching_detailed.cpp sample and cv::Stitcher.
2014-07-03 22:14:58 +03:00
Alexander Alekhin
c1ea6f3c42 TAPI: stitching: improve warpers 2014-04-11 13:01:07 +04:00
Alexander Alekhin
1d9808e5d5 TAPI: stitching, replaced Mat->UMat/_Array 2014-04-11 13:01:06 +04:00
Ilya Lavrenov
118709fd9f added OpenCL accelerated warpers 2014-01-10 18:16:56 +04:00
Vladislav Vinogradov
0c7663eb3b Merge branch 'master' into gpu-cuda-rename
Conflicts:
	modules/core/include/opencv2/core/cuda.hpp
	modules/cudacodec/src/thread.cpp
	modules/cudacodec/src/thread.hpp
	modules/superres/perf/perf_superres.cpp
	modules/superres/src/btv_l1_cuda.cpp
	modules/superres/src/optical_flow.cpp
	modules/videostab/src/global_motion.cpp
	modules/videostab/src/inpainting.cpp
	samples/cpp/stitching_detailed.cpp
	samples/cpp/videostab.cpp
	samples/gpu/stereo_multi.cpp
2013-09-06 15:44:44 +04:00
Vladislav Vinogradov
ae94256edc renmaed gpu module -> cuda 2013-09-02 14:00:44 +04:00
Vladislav Vinogradov
d4901a99ea renamed gpuwarping -> cudawarping 2013-09-02 14:00:42 +04:00
Vladislav Vinogradov
e895b7455e renamed gpu namespace -> cuda 2013-09-02 14:00:41 +04:00
Roman Donchenko
2c4bbb313c Merge commit '43aec5ad' into merge-2.4
Conflicts:
	cmake/OpenCVConfig.cmake
	cmake/OpenCVLegacyOptions.cmake
	modules/contrib/src/retina.cpp
	modules/gpu/doc/camera_calibration_and_3d_reconstruction.rst
	modules/gpu/doc/video.rst
	modules/gpu/src/speckle_filtering.cpp
	modules/python/src2/cv2.cv.hpp
	modules/python/test/test2.py
	samples/python/watershed.py
2013-08-27 13:26:44 +04:00
Roman Donchenko
e9a28f66ee Normalized file endings. 2013-08-21 18:59:25 +04:00
Alexey Spizhevoy
37ea872204 added handling of camera parameters estimation errors (#3122) 2013-07-03 15:20:14 +04:00
Vladislav Vinogradov
3eeaa9189c Revert "Revert "Merge pull request #836 from jet47:gpu-modules"" 2013-06-07 13:05:39 +04:00
Andrey Kamaev
416fb50594 Revert "Merge pull request #836 from jet47:gpu-modules"
This reverts commit fba72cb60d, reversing
changes made to 02131ffb62.
2013-04-18 15:03:50 +04:00
Vladislav Vinogradov
fdeec6896c stitching module fixes 2013-04-18 13:28:30 +04:00
Andrey Kamaev
29cfeb7cee Fix build of apps and samples 2013-03-22 22:14:36 +04:00
Andrey Kamaev
1ca8f33b4e Merge branch '2.4' 2013-03-21 23:11:54 +04:00
Andrey Kamaev
89356ff16d Move non-CV functionality from core.hpp to separate utility.hpp header 2013-03-20 17:56:06 +04:00
Vladislav Vinogradov
0a65f2f4af merged gpunonfree and nonfree module 2013-03-18 16:14:37 +04:00
Vladislav Vinogradov
fd7bf0b766 moved SURF_GPU and VIBE to gpunonfree module 2013-03-18 14:06:29 +04:00
Andrey Kamaev
8fb6d9f650 Fix Android build warnings 2012-10-19 16:14:14 +04:00
Vadim Pisarevsky
044d38a051 expanded cv::threshold parallelization to other threading frameworks; fixed potential bug with unprocessed bottom of the image; fixed build problem in stitching 2012-10-09 22:38:04 +04:00
alexey.spizhevoy
a39bce204d implemented DP-based seam estimation method 2012-08-07 16:24:21 +04:00
Andrey Kamaev
c5aba337e9 Fixed number of warnings. Fixed mingw64 build. 2012-06-12 14:46:12 +00:00
Andrey Kamaev
f62028dc16 Fixed mingw build. 2012-06-08 03:15:08 +00:00
Andrey Kamaev
49a1ba6038 Set stricter warning rules for gcc 2012-06-07 17:21:29 +00:00
Alexey Spizhevoy
e87a07e2aa Fixed bug #1693. Also corrected default parameters for stitching. 2012-03-19 11:51:18 +00:00
Vadim Pisarevsky
4985c1b632 fixed hundreds of warnings from MSVC 2010. 2012-03-16 21:21:04 +00:00
Ivan Korolev
6e2507c197 Added some new warpers. 2012-03-14 12:59:23 +00:00
Andrey Kamaev
984eb99428 Global CMake reorganization:
[~] Automatically tracked dependencies between modules
 [+] Support for optional module dependencies
 [+] Options to choose modules to build
 [~] Removed hardcoded modules lists from OpenCVConfig.cmake, opencv.pc and OpenCV.mk
 [+] Added COMPONENTS support for FIND_PACKAGE(OpenCV)
 [~] haartraining and traincascade are moved outside of modules folder since they aren't the modules
2012-02-03 11:26:49 +00:00
Alexey Spizhevoy
28e006ad4f Fixed median focal length estimation in the stitching module 2011-10-24 12:35:11 +00:00
Andrey Kamaev
f299bde3a9 Added ORB features finder into stitching module 2011-10-19 10:48:45 +00:00
Alexey Spizhevoy
404e9cb9d5 Refactored warpers in the stitching module, added buildMaps function into the RotationWarper interface 2011-10-03 06:31:24 +00:00
Alexey Spizhevoy
230cc3e0c3 Minor fix in stitching_detailed 2011-09-26 10:04:50 +00:00
Alexey Spizhevoy
66b41b67f9 Added support of GPU in stitching seam estimators 2011-09-26 07:57:05 +00:00
Alexey Spizhevoy
16f5c67914 Added support of vertical straightening into stitching 2011-09-24 08:20:13 +00:00
Alexey Spizhevoy
39533a0b1b Added BA refinement flags into stitching_detailed 2011-09-22 08:58:48 +00:00
Alexey Spizhevoy
4ee462c961 Added selction of BA cost function in stitching samples (and added other BA cost func into stitching module) 2011-09-21 13:22:12 +00:00
Alexey Spizhevoy
dbce155874 Refactored motion estimators in stitching module 2011-09-21 12:13:07 +00:00
Alexey Spizhevoy
4a5abc7552 Added translation parameter into stitching module warpers. For now only PlaneWarper and PlaneWarperGpu warpers support it. 2011-09-21 10:53:23 +00:00
Alexey Spizhevoy
f262f58297 Changed one CLI message in stitching_detailed. 2011-09-19 06:37:22 +00:00