Commit Graph

256 Commits

Author SHA1 Message Date
yuki takehara
a6277370ca
Merge pull request #21107 from take1014:remove_assert_21038
resolves #21038

* remove C assert

* revert C header

* fix several points in review

* fix test_ds.cpp
2021-11-27 18:34:52 +00:00
Jake Staahl
158b13e0ba Remove static initializers caused by templated static member. 2021-05-07 12:53:14 -07:00
Vincent Rabaud
ff211371bc Replace FLANNException by CV_Error. 2020-12-20 14:17:28 +01:00
Alexander Alekhin
7eaa548b6d flann: drop wrapping of Index class
- due to lifetime restrictions on passed 'features' parameter and its dangling pointers
- dangling pointer issue is fixed for OpenCV 4.5.1+
2020-12-09 05:39:35 +00:00
Alexander Alekhin
1f2c83845d backport: checks and fixes from static code analyzers results
original commit: 71f665bd8c
2020-09-02 19:05:47 +00:00
pemmanuelviel
31dc3e9256
Merge pull request #18211 from pemmanuelviel:pev--handle-dna-vectors
* DNA-mode: update miniflann to handle DNA

* DNA-mode: update hierarchical kmeans to handle DNA sequences
2020-09-01 20:38:21 +00:00
Pierre-Emmanuel Viel
5376863c0c bugfix 2020-08-27 12:21:02 +02:00
Alexander Alekhin
fc0f9da7a7 Merge pull request #18084 from pemmanuelviel:pev--add-DNA-distances 2020-08-20 13:26:02 +00:00
Pierre-Emmanuel Viel
3f55152ca0 Add debug assert to check in FLANN the vectors size is multiple of the architecture word size 2020-08-12 23:07:35 +02:00
Pierre-Emmanuel Viel
98de57c6c4 Refactoring to prepare for other vector types while mutualizing some methods 2020-08-12 00:57:37 +02:00
pemmanuelviel
793e7c0d9f
Merge pull request #18019 from pemmanuelviel:pev--multiple-kmeans-trees
* Possibility to set more than one tree for the hierarchical KMeans (default is still 1 tree).

This particularly improves NN retrieval results with binary vectors, allowing better quality
compared to LSH for similar processing time when speed is the criterium.

* Add explanations on the FLANN's hierarchical KMeans for binary data.
2020-08-03 18:29:57 +00:00
Pierre-Emmanuel Viel
bc221bdb90 Cleaner code for hierarchical_clustering 2020-08-02 18:05:54 +02:00
pemmanuelviel
c90e824342
Merge pull request #17639 from pemmanuelviel:pev--binary-kmeans
Pev binary kmeans

* Ongoing work transposing kmeans clustering method for bitfields: the computeClustering method

Ongoing work transposing kmeans clustering method for bitfields: interface computeBitfieldClustering

Fix genericity of computeNodeStatistics

Ongoing work transposing kmeans clustering method for bitfields: adapt computeNodeStatistics()

Ongoing work transposing kmeans clustering method for bitfields: adapt findNN() method

Ongoing work transposing kmeans clustering method for bitfields: allow kmeans with Hamming distance

Ongoing work transposing kmeans clustering method for bitfields: adapt distances code

Ongoing work transposing kmeans clustering method for bitfields: adapt load/save code

Ongoing work transposing kmeans clustering method for bitfields: adapt kmeans hierarchicalClustring()

PivotType -> CentersType Renaming

Fix type casting for ARM SIMD implementation of Hamming

Fix warnings with Win32 compilation

Fix warnings with Win64 compilation

Fix wrong parenthesis position on rounding

* Ensure proper rounding when CentersType is integral
2020-07-13 12:59:10 +00:00
Alexander Alekhin
5bc6b6fc26 Merge pull request #17737 from pemmanuelviel:pev--fix-trees-descent 2020-07-08 20:59:29 +00:00
Alexander Alekhin
deaf1dd458 Merge pull request #17724 from pemmanuelviel:pev--fix-mix-of-types 2020-07-04 17:16:57 +00:00
pemmanuelviel
65f87b114b
Merge pull request #17722 from pemmanuelviel:pev--replace-asserts
* Clean: replace C style asserts by CV_Assert and CV_DbgAssert

* Try fixing warning on Windows compilation

* Another way trying to fix warnings on Win

* Fixing warnings with some compilers:
Some compilers warn on systematic exit preventing to execute the code that follows.
This is why assert(0) that exits only in debug was working, but not CV_Assert or CV_Error
that exit both in release and debug, even if with different behavior.
In addition, other compilers complain when return 0 is removed from getKey(),
even if before we have a statement leading to systematic exit.

* Disable "unreachable code" warnings for Win compilers so we can use proper CV_Error
2020-07-04 20:15:44 +03:00
Alexander Alekhin
8f5b453a96 Merge pull request #17719 from pemmanuelviel:pev--fix-computeNodeStatistics-genericity 2020-07-04 17:14:35 +00:00
Alexander Alekhin
49497d8e7c Merge pull request #17725 from pemmanuelviel:pev--precompute-divisor 2020-07-03 11:24:11 +00:00
Pierre-Emmanuel Viel
728684840c Fix trees parsing behavior in hierarchical_clustering_index:
Before, when maxCheck was reached in the first descent of a tree, time was still wasted parsing
the next trees till their best leaves whose points were not used at all.
2020-07-03 01:19:10 +02:00
Alexander Alekhin
73f7d091f8 Merge pull request #17721 from pemmanuelviel:pev--fix-hist-intersect-arguments 2020-07-02 11:54:28 +00:00
Pierre-Emmanuel Viel
6a045fd678 Fix arguments list in loadindex for histogram intersection 2020-07-01 18:59:45 +02:00
Pierre-Emmanuel Viel
327f92cc46 Precompute the divisor to ensure that no kind of compiler would process it on the fly at each call. 2020-07-01 18:52:05 +02:00
Pierre-Emmanuel Viel
482cacd420 Mix of 32 and 64bits vector types prevents vectorisation for distance computation.
Argument "a" is of type ElementType* that is either int* or float*, while b was double*.
Mixing types prevents the possibility to use SSE or AVX instructions.
On implementation without SIMD instructions, this doesn't show any impact on performance.
2020-07-01 18:27:07 +02:00
Pierre-Emmanuel Viel
93a6be836c Remove duplicate line 2020-07-01 18:15:01 +02:00
Pierre-Emmanuel Viel
ef7185ce43 Fix genericity of computeNodeStatistics that couldn't compute stats properly on sub-nodes 2020-07-01 12:14:15 +02:00
Alexander Alekhin
a84afb6334 Merge pull request #17640 from pemmanuelviel:pev--fix-lsh-bad-any-cast 2020-06-29 20:53:34 +00:00
Pierre-Emmanuel Viel
cdac7c7bec Add test checking we don't throw when creating GenericIndex with LshIndexParams() 2020-06-28 19:51:04 +00:00
Pierre-Emmanuel Viel
fe09c79f4b Fix the 'cvflann::anyimpl::bad_any_cast' error using Lsh 2020-06-28 19:51:04 +00:00
pemmanuelviel
daa88c6b9e
Merge pull request #17642 from pemmanuelviel:pev--fixes-and-clean
* Clean: make the use of the indices array length consistent

Either we don't want this method to be used in the future for any other node
than the root node, and so we replace indices_length by size_ and remove it as
argument, or we want to be able to use it potentially for other nodes, and
so using size_ instead of indices_length would have lead to a bug.

* Fix: b was not an address

* Fix: transpose the Flann repo commit "Fixes in accum_dist methods" from Adil Ibragimov

Avoids trying to compute log(ratio) with ratio = 0

* Fix: transpose the Flann repo commit "result_set bugfix" from Jack Rae

* Fix Jack Rae commit as the initial i - 1 index was decremented before entering the loop body

* Clean: transpose the Flann repo commit "Updated comments in lsh_index" from Richard McPherson

* Fix: Transpose the Flann repo commit "Fixing unreachable code in lsh_table.h" from hypevr

* Fix warning the same way it was done in flann standalone repo

* Change the return value in case of unsupported type
2020-06-26 22:34:52 +00:00
Alexander Alekhin
e45d74c8f9 Merge pull request #17638 from pemmanuelviel:pev--avoid-branching-in-loop 2020-06-26 19:22:20 +00:00
Pierre-Emmanuel Viel
06b4292534 Fix: error in the dimension used for computeMinMax
Instead of using the current dimension for which we just got a big span,
we were computing Min and Max for the previous dimension stored in cutfeat
(and using 0 instead of the dimension indice for the very first dimension
with "span > (1-eps)max_span")
2020-06-23 15:47:27 +02:00
Pierre-Emmanuel Viel
29f883feee Optim: test that could be done once has been extracted from the loop 2020-06-23 15:43:38 +02:00
Pierre-Emmanuel Viel
05fbd1e5bc DNA mode: add the distance computations 2020-06-22 22:53:05 +02:00
Brian Wignall
f9c514b391 Fix spelling typos
backport commit 659ffaddb4
2019-12-27 12:46:53 +00:00
Tatsuro Shibamura
971ae00942 Merge pull request #16027 from shibayan:arm64-windows10
* Support ARM64 Windows 10 platform

* Fixed detection issue for ARM64 Windows 10

* Try enabling ARM NEON intrin

* build: disable NEON with MSVC compiler

* samples(directx): gdi32 dependency
2019-12-17 00:23:30 +03:00
Alexander Alekhin
7ec91aefc1 python: force using of ArgInfo 2019-11-15 19:16:22 +03:00
Maksim Shabunin
f3aab47f94 Assorted documentation fixes
* removed private flann documentation
* common tutorial images moved to doc/images
* grouping issues
2019-08-31 01:50:11 +03:00
luz.paz
fcc7d8dd4e Fix modules/ typos
Found using `codespell -q 3 -S ./3rdparty -L activ,amin,ang,atleast,childs,dof,endwhile,halfs,hist,iff,nd,od,uint`

backporting of commit: ec43292e1e
2019-08-16 17:34:29 +03:00
TheGoddessInari
960bb540ec Make sure to use defined(__GNUC__) instead of bare __GNUC__ in flann2 header.
This fixes a compiler error on MSVC with Unreal Engine (at least).

backport of commit: 4e998c9ade
2019-08-05 17:19:12 +03:00
Apoorv Goel
5b521bb778 Merge pull request #14898 from UnderscoreAsterisk:flann-warnings-and-4376
Keep a local copy of `features` from `flann::GenericIndex ` constructor (#14898)

* Fix warnings on Windows

* Fix #4376
2019-06-26 19:35:11 +03:00
Maksim Shabunin
10d61a2b44 Limited API support for Python3 2019-06-11 15:15:49 +03:00
Matthew K. Gumbel
74e3403620 flann/kmeans: Fix non-determinism of KMeans index
When running with >1 OpenCV thread, KMeans index generation was
non-deterministic because of a RWW race. Issue is resolved by removing
the offending logic from the parallel section.
2019-03-20 08:44:31 -07:00
Lindsay Roberts
7c72e095fa Fix Flann compilation under nvcc + NEON
All <arm_neon.h> includes in core/cv_cpu_dispatch.h are protected by an
ifndef __CUDACC__ to prevent attempting to use neon intrinsics when
compiling cuda kernels (.cu) -- this prevents hard errors such as
  error: identifier "__builtin_neon_qi" is undefined

Add this same protection to flann/dist.h to fix compilation involving
flann.hpp.
2019-02-19 15:11:01 +02:00
1over
5ff76088b9 fixed memory issue in flann 2018-11-25 01:31:54 +01:00
Apoorv Goel
d8ffddd075 Merge pull request #12871 from UnderscoreAsterisk:document-Distance
* Document distance functors in dist.h

* Add spec for Distance

* Generate appropriate links for symbols
2018-10-20 11:15:13 +03:00
Apoorv
a7dfa261d8 Add documentation for radiusSearch 2018-10-18 04:09:16 +05:30
Alexander Alekhin
52f52f6786 flann: drop useless mutex 2018-09-26 19:37:44 +03:00
Hamdi Sahloul
5d54def264 Add semicolons after CV_INSTRUMENT macros 2018-09-14 06:45:31 +09:00
Hamdi Sahloul
a39e0daacf Utilize CV_UNUSED macro 2018-09-07 20:33:52 +09:00
Alexander Alekhin
b09a4a98d4 opencv: Use cv::AutoBuffer<>::data() 2018-07-04 19:11:29 +03:00