Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
b94e09bf
Commit
b94e09bf
authored
May 21, 2010
by
Vadim Pisarevsky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
renamed cv::flann to cv::cvflann to avoid name conflicts
parent
60019422
Hide whitespace changes
Inline
Side-by-side
Showing
39 changed files
with
155 additions
and
144 deletions
+155
-144
autotuned_index.h
3rdparty/flann/algorithms/autotuned_index.h
+1
-1
composite_index.h
3rdparty/flann/algorithms/composite_index.h
+1
-1
dist.cpp
3rdparty/flann/algorithms/dist.cpp
+1
-1
dist.h
3rdparty/flann/algorithms/dist.h
+1
-1
kdtree_index.h
3rdparty/flann/algorithms/kdtree_index.h
+1
-1
kmeans_index.h
3rdparty/flann/algorithms/kmeans_index.h
+1
-1
linear_index.h
3rdparty/flann/algorithms/linear_index.h
+1
-1
nn_index.h
3rdparty/flann/algorithms/nn_index.h
+1
-1
flann.cpp
3rdparty/flann/flann.cpp
+2
-2
flann.hpp
3rdparty/flann/flann.hpp
+1
-1
ground_truth.h
3rdparty/flann/nn/ground_truth.h
+1
-1
index_testing.cpp
3rdparty/flann/nn/index_testing.cpp
+1
-1
index_testing.h
3rdparty/flann/nn/index_testing.h
+1
-1
simplex_downhill.h
3rdparty/flann/nn/simplex_downhill.h
+1
-1
allocator.h
3rdparty/flann/util/allocator.h
+1
-1
common.h
3rdparty/flann/util/common.h
+1
-1
heap.h
3rdparty/flann/util/heap.h
+1
-1
logger.cpp
3rdparty/flann/util/logger.cpp
+1
-1
logger.h
3rdparty/flann/util/logger.h
+1
-1
matrix.h
3rdparty/flann/util/matrix.h
+1
-1
object_factory.h
3rdparty/flann/util/object_factory.h
+1
-1
random.cpp
3rdparty/flann/util/random.cpp
+1
-1
random.h
3rdparty/flann/util/random.h
+1
-1
result_set.h
3rdparty/flann/util/result_set.h
+1
-1
saving.cpp
3rdparty/flann/util/saving.cpp
+1
-1
saving.h
3rdparty/flann/util/saving.h
+1
-1
timer.h
3rdparty/flann/util/timer.h
+1
-1
common.h
3rdparty/include/flann/common.h
+1
-1
flann.hpp
3rdparty/include/flann/flann.hpp
+1
-1
matrix.h
3rdparty/include/flann/matrix.h
+1
-1
random.h
3rdparty/include/flann/random.h
+1
-1
cxcore_clustering_search.tex
doc/cxcore_clustering_search.tex
+9
-9
core.hpp
modules/core/include/opencv2/core/core.hpp
+45
-34
flann.hpp
modules/core/include/opencv2/core/flann.hpp
+10
-10
flann.cpp
modules/core/src/flann.cpp
+44
-44
features2d.hpp
modules/features2d/include/opencv2/features2d/features2d.hpp
+1
-1
oneway.cpp
modules/features2d/src/oneway.cpp
+11
-11
find_obj.cpp
samples/c/find_obj.cpp
+2
-2
anearestneighbors.cpp
tests/cv/src/anearestneighbors.cpp
+1
-1
No files found.
3rdparty/flann/algorithms/autotuned_index.h
View file @
b94e09bf
...
...
@@ -36,7 +36,7 @@
#include "ground_truth.h"
#include "index_testing.h"
namespace
flann
namespace
cv
flann
{
class
AutotunedIndex
:
public
NNIndex
...
...
3rdparty/flann/algorithms/composite_index.h
View file @
b94e09bf
...
...
@@ -34,7 +34,7 @@
#include "constants.h"
#include "nn_index.h"
namespace
flann
namespace
cv
flann
{
class
CompositeIndex
:
public
NNIndex
...
...
3rdparty/flann/algorithms/dist.cpp
View file @
b94e09bf
...
...
@@ -30,7 +30,7 @@
#include "dist.h"
namespace
flann
namespace
cv
flann
{
/** Global variable indicating the distance metric
...
...
3rdparty/flann/algorithms/dist.h
View file @
b94e09bf
...
...
@@ -36,7 +36,7 @@ using namespace std;
#include "constants.h"
namespace
flann
namespace
cv
flann
{
/**
...
...
3rdparty/flann/algorithms/kdtree_index.h
View file @
b94e09bf
...
...
@@ -48,7 +48,7 @@
using
namespace
std
;
namespace
flann
namespace
cv
flann
{
...
...
3rdparty/flann/algorithms/kmeans_index.h
View file @
b94e09bf
...
...
@@ -50,7 +50,7 @@
using
namespace
std
;
namespace
flann
namespace
cv
flann
{
/**
...
...
3rdparty/flann/algorithms/linear_index.h
View file @
b94e09bf
...
...
@@ -34,7 +34,7 @@
#include "constants.h"
#include "nn_index.h"
namespace
flann
namespace
cv
flann
{
class
LinearIndex
:
public
NNIndex
{
...
...
3rdparty/flann/algorithms/nn_index.h
View file @
b94e09bf
...
...
@@ -41,7 +41,7 @@
using
namespace
std
;
namespace
flann
namespace
cv
flann
{
class
ResultSet
;
...
...
3rdparty/flann/flann.cpp
View file @
b94e09bf
...
...
@@ -58,7 +58,7 @@ using namespace std;
#endif
namespace
flann
namespace
cv
flann
{
typedef
ObjectFactory
<
IndexParams
,
flann_algorithm_t
>
ParamsFactory
;
...
...
@@ -224,7 +224,7 @@ int hierarchicalClustering(const Matrix<float>& features, Matrix<float>& centers
using
namespace
flann
;
using
namespace
cv
flann
;
typedef
NNIndex
*
NNIndexPtr
;
typedef
Matrix
<
float
>*
MatrixPtr
;
...
...
3rdparty/flann/flann.hpp
View file @
b94e09bf
...
...
@@ -40,7 +40,7 @@
#include "flann.h"
namespace
flann
namespace
cv
flann
{
class
NNIndex
;
...
...
3rdparty/flann/nn/ground_truth.h
View file @
b94e09bf
...
...
@@ -34,7 +34,7 @@
#include "matrix.h"
#include "dist.h"
namespace
flann
namespace
cv
flann
{
template
<
typename
T
>
...
...
3rdparty/flann/nn/index_testing.cpp
View file @
b94e09bf
...
...
@@ -40,7 +40,7 @@
#include <string.h>
#include <stdlib.h>
namespace
flann
namespace
cv
flann
{
const
float
SEARCH_EPS
=
0.001
f
;
...
...
3rdparty/flann/nn/index_testing.h
View file @
b94e09bf
...
...
@@ -38,7 +38,7 @@
using
namespace
std
;
namespace
flann
namespace
cv
flann
{
void
search_for_neighbors
(
NNIndex
&
index
,
const
Matrix
<
float
>&
testset
,
Matrix
<
int
>&
result
,
Matrix
<
float
>&
dists
,
const
SearchParams
&
searchParams
,
int
skip
=
0
);
...
...
3rdparty/flann/nn/simplex_downhill.h
View file @
b94e09bf
...
...
@@ -31,7 +31,7 @@
#ifndef SIMPLEX_DOWNHILL_H
#define SIMPLEX_DOWNHILL_H
namespace
flann
namespace
cv
flann
{
/**
...
...
3rdparty/flann/util/allocator.h
View file @
b94e09bf
...
...
@@ -35,7 +35,7 @@
#include <stdio.h>
namespace
flann
namespace
cv
flann
{
/**
...
...
3rdparty/flann/util/common.h
View file @
b94e09bf
...
...
@@ -36,7 +36,7 @@
#include <stdexcept>
namespace
flann
namespace
cv
flann
{
class
FLANNException
:
public
std
::
runtime_error
{
public
:
...
...
3rdparty/flann/util/heap.h
View file @
b94e09bf
...
...
@@ -35,7 +35,7 @@
#include <algorithm>
using
namespace
std
;
namespace
flann
namespace
cv
flann
{
/**
...
...
3rdparty/flann/util/logger.cpp
View file @
b94e09bf
...
...
@@ -36,7 +36,7 @@
using
namespace
std
;
namespace
flann
namespace
cv
flann
{
Logger
logger
;
...
...
3rdparty/flann/util/logger.h
View file @
b94e09bf
...
...
@@ -39,7 +39,7 @@
using
namespace
std
;
namespace
flann
namespace
cv
flann
{
class
Logger
...
...
3rdparty/flann/util/matrix.h
View file @
b94e09bf
...
...
@@ -35,7 +35,7 @@
#include <random.h>
namespace
flann
namespace
cv
flann
{
/**
* Class implementing a generic rectangular dataset.
...
...
3rdparty/flann/util/object_factory.h
View file @
b94e09bf
...
...
@@ -33,7 +33,7 @@
#include <map>
namespace
flann
namespace
cv
flann
{
template
<
typename
BaseClass
,
typename
DerivedClass
>
...
...
3rdparty/flann/util/random.cpp
View file @
b94e09bf
...
...
@@ -31,7 +31,7 @@
#include "random.h"
namespace
flann
namespace
cv
flann
{
void
seed_random
(
unsigned
int
seed
)
...
...
3rdparty/flann/util/random.h
View file @
b94e09bf
...
...
@@ -37,7 +37,7 @@
using
namespace
std
;
namespace
flann
namespace
cv
flann
{
/**
...
...
3rdparty/flann/util/result_set.h
View file @
b94e09bf
...
...
@@ -40,7 +40,7 @@
using
namespace
std
;
namespace
flann
namespace
cv
flann
{
/* This record represents a branch point when finding neighbors in
...
...
3rdparty/flann/util/saving.cpp
View file @
b94e09bf
...
...
@@ -33,7 +33,7 @@
#include "nn_index.h"
#include <cstdio>
namespace
flann
namespace
cv
flann
{
const
char
FLANN_SIGNATURE
[]
=
"FLANN_INDEX"
;
...
...
3rdparty/flann/util/saving.h
View file @
b94e09bf
...
...
@@ -35,7 +35,7 @@
#include "nn_index.h"
namespace
flann
namespace
cv
flann
{
/**
...
...
3rdparty/flann/util/timer.h
View file @
b94e09bf
...
...
@@ -34,7 +34,7 @@
#include <time.h>
namespace
flann
namespace
cv
flann
{
/**
...
...
3rdparty/include/flann/common.h
View file @
b94e09bf
...
...
@@ -36,7 +36,7 @@
#include <stdexcept>
namespace
flann
namespace
cv
flann
{
class
FLANNException
:
public
std
::
runtime_error
{
public
:
...
...
3rdparty/include/flann/flann.hpp
View file @
b94e09bf
...
...
@@ -40,7 +40,7 @@
#include "flann.h"
namespace
flann
namespace
cv
flann
{
class
NNIndex
;
...
...
3rdparty/include/flann/matrix.h
View file @
b94e09bf
...
...
@@ -35,7 +35,7 @@
#include "random.h"
namespace
flann
namespace
cv
flann
{
/**
* Class implementing a generic rectangular dataset.
...
...
3rdparty/include/flann/random.h
View file @
b94e09bf
...
...
@@ -37,7 +37,7 @@
using
namespace
std
;
namespace
flann
namespace
cv
flann
{
/**
...
...
doc/cxcore_clustering_search.tex
View file @
b94e09bf
...
...
@@ -293,11 +293,11 @@ This section documents OpenCV's interface to the FLANN\footnote{http://people.cs
contains a collection of algorithms optimized for fast nearest neighbor search in large datasets and for high dimensional features. More
information about FLANN can be found in
\cite
{
muja
_
flann
_
2009
}
.
\cvclass
{
flann::Index
}
\cvclass
{
cv
flann::Index
}
The FLANN nearest neighbor index class.
\begin{lstlisting}
namespace flann
namespace
cv
flann
{
class Index
{
...
...
@@ -335,7 +335,7 @@ namespace flann
}
\end{lstlisting}
\cvCppFunc
{
flann::Index::Index
}
\cvCppFunc
{
cv
flann::Index::Index
}
Constructs a nearest neighbor search index for a given dataset.
\cvdefCpp
{
Index::Index(const Mat
\&
features, const IndexParams
\&
params);
}
...
...
@@ -452,7 +452,7 @@ optimum parameters.}
}
\end{description}
\cvCppFunc
{
flann::Index::knnSearch
}
\cvCppFunc
{
cv
flann::Index::knnSearch
}
Performs a K-nearest neighbor search for a given query point using the index.
\cvdefCpp
{
void Index::knnSearch(const vector<float>
\&
query,
\par
vector<int>
\&
indices,
\par
...
...
@@ -479,7 +479,7 @@ precision was also computed, in which case this parameter is ignored.}
\end{description}
\end{description}
\cvCppFunc
{
flann::Index::knnSearch
}
\cvCppFunc
{
cv
flann::Index::knnSearch
}
Performs a K-nearest neighbor search for multiple query points.
\cvdefCpp
{
void Index::knnSearch(const Mat
\&
queries,
\par
...
...
@@ -495,7 +495,7 @@ Performs a K-nearest neighbor search for multiple query points.
\end{description}
\cvCppFunc
{
flann::Index::radiusSearch
}
\cvCppFunc
{
cv
flann::Index::radiusSearch
}
Performs a radius nearest neighbor search for a given query point.
\cvdefCpp
{
int Index::radiusSearch(const vector<float>
\&
query,
\par
vector<int>
\&
indices,
\par
...
...
@@ -511,7 +511,7 @@ Performs a radius nearest neighbor search for a given query point.
\end{description}
\cvCppFunc
{
flann::Index::radiusSearch
}
\cvCppFunc
{
cv
flann::Index::radiusSearch
}
Performs a radius nearest neighbor search for multiple query points.
\cvdefCpp
{
int Index::radiusSearch(const Mat
\&
query,
\par
Mat
\&
indices,
\par
...
...
@@ -527,7 +527,7 @@ Performs a radius nearest neighbor search for multiple query points.
\end{description}
\cvCppFunc
{
flann::Index::save
}
\cvCppFunc
{
cv
flann::Index::save
}
Saves the index to a file.
\cvdefCpp
{
void Index::save(std::string filename);
}
\begin{description}
...
...
@@ -535,7 +535,7 @@ Saves the index to a file.
\end{description}
\cvCppFunc
{
flann::hierarchicalClustering
}
\cvCppFunc
{
cv
flann::hierarchicalClustering
}
Clusters the given points by constructing a hierarchical k-means tree and choosing a cut in the tree that minimizes the cluster's variance.
\cvdefCpp
{
int hierarchicalClustering(const Mat
\&
features, Mat
\&
centers,
\par
const KMeansIndexParams
\&
params);
}
...
...
modules/core/include/opencv2/core/core.hpp
View file @
b94e09bf
...
...
@@ -131,10 +131,9 @@ public:
};
/*!
\fn void error(const Exception& exc);
\brief Signals an error and raises the exception.
//! Signals an error and raises the exception.
/*!
By default the function prints information about the error to stderr,
then it either stops if setBreakOnError() had been called before or raises the exception.
It is possible to alternate error processing by using redirectError().
...
...
@@ -143,10 +142,9 @@ public:
*/
CV_EXPORTS
void
error
(
const
Exception
&
exc
);
//! Sets/resets the break-on-error mode.
/*!
\fn bool setBreakOnError(bool flag);
\brief Sets/resets the break-on-error mode.
When the break-on-error mode is set, the default error handler
issues a hardware exception, which can make debugging more convenient.
...
...
@@ -158,11 +156,9 @@ typedef int (CV_CDECL *ErrorCallback)( int status, const char* func_name,
const
char
*
err_msg
,
const
char
*
file_name
,
int
line
,
void
*
userdata
);
/*!
\fn ErrorCallback redirectError( ErrorCallback errCallback,
void* userdata=0, void** prevUserdata=0);
\brief Sets the new error handler and the optional user data.
//! Sets the new error handler and the optional user data.
/*!
The function sets the new error handler, called from cv::error().
\param errCallback the new error handler. If NULL, the default error handler is used.
...
...
@@ -194,10 +190,9 @@ CV_EXPORTS void setNumThreads(int);
CV_EXPORTS
int
getNumThreads
();
CV_EXPORTS
int
getThreadNum
();
/*!
\fn int64 getTickCount();
\brief Returns the number of ticks.
//! Returns the number of ticks.
/*!
The function returns the number of ticks since the certain event (e.g. when the machine was turned on).
It can be used to initialize cv::RNG or to measure a function execution time by reading the tick count
before and after the function call. The granularity of ticks depends on the hardware and OS used. Use
...
...
@@ -206,8 +201,7 @@ CV_EXPORTS int getThreadNum();
CV_EXPORTS
int64
getTickCount
();
/*!
\fn int64 getTickCount();
\brief Returns the number of ticks per seconds.
Returns the number of ticks per seconds.
The function returns the number of ticks (as returned by cv::getTickCount()) per second.
The following code computes the execution time in milliseconds:
...
...
@@ -221,8 +215,7 @@ CV_EXPORTS int64 getTickCount();
CV_EXPORTS
double
getTickFrequency
();
/*!
\fn int64 getCPUTickCount();
\brief Returns the number of CPU ticks.
Returns the number of CPU ticks.
On platforms where the feature is available, the function returns the number of CPU ticks
since the certain event (normally, the system power-on moment). Using this function
...
...
@@ -232,8 +225,7 @@ CV_EXPORTS double getTickFrequency();
CV_EXPORTS
int64
getCPUTickCount
();
/*!
\fn bool checkHardwareSupport(int feature);
\brief Returns SSE etc. support status
Returns SSE etc. support status
The function returns true if certain hardware features are available.
Currently, the following features are recognized:
...
...
@@ -253,8 +245,7 @@ CV_EXPORTS int64 getCPUTickCount();
CV_EXPORTS
bool
checkHardwareSupport
(
int
feature
);
/*!
\fn void* fastMalloc(size_t bufSize);
\brief allocates memory buffer
Allocates memory buffer
This is specialized OpenCV memory allocation function that returns properly aligned memory buffers.
The usage is identical to malloc(). The allocated buffers must be freed with cv::fastFree().
...
...
@@ -266,8 +257,7 @@ CV_EXPORTS bool checkHardwareSupport(int feature);
CV_EXPORTS
void
*
fastMalloc
(
size_t
bufSize
);
/*!
\fn void fastFree(void* ptr);
\brief frees the memory allocated with cv::fastMalloc
Frees the memory allocated with cv::fastMalloc
This is the corresponding deallocation function for cv::fastMalloc().
When ptr==NULL, the function has no effect.
...
...
@@ -285,8 +275,7 @@ template<typename _Tp> static inline void deallocate(_Tp* ptr, size_t)
}
/*!
\fn template<typename _Tp> inline _Tp* alignPtr(_Tp* ptr, int n=(int)sizeof(_Tp));
\brief aligns pointer by the certain number of bytes
Aligns pointer by the certain number of bytes
This small inline function aligns the pointer by the certian number of bytes by shifting
it forward by 0 or a positive offset.
...
...
@@ -297,8 +286,7 @@ template<typename _Tp> static inline _Tp* alignPtr(_Tp* ptr, int n=(int)sizeof(_
}
/*!
\fn inline size_t alignSize(size_t sz, int n);
\brief aligns buffer size by the certain number of bytes
Aligns buffer size by the certain number of bytes
This small inline function aligns a buffer size by the certian number of bytes by enlarging it.
*/
...
...
@@ -308,8 +296,7 @@ static inline size_t alignSize(size_t sz, int n)
}
/*!
\fn void setUseOptimized(bool flag);
\brief Turns on/off available optimization
Turns on/off available optimization
The function turns on or off the optimized code in OpenCV. Some optimization can not be enabled
or disabled, but, for example, most of SSE code in OpenCV can be temporarily turned on or off this way.
...
...
@@ -320,8 +307,7 @@ static inline size_t alignSize(size_t sz, int n)
CV_EXPORTS
void
setUseOptimized
(
bool
);
/*!
\fn bool useOptimized();
\brief Returns the current optimization status
Returns the current optimization status
The function returns the current optimization status, which is controlled by cv::setUseOptimized().
*/
...
...
@@ -1693,43 +1679,68 @@ CV_EXPORTS void max(const Mat& a, const Mat& b, Mat& c);
//! computes per-element maximum of array and a scalar (c = max(a, alpha))
CV_EXPORTS
void
max
(
const
Mat
&
a
,
double
alpha
,
Mat
&
c
);
//! computes square root of each matrix element
CV_EXPORTS
void
sqrt
(
const
Mat
&
a
,
Mat
&
b
);
//! raises the input matrix elements to the specified power
CV_EXPORTS
void
pow
(
const
Mat
&
a
,
double
power
,
Mat
&
b
);
//! computes exponent of each matrix element
CV_EXPORTS
void
exp
(
const
Mat
&
a
,
Mat
&
b
);
//! computes natural logarithm of each matrix element
CV_EXPORTS
void
log
(
const
Mat
&
a
,
Mat
&
b
);
//! computes cube root of the argument
CV_EXPORTS
float
cubeRoot
(
float
val
);
//! computes the angle in degrees (0..360) of the vector (x,y)
CV_EXPORTS
float
fastAtan2
(
float
y
,
float
x
);
//! converts polar coordinates to Cartesian
CV_EXPORTS
void
polarToCart
(
const
Mat
&
magnitude
,
const
Mat
&
angle
,
Mat
&
x
,
Mat
&
y
,
bool
angleInDegrees
=
false
);
//! converts Cartesian coordinates to polar
CV_EXPORTS
void
cartToPolar
(
const
Mat
&
x
,
const
Mat
&
y
,
Mat
&
magnitude
,
Mat
&
angle
,
bool
angleInDegrees
=
false
);
//! computes angle (angle(i)) of each (x(i), y(i)) vector
CV_EXPORTS
void
phase
(
const
Mat
&
x
,
const
Mat
&
y
,
Mat
&
angle
,
bool
angleInDegrees
=
false
);
bool
angleInDegrees
=
false
);
//! computes magnitude (magnitude(i)) of each (x(i), y(i)) vector
CV_EXPORTS
void
magnitude
(
const
Mat
&
x
,
const
Mat
&
y
,
Mat
&
magnitude
);
//! checks that each matrix element is within the specified range.
CV_EXPORTS
bool
checkRange
(
const
Mat
&
a
,
bool
quiet
=
true
,
Point
*
pt
=
0
,
double
minVal
=-
DBL_MAX
,
double
maxVal
=
DBL_MAX
);
//! implements generalized matrix product algorithm GEMM from BLAS
CV_EXPORTS
void
gemm
(
const
Mat
&
a
,
const
Mat
&
b
,
double
alpha
,
const
Mat
&
c
,
double
gamma
,
Mat
&
d
,
int
flags
=
0
);
//! multiplies matrix by its transposition from the left or from the right
CV_EXPORTS
void
mulTransposed
(
const
Mat
&
a
,
Mat
&
c
,
bool
aTa
,
const
Mat
&
delta
=
Mat
(),
double
scale
=
1
,
int
rtype
=-
1
);
//! transposes the matrix
CV_EXPORTS
void
transpose
(
const
Mat
&
a
,
Mat
&
b
);
//! performs affine transformation of each element of multi-channel input matrix
CV_EXPORTS
void
transform
(
const
Mat
&
src
,
Mat
&
dst
,
const
Mat
&
m
);
//! performs perspective transformation of each element of multi-channel input matrix
CV_EXPORTS
void
perspectiveTransform
(
const
Mat
&
src
,
Mat
&
dst
,
const
Mat
&
m
);
//! extends the symmetrical matrix from the lower half or from the upper half
CV_EXPORTS
void
completeSymm
(
Mat
&
a
,
bool
lowerToUpper
=
false
);
//! initializes scaled identity matrix
CV_EXPORTS
void
setIdentity
(
Mat
&
c
,
const
Scalar
&
s
=
Scalar
(
1
));
//! computes determinant of a square matrix
CV_EXPORTS
double
determinant
(
const
Mat
&
m
);
//! computes trace of a matrix
CV_EXPORTS
Scalar
trace
(
const
Mat
&
m
);
//! computes inverse or pseudo-inverse matrix
CV_EXPORTS
double
invert
(
const
Mat
&
a
,
Mat
&
c
,
int
flags
=
DECOMP_LU
);
//! solves linear system or a least-square problem
CV_EXPORTS
bool
solve
(
const
Mat
&
a
,
const
Mat
&
b
,
Mat
&
x
,
int
flags
=
DECOMP_LU
);
//! sorts independently each matrix row or each matrix column
CV_EXPORTS
void
sort
(
const
Mat
&
a
,
Mat
&
b
,
int
flags
);
//! sorts independently each matrix row or each matrix column
CV_EXPORTS
void
sortIdx
(
const
Mat
&
a
,
Mat
&
b
,
int
flags
);
//! finds real roots of a cubic polynomial
CV_EXPORTS
int
solveCubic
(
const
Mat
&
coeffs
,
Mat
&
roots
);
//! finds real and complex roots of a polynomial
CV_EXPORTS
double
solvePoly
(
const
Mat
&
coeffs
,
Mat
&
roots
,
int
maxIters
=
300
);
//!
CV_EXPORTS
bool
eigen
(
const
Mat
&
a
,
Mat
&
eigenvalues
,
int
lowindex
=-
1
,
int
highindex
=-
1
);
CV_EXPORTS
bool
eigen
(
const
Mat
&
a
,
Mat
&
eigenvalues
,
Mat
&
eigenvectors
,
...
...
modules/core/include/opencv2/core/flann.hpp
View file @
b94e09bf
...
...
@@ -45,14 +45,14 @@
#ifdef __cplusplus
namespace
flann
namespace
cv
flann
{
class
Index
;
}
namespace
cv
{
namespace
flann
{
namespace
cv
flann
{
/* Nearest neighbor index algorithms */
enum
flann_algorithm_t
{
...
...
@@ -89,7 +89,7 @@ class CV_EXPORTS IndexFactory
{
public
:
virtual
~
IndexFactory
()
{}
virtual
::
flann
::
Index
*
createIndex
(
const
Mat
&
dataset
)
const
=
0
;
virtual
::
cv
flann
::
Index
*
createIndex
(
const
Mat
&
dataset
)
const
=
0
;
};
struct
CV_EXPORTS
IndexParams
:
public
IndexFactory
{
...
...
@@ -101,7 +101,7 @@ protected:
struct
CV_EXPORTS
LinearIndexParams
:
public
IndexParams
{
LinearIndexParams
()
{};
::
flann
::
Index
*
createIndex
(
const
Mat
&
dataset
)
const
;
::
cv
flann
::
Index
*
createIndex
(
const
Mat
&
dataset
)
const
;
};
...
...
@@ -111,7 +111,7 @@ struct CV_EXPORTS KDTreeIndexParams : public IndexParams {
int
trees
;
// number of randomized trees to use (for kdtree)
::
flann
::
Index
*
createIndex
(
const
Mat
&
dataset
)
const
;
::
cv
flann
::
Index
*
createIndex
(
const
Mat
&
dataset
)
const
;
};
struct
CV_EXPORTS
KMeansIndexParams
:
public
IndexParams
{
...
...
@@ -127,7 +127,7 @@ struct CV_EXPORTS KMeansIndexParams : public IndexParams {
flann_centers_init_t
centers_init
;
// algorithm used for picking the initial cluster centers for kmeans tree
float
cb_index
;
// cluster boundary index. Used when searching the kmeans tree
::
flann
::
Index
*
createIndex
(
const
Mat
&
dataset
)
const
;
::
cv
flann
::
Index
*
createIndex
(
const
Mat
&
dataset
)
const
;
};
...
...
@@ -146,7 +146,7 @@ struct CV_EXPORTS CompositeIndexParams : public IndexParams {
flann_centers_init_t
centers_init
;
// algorithm used for picking the initial cluster centers for kmeans tree
float
cb_index
;
// cluster boundary index. Used when searching the kmeans tree
::
flann
::
Index
*
createIndex
(
const
Mat
&
dataset
)
const
;
::
cv
flann
::
Index
*
createIndex
(
const
Mat
&
dataset
)
const
;
};
...
...
@@ -163,7 +163,7 @@ struct CV_EXPORTS AutotunedIndexParams : public IndexParams {
float
memory_weight
;
// index memory weighting factor
float
sample_fraction
;
// what fraction of the dataset to use for autotuning
::
flann
::
Index
*
createIndex
(
const
Mat
&
dataset
)
const
;
::
cv
flann
::
Index
*
createIndex
(
const
Mat
&
dataset
)
const
;
};
...
...
@@ -173,7 +173,7 @@ struct CV_EXPORTS SavedIndexParams : public IndexParams {
std
::
string
filename
;
// filename of the stored index
::
flann
::
Index
*
createIndex
(
const
Mat
&
dataset
)
const
;
::
cv
flann
::
Index
*
createIndex
(
const
Mat
&
dataset
)
const
;
};
...
...
@@ -187,7 +187,7 @@ struct CV_EXPORTS SearchParams {
class
CV_EXPORTS
Index
{
::
flann
::
Index
*
nnIndex
;
::
cv
flann
::
Index
*
nnIndex
;
public
:
Index
(
const
Mat
&
features
,
const
IndexParams
&
params
);
...
...
modules/core/src/flann.cpp
View file @
b94e09bf
...
...
@@ -38,72 +38,72 @@
namespace
cv
{
namespace
flann
{
namespace
cv
flann
{
::
flann
::
Index
*
LinearIndexParams
::
createIndex
(
const
Mat
&
dataset
)
const
::
cv
flann
::
Index
*
LinearIndexParams
::
createIndex
(
const
Mat
&
dataset
)
const
{
CV_Assert
(
dataset
.
type
()
==
CV_32F
);
CV_Assert
(
dataset
.
isContinuous
());
// TODO: fix ::flann::Matrix class so it can be constructed with a const float*
::
flann
::
Matrix
<
float
>
mat
(
dataset
.
rows
,
dataset
.
cols
,
(
float
*
)
dataset
.
ptr
<
float
>
(
0
));
// TODO: fix ::
cv
flann::Matrix class so it can be constructed with a const float*
::
cv
flann
::
Matrix
<
float
>
mat
(
dataset
.
rows
,
dataset
.
cols
,
(
float
*
)
dataset
.
ptr
<
float
>
(
0
));
return
new
::
flann
::
Index
(
mat
,
::
flann
::
LinearIndexParams
());
return
new
::
cvflann
::
Index
(
mat
,
::
cv
flann
::
LinearIndexParams
());
}
::
flann
::
Index
*
KDTreeIndexParams
::
createIndex
(
const
Mat
&
dataset
)
const
::
cv
flann
::
Index
*
KDTreeIndexParams
::
createIndex
(
const
Mat
&
dataset
)
const
{
CV_Assert
(
dataset
.
type
()
==
CV_32F
);
CV_Assert
(
dataset
.
isContinuous
());
// TODO: fix ::flann::Matrix class so it can be constructed with a const float*
::
flann
::
Matrix
<
float
>
mat
(
dataset
.
rows
,
dataset
.
cols
,
(
float
*
)
dataset
.
ptr
<
float
>
(
0
));
// TODO: fix ::
cv
flann::Matrix class so it can be constructed with a const float*
::
cv
flann
::
Matrix
<
float
>
mat
(
dataset
.
rows
,
dataset
.
cols
,
(
float
*
)
dataset
.
ptr
<
float
>
(
0
));
return
new
::
flann
::
Index
(
mat
,
::
flann
::
KDTreeIndexParams
(
trees
));
return
new
::
cvflann
::
Index
(
mat
,
::
cv
flann
::
KDTreeIndexParams
(
trees
));
}
::
flann
::
Index
*
KMeansIndexParams
::
createIndex
(
const
Mat
&
dataset
)
const
::
cv
flann
::
Index
*
KMeansIndexParams
::
createIndex
(
const
Mat
&
dataset
)
const
{
CV_Assert
(
dataset
.
type
()
==
CV_32F
);
CV_Assert
(
dataset
.
isContinuous
());
// TODO: fix ::flann::Matrix class so it can be constructed with a const float*
::
flann
::
Matrix
<
float
>
mat
(
dataset
.
rows
,
dataset
.
cols
,
(
float
*
)
dataset
.
ptr
<
float
>
(
0
));
// TODO: fix ::
cv
flann::Matrix class so it can be constructed with a const float*
::
cv
flann
::
Matrix
<
float
>
mat
(
dataset
.
rows
,
dataset
.
cols
,
(
float
*
)
dataset
.
ptr
<
float
>
(
0
));
return
new
::
flann
::
Index
(
mat
,
::
flann
::
KMeansIndexParams
(
branching
,
iterations
,
(
::
flann_centers_init_t
)
centers_init
,
cb_index
));
return
new
::
cvflann
::
Index
(
mat
,
::
cv
flann
::
KMeansIndexParams
(
branching
,
iterations
,
(
::
flann_centers_init_t
)
centers_init
,
cb_index
));
}
::
flann
::
Index
*
CompositeIndexParams
::
createIndex
(
const
Mat
&
dataset
)
const
::
cv
flann
::
Index
*
CompositeIndexParams
::
createIndex
(
const
Mat
&
dataset
)
const
{
CV_Assert
(
dataset
.
type
()
==
CV_32F
);
CV_Assert
(
dataset
.
isContinuous
());
// TODO: fix ::flann::Matrix class so it can be constructed with a const float*
::
flann
::
Matrix
<
float
>
mat
(
dataset
.
rows
,
dataset
.
cols
,
(
float
*
)
dataset
.
ptr
<
float
>
(
0
));
// TODO: fix ::
cv
flann::Matrix class so it can be constructed with a const float*
::
cv
flann
::
Matrix
<
float
>
mat
(
dataset
.
rows
,
dataset
.
cols
,
(
float
*
)
dataset
.
ptr
<
float
>
(
0
));
return
new
::
flann
::
Index
(
mat
,
::
flann
::
CompositeIndexParams
(
trees
,
branching
,
iterations
,
(
::
flann_centers_init_t
)
centers_init
,
cb_index
));
return
new
::
cvflann
::
Index
(
mat
,
::
cv
flann
::
CompositeIndexParams
(
trees
,
branching
,
iterations
,
(
::
flann_centers_init_t
)
centers_init
,
cb_index
));
}
::
flann
::
Index
*
AutotunedIndexParams
::
createIndex
(
const
Mat
&
dataset
)
const
::
cv
flann
::
Index
*
AutotunedIndexParams
::
createIndex
(
const
Mat
&
dataset
)
const
{
CV_Assert
(
dataset
.
type
()
==
CV_32F
);
CV_Assert
(
dataset
.
isContinuous
());
// TODO: fix ::flann::Matrix class so it can be constructed with a const float*
::
flann
::
Matrix
<
float
>
mat
(
dataset
.
rows
,
dataset
.
cols
,
(
float
*
)
dataset
.
ptr
<
float
>
(
0
));
// TODO: fix ::
cv
flann::Matrix class so it can be constructed with a const float*
::
cv
flann
::
Matrix
<
float
>
mat
(
dataset
.
rows
,
dataset
.
cols
,
(
float
*
)
dataset
.
ptr
<
float
>
(
0
));
return
new
::
flann
::
Index
(
mat
,
::
flann
::
AutotunedIndexParams
(
target_precision
,
build_weight
,
memory_weight
,
sample_fraction
));
return
new
::
cvflann
::
Index
(
mat
,
::
cv
flann
::
AutotunedIndexParams
(
target_precision
,
build_weight
,
memory_weight
,
sample_fraction
));
}
::
flann
::
Index
*
SavedIndexParams
::
createIndex
(
const
Mat
&
dataset
)
const
::
cv
flann
::
Index
*
SavedIndexParams
::
createIndex
(
const
Mat
&
dataset
)
const
{
CV_Assert
(
dataset
.
type
()
==
CV_32F
);
CV_Assert
(
dataset
.
isContinuous
());
// TODO: fix ::flann::Matrix class so it can be constructed with a const float*
::
flann
::
Matrix
<
float
>
mat
(
dataset
.
rows
,
dataset
.
cols
,
(
float
*
)
dataset
.
ptr
<
float
>
(
0
));
// TODO: fix ::
cv
flann::Matrix class so it can be constructed with a const float*
::
cv
flann
::
Matrix
<
float
>
mat
(
dataset
.
rows
,
dataset
.
cols
,
(
float
*
)
dataset
.
ptr
<
float
>
(
0
));
return
new
::
flann
::
Index
(
mat
,
::
flann
::
SavedIndexParams
(
filename
));
return
new
::
cvflann
::
Index
(
mat
,
::
cv
flann
::
SavedIndexParams
(
filename
));
}
...
...
@@ -121,11 +121,11 @@ Index::~Index()
void
Index
::
knnSearch
(
const
vector
<
float
>&
query
,
vector
<
int
>&
indices
,
vector
<
float
>&
dists
,
int
knn
,
const
SearchParams
&
searchParams
)
{
::
flann
::
Matrix
<
float
>
m_query
(
1
,
query
.
size
(),
(
float
*
)
&
query
[
0
]);
::
flann
::
Matrix
<
int
>
m_indices
(
1
,
indices
.
size
(),
&
indices
[
0
]);
::
flann
::
Matrix
<
float
>
m_dists
(
1
,
dists
.
size
(),
&
dists
[
0
]);
::
cv
flann
::
Matrix
<
float
>
m_query
(
1
,
query
.
size
(),
(
float
*
)
&
query
[
0
]);
::
cv
flann
::
Matrix
<
int
>
m_indices
(
1
,
indices
.
size
(),
&
indices
[
0
]);
::
cv
flann
::
Matrix
<
float
>
m_dists
(
1
,
dists
.
size
(),
&
dists
[
0
]);
nnIndex
->
knnSearch
(
m_query
,
m_indices
,
m_dists
,
knn
,
::
flann
::
SearchParams
(
searchParams
.
checks
));
nnIndex
->
knnSearch
(
m_query
,
m_indices
,
m_dists
,
knn
,
::
cv
flann
::
SearchParams
(
searchParams
.
checks
));
}
...
...
@@ -134,26 +134,26 @@ void Index::knnSearch(const Mat& queries, Mat& indices, Mat& dists, int knn, con
CV_Assert
(
queries
.
type
()
==
CV_32F
);
CV_Assert
(
queries
.
isContinuous
());
::
flann
::
Matrix
<
float
>
m_queries
(
queries
.
rows
,
queries
.
cols
,
(
float
*
)
queries
.
ptr
<
float
>
(
0
));
::
cv
flann
::
Matrix
<
float
>
m_queries
(
queries
.
rows
,
queries
.
cols
,
(
float
*
)
queries
.
ptr
<
float
>
(
0
));
CV_Assert
(
indices
.
type
()
==
CV_32S
);
CV_Assert
(
indices
.
isContinuous
());
::
flann
::
Matrix
<
int
>
m_indices
(
indices
.
rows
,
indices
.
cols
,
(
int
*
)
indices
.
ptr
<
int
>
(
0
));
::
cv
flann
::
Matrix
<
int
>
m_indices
(
indices
.
rows
,
indices
.
cols
,
(
int
*
)
indices
.
ptr
<
int
>
(
0
));
CV_Assert
(
dists
.
type
()
==
CV_32F
);
CV_Assert
(
dists
.
isContinuous
());
::
flann
::
Matrix
<
float
>
m_dists
(
dists
.
rows
,
dists
.
cols
,
(
float
*
)
dists
.
ptr
<
float
>
(
0
));
::
cv
flann
::
Matrix
<
float
>
m_dists
(
dists
.
rows
,
dists
.
cols
,
(
float
*
)
dists
.
ptr
<
float
>
(
0
));
nnIndex
->
knnSearch
(
m_queries
,
m_indices
,
m_dists
,
knn
,
::
flann
::
SearchParams
(
searchParams
.
checks
));
nnIndex
->
knnSearch
(
m_queries
,
m_indices
,
m_dists
,
knn
,
::
cv
flann
::
SearchParams
(
searchParams
.
checks
));
}
int
Index
::
radiusSearch
(
const
vector
<
float
>&
query
,
vector
<
int
>&
indices
,
vector
<
float
>&
dists
,
float
radius
,
const
SearchParams
&
searchParams
)
{
::
flann
::
Matrix
<
float
>
m_query
(
1
,
query
.
size
(),
(
float
*
)
&
query
[
0
]);
::
flann
::
Matrix
<
int
>
m_indices
(
1
,
indices
.
size
(),
&
indices
[
0
]);
::
flann
::
Matrix
<
float
>
m_dists
(
1
,
dists
.
size
(),
&
dists
[
0
]);
::
cv
flann
::
Matrix
<
float
>
m_query
(
1
,
query
.
size
(),
(
float
*
)
&
query
[
0
]);
::
cv
flann
::
Matrix
<
int
>
m_indices
(
1
,
indices
.
size
(),
&
indices
[
0
]);
::
cv
flann
::
Matrix
<
float
>
m_dists
(
1
,
dists
.
size
(),
&
dists
[
0
]);
return
nnIndex
->
radiusSearch
(
m_query
,
m_indices
,
m_dists
,
radius
,
::
flann
::
SearchParams
(
searchParams
.
checks
));
return
nnIndex
->
radiusSearch
(
m_query
,
m_indices
,
m_dists
,
radius
,
::
cv
flann
::
SearchParams
(
searchParams
.
checks
));
}
...
...
@@ -161,17 +161,17 @@ int Index::radiusSearch(const Mat& query, Mat& indices, Mat& dists, float radius
{
CV_Assert
(
query
.
type
()
==
CV_32F
);
CV_Assert
(
query
.
isContinuous
());
::
flann
::
Matrix
<
float
>
m_query
(
query
.
rows
,
query
.
cols
,
(
float
*
)
query
.
ptr
<
float
>
(
0
));
::
cv
flann
::
Matrix
<
float
>
m_query
(
query
.
rows
,
query
.
cols
,
(
float
*
)
query
.
ptr
<
float
>
(
0
));
CV_Assert
(
indices
.
type
()
==
CV_32S
);
CV_Assert
(
indices
.
isContinuous
());
::
flann
::
Matrix
<
int
>
m_indices
(
indices
.
rows
,
indices
.
cols
,
(
int
*
)
indices
.
ptr
<
int
>
(
0
));
::
cv
flann
::
Matrix
<
int
>
m_indices
(
indices
.
rows
,
indices
.
cols
,
(
int
*
)
indices
.
ptr
<
int
>
(
0
));
CV_Assert
(
dists
.
type
()
==
CV_32F
);
CV_Assert
(
dists
.
isContinuous
());
::
flann
::
Matrix
<
float
>
m_dists
(
dists
.
rows
,
dists
.
cols
,
(
float
*
)
dists
.
ptr
<
float
>
(
0
));
::
cv
flann
::
Matrix
<
float
>
m_dists
(
dists
.
rows
,
dists
.
cols
,
(
float
*
)
dists
.
ptr
<
float
>
(
0
));
return
nnIndex
->
radiusSearch
(
m_query
,
m_indices
,
m_dists
,
radius
,
::
flann
::
SearchParams
(
searchParams
.
checks
));
return
nnIndex
->
radiusSearch
(
m_query
,
m_indices
,
m_dists
,
radius
,
::
cv
flann
::
SearchParams
(
searchParams
.
checks
));
}
...
...
@@ -195,13 +195,13 @@ int hierarchicalClustering(const Mat& features, Mat& centers, const KMeansIndexP
{
CV_Assert
(
features
.
type
()
==
CV_32F
);
CV_Assert
(
features
.
isContinuous
());
::
flann
::
Matrix
<
float
>
m_features
(
features
.
rows
,
features
.
cols
,
(
float
*
)
features
.
ptr
<
float
>
(
0
));
::
cv
flann
::
Matrix
<
float
>
m_features
(
features
.
rows
,
features
.
cols
,
(
float
*
)
features
.
ptr
<
float
>
(
0
));
CV_Assert
(
features
.
type
()
==
CV_32F
);
CV_Assert
(
features
.
isContinuous
());
::
flann
::
Matrix
<
float
>
m_centers
(
centers
.
rows
,
centers
.
cols
,
(
float
*
)
centers
.
ptr
<
float
>
(
0
));
::
cv
flann
::
Matrix
<
float
>
m_centers
(
centers
.
rows
,
centers
.
cols
,
(
float
*
)
centers
.
ptr
<
float
>
(
0
));
return
::
flann
::
hierarchicalClustering
(
m_features
,
m_centers
,
::
flann
::
KMeansIndexParams
(
params
.
branching
,
params
.
iterations
,
return
::
cvflann
::
hierarchicalClustering
(
m_features
,
m_centers
,
::
cv
flann
::
KMeansIndexParams
(
params
.
branching
,
params
.
iterations
,
(
::
flann_centers_init_t
)
params
.
centers_init
,
params
.
cb_index
));
}
...
...
modules/features2d/include/opencv2/features2d/features2d.hpp
View file @
b94e09bf
...
...
@@ -1078,7 +1078,7 @@ protected:
CvMat
*
m_pca_hr_eigenvectors
;
// PCA eigenvectors for large patches
OneWayDescriptor
*
m_pca_descriptors
;
// an array of PCA descriptors
cv
::
flann
::
Index
*
m_pca_descriptors_tree
;
cv
::
cv
flann
::
Index
*
m_pca_descriptors_tree
;
CvMat
*
m_pca_descriptors_matrix
;
CvAffinePose
*
m_poses
;
// array of poses
...
...
modules/features2d/src/oneway.cpp
View file @
b94e09bf
...
...
@@ -149,7 +149,7 @@ namespace cv{
std
::
vector
<
int
>&
desc_idxs
,
std
::
vector
<
int
>&
pose_idxs
,
std
::
vector
<
float
>&
distances
,
CvMat
*
avg
=
0
,
CvMat
*
eigenvalues
=
0
);
void
FindOneWayDescriptor
(
cv
::
flann
::
Index
*
m_pca_descriptors_tree
,
CvSize
patch_size
,
int
m_pca_dim_low
,
int
m_pose_count
,
IplImage
*
patch
,
int
&
desc_idx
,
int
&
pose_idx
,
float
&
distance
,
void
FindOneWayDescriptor
(
cv
::
cv
flann
::
Index
*
m_pca_descriptors_tree
,
CvSize
patch_size
,
int
m_pca_dim_low
,
int
m_pose_count
,
IplImage
*
patch
,
int
&
desc_idx
,
int
&
pose_idx
,
float
&
distance
,
CvMat
*
avg
=
0
,
CvMat
*
eigenvalues
=
0
);
void
FindOneWayDescriptorEx
(
int
desc_count
,
const
OneWayDescriptor
*
descriptors
,
IplImage
*
patch
,
...
...
@@ -163,7 +163,7 @@ namespace cv{
std
::
vector
<
float
>&
distances
,
std
::
vector
<
float
>&
scales
,
CvMat
*
avg
,
CvMat
*
eigenvectors
);
void
FindOneWayDescriptorEx
(
cv
::
flann
::
Index
*
m_pca_descriptors_tree
,
CvSize
patch_size
,
int
m_pca_dim_low
,
int
m_pose_count
,
IplImage
*
patch
,
void
FindOneWayDescriptorEx
(
cv
::
cv
flann
::
Index
*
m_pca_descriptors_tree
,
CvSize
patch_size
,
int
m_pca_dim_low
,
int
m_pose_count
,
IplImage
*
patch
,
float
scale_min
,
float
scale_max
,
float
scale_step
,
int
&
desc_idx
,
int
&
pose_idx
,
float
&
distance
,
float
&
scale
,
CvMat
*
avg
,
CvMat
*
eigenvectors
);
...
...
@@ -800,7 +800,7 @@ namespace cv{
#if defined(_KDTREE)
void
FindOneWayDescriptor
(
cv
::
flann
::
Index
*
m_pca_descriptors_tree
,
CvSize
patch_size
,
int
m_pca_dim_low
,
int
m_pose_count
,
IplImage
*
patch
,
int
&
desc_idx
,
int
&
pose_idx
,
float
&
distance
,
void
FindOneWayDescriptor
(
cv
::
cv
flann
::
Index
*
m_pca_descriptors_tree
,
CvSize
patch_size
,
int
m_pca_dim_low
,
int
m_pose_count
,
IplImage
*
patch
,
int
&
desc_idx
,
int
&
pose_idx
,
float
&
distance
,
CvMat
*
avg
,
CvMat
*
eigenvectors
)
{
desc_idx
=
-
1
;
...
...
@@ -848,8 +848,8 @@ namespace cv{
//--------
//float* target = new float[m_pca_dim_low];
//::flann::KNNResultSet res(1,pca_coeffs->data.fl,m_pca_dim_low);
//::flann::SearchParams params;
//::
cv
flann::KNNResultSet res(1,pca_coeffs->data.fl,m_pca_dim_low);
//::
cv
flann::SearchParams params;
//params.checks = -1;
//int maxDepth = 1000000;
...
...
@@ -875,7 +875,7 @@ namespace cv{
object_ptr
[
i
]
=
pca_coeffs
->
data
.
fl
[
i
];
}
m_pca_descriptors_tree
->
knnSearch
(
m_object
,
m_indices
,
m_dists
,
1
,
cv
::
flann
::
SearchParams
(
-
1
)
);
m_pca_descriptors_tree
->
knnSearch
(
m_object
,
m_indices
,
m_dists
,
1
,
cv
::
cv
flann
::
SearchParams
(
-
1
)
);
desc_idx
=
((
int
*
)(
m_indices
.
ptr
<
int
>
(
0
)))[
0
]
/
m_pose_count
;
pose_idx
=
((
int
*
)(
m_indices
.
ptr
<
int
>
(
0
)))[
0
]
%
m_pose_count
;
...
...
@@ -1109,7 +1109,7 @@ namespace cv{
}
#if defined(_KDTREE)
void
FindOneWayDescriptorEx
(
cv
::
flann
::
Index
*
m_pca_descriptors_tree
,
CvSize
patch_size
,
int
m_pca_dim_low
,
void
FindOneWayDescriptorEx
(
cv
::
cv
flann
::
Index
*
m_pca_descriptors_tree
,
CvSize
patch_size
,
int
m_pca_dim_low
,
int
m_pose_count
,
IplImage
*
patch
,
float
scale_min
,
float
scale_max
,
float
scale_step
,
int
&
desc_idx
,
int
&
pose_idx
,
float
&
distance
,
float
&
scale
,
...
...
@@ -1633,13 +1633,13 @@ namespace cv{
int
pca_dim_low
=
this
->
GetDescriptor
(
0
)
->
GetPCADimLow
();
//if (!m_pca_descriptors_matrix)
// m_pca_descriptors_matrix = new ::flann::Matrix<float>(n*m_pose_count,pca_dim_low);
// m_pca_descriptors_matrix = new ::
cv
flann::Matrix<float>(n*m_pose_count,pca_dim_low);
//else
//{
// if ((m_pca_descriptors_matrix->cols != pca_dim_low)&&(m_pca_descriptors_matrix->rows != n*m_pose_count))
// {
// delete m_pca_descriptors_matrix;
// m_pca_descriptors_matrix = new ::flann::Matrix<float>(n*m_pose_count,pca_dim_low);
// m_pca_descriptors_matrix = new ::
cv
flann::Matrix<float>(n*m_pose_count,pca_dim_low);
// }
//}
...
...
@@ -1657,10 +1657,10 @@ namespace cv{
}
cv
::
Mat
pca_descriptors_mat
(
m_pca_descriptors_matrix
,
false
);
//::flann::KDTreeIndexParams params;
//::
cv
flann::KDTreeIndexParams params;
//params.trees = 1;
//m_pca_descriptors_tree = new KDTree(pca_descriptors_mat);
m_pca_descriptors_tree
=
new
cv
::
flann
::
Index
(
pca_descriptors_mat
,
cv
::
flann
::
KDTreeIndexParams
(
1
));
m_pca_descriptors_tree
=
new
cv
::
cvflann
::
Index
(
pca_descriptors_mat
,
cv
::
cv
flann
::
KDTreeIndexParams
(
1
));
//cvReleaseMat(&m_pca_descriptors_matrix);
//m_pca_descriptors_tree->buildIndex();
}
...
...
samples/c/find_obj.cpp
View file @
b94e09bf
...
...
@@ -138,8 +138,8 @@ flannFindPairs( const CvSeq*, const CvSeq* objectDescriptors,
// find nearest neighbors using FLANN
cv
::
Mat
m_indices
(
objectDescriptors
->
total
,
2
,
CV_32S
);
cv
::
Mat
m_dists
(
objectDescriptors
->
total
,
2
,
CV_32F
);
cv
::
flann
::
Index
flann_index
(
m_image
,
cv
::
flann
::
KDTreeIndexParams
(
4
));
// using 4 randomized kdtrees
flann_index
.
knnSearch
(
m_object
,
m_indices
,
m_dists
,
2
,
cv
::
flann
::
SearchParams
(
64
)
);
// maximum number of leafs checked
cv
::
cvflann
::
Index
flann_index
(
m_image
,
cv
::
cv
flann
::
KDTreeIndexParams
(
4
));
// using 4 randomized kdtrees
flann_index
.
knnSearch
(
m_object
,
m_indices
,
m_dists
,
2
,
cv
::
cv
flann
::
SearchParams
(
64
)
);
// maximum number of leafs checked
int
*
indices_ptr
=
m_indices
.
ptr
<
int
>
(
0
);
float
*
dists_ptr
=
m_dists
.
ptr
<
float
>
(
0
);
...
...
tests/cv/src/anearestneighbors.cpp
View file @
b94e09bf
...
...
@@ -47,7 +47,7 @@
#include <iostream>
using
namespace
cv
;
using
namespace
cv
::
flann
;
using
namespace
cv
::
cv
flann
;
//--------------------------------------------------------------------------------
class
NearestNeighborTest
:
public
CvTest
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment