Commit Graph

133 Commits

Author SHA1 Message Date
Jiri Horner
a5b5684670 Merge pull request #9330 from hrnr:akaze_ocl
[GSOC] Enable OCL for AKAZE (#9330)

* revert e0489cb - reenable OCL for AKAZE

* deal with conversion internally in AKAZE

* pass InputArray directly to AKAZE to allow distiguishing input Mat/UMat. deal with conversion there
* ensure that keypoints orientations are always computed. prevents misuse of internal AKAZE class.

* covert internal AKAZE functions to use InputArray/OutputArray

* make internal functions private in AKAZE

* split OCL and CPU paths in AKAZE

* create 2 separate pyramids, 1 for OCL and 1 for CPU
* template functions that use temporaries to always store them as correct type (UMat/Mat)

* remove variable used only in OCL path

causes unused variable warning

* update AKAZE documentation

* run ocl version only when ocl is enabled

* add tests for OCL path in AKAZE

* relax condition for keypoints angle
2017-08-16 16:46:11 +00:00
Alexander Alekhin
94dbc35d92 features2d(test): more AKAZE tests 2017-08-03 22:54:45 +00:00
Alexander Alekhin
411d36ff13 features2d(test): update descriptor regression test 2017-08-03 19:51:46 +03:00
Alexander Alekhin
63ae5f00b1 features2d(test): enable debug messages 2017-08-03 19:51:46 +03:00
Jiri Horner
3166d0c667 Merge pull request #9249 from hrnr:akaze_part3
[GSOC] Speeding-up AKAZE, part #3 (#9249)

* use finding of scale extremas from fast_akaze

* incorporade finding of extremas and subpixel refinement from Hideaki Suzuki's fast_akaze (https://github.com/h2suzuki/fast_akaze)
* use opencv parallel framework
* do not search for keypoints near the border, where we can't compute sensible descriptors (bugs fixed in ffd9ad99f4, 2c5389594b), but the descriptors were not 100% correct. this is a better solution

this version produces less keypoints with the same treshold. It is more effective in pruning similar keypoints (which do not bring any new information), so we have less keypoints, but with high quality. Accuracy is about the same.

* incorporate bugfix from upstream

* fix bug in subpixel refinement
* see commit db3dc22981e856ca8111f2f7fe57d9c2e0286efc in Pablo's repo

* rework finding of scale space extremas

* store just keypoints positions
* store positions in uchar mask for effective spatial search for neighbours
* construct keypoints structs at the very end

* lower inlier threshold in test

* win32 has lower accuracy
2017-08-03 08:35:07 +00:00
Jiri Horner
bb6496d9e5 Merge pull request #8951 from hrnr:akaze_part2
[GSOC] Speeding-up AKAZE, part #2 (#8951)

* feature2d: instrument more functions used in AKAZE

* rework Compute_Determinant_Hessian_Response

* this takes 84% of time of Feature_Detection
* run everything in parallel
* compute Scharr kernels just once
* compute sigma more efficiently
* allocate all matrices in evolution without zeroing

* features2d: add one bigger image to tests

* now test have images: 600x768, 900x600 and 1385x700 to cover different resolutions

* explicitly zero Lx and Ly

* add Lflow and Lstep to evolution as in original AKAZE code

* reworked computing keypoints orientation

integrated faster function from https://github.com/h2suzuki/fast_akaze

* use standard fastAtan2 instead of getAngle

* compute keypoints orientation in parallel

* fix visual studio warnings

* replace some wrapped functions with direct calls to OpenCV functions

* improved readability for people familiar with opencv
* do not same image twice in base level

* rework diffusity stencil

* use one pass stencil for diffusity from https://github.com/h2suzuki/fast_akaze
* improve locality in Create_Scale_Space

* always compute determinat od hessian and spacial derivatives

* this needs to be computed always as we need derivatives while computing descriptors
* fixed tests of AKAZE with KAZE descriptors which have been affected by this

Currently it computes all first and second order derivatives together and the determiant of the hessian. For descriptors it would be enough to compute just first order derivates, but it is not probably worth it optimize for scenario where descriptors and keypoints are computed separately, since it is already very inefficient. When computing keypoint and descriptors together it is faster to do it the current way (preserves locality).

* parallelize non linear diffusion computation

* do multiplication right in the nlp diffusity kernel

* rework kfactor computation

* get rid of sharing buffers when creating scale space pyramid, the performace impact is neglegible

* features2d: initialize TBB scheduler in perf tests

* ensures more stable output
* more reasonable profiles, since the first call of parallel_for_ is not getting big performace hit

* compute_kfactor: interleave finding of maximum and computing distance

* no need to go twice through the data

* start to use UMats in AKAZE to leverage OpenCl in the future

* fixed bug that prevented computing determinant for scale pyramid of size 1 (just the base image)
* all descriptors now support writing to uninitialized memory
* use InputArray and OutputArray for input image and descriptors, allows to make use UMAt that user passes to us

* enable use of all existing ocl paths in AKAZE

* all parts that uses ocl-enabled functions should use ocl by now

* imgproc: fix dispatching of IPP version when OCL is disabled

* when OCL is disabled IPP version should be always prefered (even when the dst is UMat)

* get rid of copy in DeterminantHessian response

* this slows CPU version considerably
* do no run in parallel when running with OCL

* store derivations as UMat in pyramid

* enables OCL path computing of determint hessian
* will allow to compute descriptors on GPU in the future

* port diffusivity to OCL

* diffusivity itself is not a blocker, but this saves us downloading and uploading derivations

* implement kernel for nonlinear scalar diffusion step

* download the pyramid from GPU just once

we don't want to downlaod matrices ad hoc from gpu when the function in AKAZE needs it. There is a HUGE mapping overhead and without shared memory support a LOT of unnecessary transfers.

This maps/downloads matrices just once.

* fix bug with uninitialized values in non linear diffusion

* this was causing spurious segfaults in stitching tests due to propagation of NaNs
* added new test, which checks for NaNs (added new debug asserts for NaNs)
* valgrind now says everything is ok

* add nonlinear diffusion step OCL implementation

* Lt in pyramid changed to UMat, it will be downlaoded from GPU along with Lx, Ly
* fix bug in pm_g2 kernel. OpenCV mangles dimensions passed to OpenCL, so we need to check for boundaries in each OCL kernel.

* port computing of determinant to OCL

* computing of determinant is not a blocker, but with this change we don't need to download all spatial derivatives to CPU, we only download determinant
* make Ldet in the pyramid UMat, download it from CPU together with the other parts of the pyramid
* add profiling macros

* fix visual studio warning

* instrument non_linear_diffusion

* remove changes I have made to TEvolution

* TEvolution is used only in KAZE now

* Revert "features2d: initialize TBB scheduler in perf tests"

This reverts commit ba81e2a711.
2017-08-01 12:46:01 +00:00
Alexander Alekhin
c455fc0334 Merge pull request #9133 from sovrasov:mser_add_test 2017-07-14 19:38:05 +00:00
Vladislav Sovrasov
25af743902 mser: add a couple of new regression tests 2017-07-14 20:07:32 +03:00
Alexander Alekhin
a4a47b538c build: detect Android via '__ANDROID__' macro
https://sourceforge.net/p/predef/wiki/OperatingSystems
2017-07-10 12:43:59 +03:00
Jiri Horner
5f20e802d2 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 19538cac1e.

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!
2017-06-21 14:33:09 +03:00
Maksim Shabunin
9333f82be0 Reduce dependencies between modules 2017-03-15 17:58:52 +03:00
Rostislav Vasilikhin
13b9dd3963 fixed segfault at ORB::compute() near image's border 2016-12-16 18:36:37 +03:00
Vladislav Sovrasov
4a3da1c4ed Fix missing angles in AKAZE keypoints 2016-12-12 12:28:16 +03:00
Alexander Alekhin
dac37a0bc9 features2d: update rotation invariance test
Don't process keypoints near border, because after rotation border points
have contrast gradients with rotation border fill.
2016-11-18 15:20:03 +03:00
will hunt
ac2d79fd67 MSER: all test passed.
1. if a component's variation is a global minimum than it should be a local minimum
2. for the small image with invert and blur, the MSERs number should be 20
2016-08-15 09:25:45 +08:00
Maksim Shabunin
2cda78ffac Valgrind: fixed uninitialized image usage in descriptors regression tests 2015-12-09 14:25:09 +03:00
Ilya Lavrenov
cf0f47f589 fixed memory leak in descriptor regression tests 2015-09-13 12:14:30 +02:00
Ilya Lavrenov
f7d36bbad5 fixed memory leaks in modules/features2d/test/test_nearestneighbors.cpp 2015-09-13 12:08:19 +02:00
Ilya Lavrenov
e390c8c728 fixed typo 2015-09-11 18:59:33 +02:00
Roman Donchenko
ec0508269a NearestNeighborTest: use ts->get_rng() instead of (implicit) theRNG()
This ensures that test data is not dependent on the order the tests are
executed in.
2015-09-11 18:39:32 +02:00
Evgeny Agafonchikov
6a6d58d389 Adding test support for WINRT 2015-06-30 15:35:20 +03:00
Vadim Pisarevsky
af47b6551f another attempt to make the MSER test pass. removed possible randomization in parameters from run to run 2015-05-21 17:10:35 +03:00
Vadim Pisarevsky
4c67ae1a0b fixed failure in Features2d_MSER.cases 2015-05-21 16:27:34 +03:00
Vadim Pisarevsky
dab78c26b1 added reasonable test for MSER (including coverage for http://code.opencv.org/issues/4273, http://code.opencv.org/issues/1723 and http://code.opencv.org/issues/756); also, added some "in-progress" info to the Features2d_Feature2d.no_crash test. 2015-05-21 15:03:17 +03:00
Vadim Pisarevsky
b5a7122855 added test to do smoke testing of ORB, KAZE, AKAZE and BRISK on images of different size 2015-05-18 21:16:53 +03:00
Vadim Pisarevsky
fc06a2384b added test for batch detection/descriptor extraction (http://code.opencv.org/issues/3943) 2015-05-18 19:01:00 +03:00
Vadim Pisarevsky
432cf1152a added read/write functions for vector<DMatch> + the test (http://code.opencv.org/issues/4308) 2015-05-18 18:59:37 +03:00
cbalint13
fb56d5c482 Squash all BRISK commits into one. 2015-05-06 11:21:25 +03:00
orestis
fffe2464cd Change DescriptorExtractor_ORB regression test
to compensate for neon ieee754 non-compliancy.
Also changed the comparison between max valid and calculated distance to
make the error message more accurate (in case curMaxDist == maxDist)
2014-12-21 21:27:03 +02:00
Vadim Pisarevsky
d2b9dc5530 quickly corrected the previous refactoring of features2d: moved from set(SOME_PROP, val) to setSomeProp(val) 2014-10-18 20:44:26 +04:00
Vadim Pisarevsky
1176d4ef84 fixed some more compile errors and test failures 2014-10-17 15:02:56 +04:00
Vadim Pisarevsky
9c9ecc22e2 fixed opencv_java build 2014-10-17 14:56:58 +04:00
Vadim Pisarevsky
fa76c634ec ok; all the tests now pass 2014-10-17 14:56:58 +04:00
Vadim Pisarevsky
01d3848f17 all the tests now pass except for MSER 2014-10-17 14:56:58 +04:00
Vadim Pisarevsky
162384a838 fixed several test failures; currently 9 out of 73 tests fail 2014-10-17 14:56:58 +04:00
Vadim Pisarevsky
09df1a286b OpenCV with the refactored features2d compiles! contrib is broken for now; the tests are not tried yet 2014-10-17 14:56:58 +04:00
Vadim Pisarevsky
9575a82a9e Merge pull request #3299 from felixendres:orb_keypoint_detector_threshold 2014-10-09 14:52:38 +00:00
Felix Endres
ee6835492c Exposing the FAST detector threshold for ORB
Implemented as a new optional parameter for
the constructor of the ORB detector. The
change of this parameter has been included
in the orb unit test.
2014-10-02 12:17:01 +02:00
Dmitriy Anisimov
5f3ee657ce removed kdtree declaration from interface 2014-08-31 21:39:47 +04:00
Dmitriy Anisimov
37b1a7560c first version of moving KDTree from core to ml 2014-08-18 22:40:31 +04:00
Adil Ibragimov
8a4a1bb018 Several type of formal refactoring:
1. someMatrix.data -> someMatrix.prt()
2. someMatrix.data + someMatrix.step * lineIndex -> someMatrix.ptr( lineIndex )
3. (SomeType*) someMatrix.data -> someMatrix.ptr<SomeType>()
4. someMatrix.data -> !someMatrix.empty() ( or !someMatrix.data -> someMatrix.empty() ) in logical expressions
2014-08-13 15:21:35 +04:00
Vadim Pisarevsky
27d2d3cbac fixed doc builder complains and the test failures 2014-08-12 00:03:40 +04:00
Alexander Alekhin
55188fe991 world fix 2014-08-05 20:12:35 +04:00
f-morozov
7f82960897 AKAZE fixes, tests and tutorial 2014-07-30 18:02:08 +04:00
vbystricky
4286f60387 Extract imgcodecs module from highgui 2014-07-07 16:28:08 +04:00
Alexander Alekhin
776728ef2a KAZE: disable tests (too many crashes) 2014-05-29 23:12:48 +04:00
Vadim Pisarevsky
8bd1efa523 Merge pull request #2673 from BloodAxe:kaze 2014-05-19 17:35:22 +04:00
Ievgen Khvedchenia
029a8c443a Remove GSURF descriptor from KAZE algorithm 2014-05-10 20:57:37 +03:00
Ievgen Khvedchenia
1a5fcd715d Refactor of KAZE and AKAZE:
1) Clean-up from the unused code
2) Remove of SURF extraction method
3) Enabled threading for KAZE extraction
4) Exposed new properties for runtime configuration
2014-05-09 18:46:00 +03:00
Ievgen Khvedchenia
9fc90f4069 Merged nldiffusion functions into one module with removal of duplicate functions 2014-05-01 22:24:15 +03:00