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
49f6dad1
Commit
49f6dad1
authored
Mar 26, 2013
by
Andrey Kamaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move cv::KeyPoint and cv::DMatch to core
parent
8eff34ee
Hide whitespace changes
Inline
Side-by-side
Showing
37 changed files
with
309 additions
and
250 deletions
+309
-250
CMakeLists.txt
modules/contrib/CMakeLists.txt
+1
-1
core.hpp
modules/core/include/opencv2/core.hpp
+90
-0
operations.hpp
modules/core/include/opencv2/core/operations.hpp
+3
-0
persistence.cpp
modules/core/src/persistence.cpp
+31
-0
types.cpp
modules/core/src/types.cpp
+140
-0
features2d.hpp
modules/features2d/include/opencv2/features2d.hpp
+4
-85
keypoint.cpp
modules/features2d/src/keypoint.cpp
+0
-123
flann.hpp
modules/flann/include/opencv2/flann.hpp
+1
-1
OpenCVTestCase.java
...java/android_test/src/org/opencv/test/OpenCVTestCase.java
+2
-2
DMatchTest.java
...ava/android_test/src/org/opencv/test/core/DMatchTest.java
+2
-2
KeyPointTest.java
...a/android_test/src/org/opencv/test/core/KeyPointTest.java
+2
-2
BRIEFDescriptorExtractorTest.java
.../opencv/test/features2d/BRIEFDescriptorExtractorTest.java
+1
-1
BruteForceDescriptorMatcherTest.java
...encv/test/features2d/BruteForceDescriptorMatcherTest.java
+2
-2
BruteForceHammingDescriptorMatcherTest.java
...st/features2d/BruteForceHammingDescriptorMatcherTest.java
+1
-1
BruteForceHammingLUTDescriptorMatcherTest.java
...features2d/BruteForceHammingLUTDescriptorMatcherTest.java
+1
-1
BruteForceL1DescriptorMatcherTest.java
...cv/test/features2d/BruteForceL1DescriptorMatcherTest.java
+2
-2
BruteForceSL2DescriptorMatcherTest.java
...v/test/features2d/BruteForceSL2DescriptorMatcherTest.java
+2
-2
FASTFeatureDetectorTest.java
...c/org/opencv/test/features2d/FASTFeatureDetectorTest.java
+1
-1
Features2dTest.java
...d_test/src/org/opencv/test/features2d/Features2dTest.java
+2
-2
FlannBasedDescriptorMatcherTest.java
...encv/test/features2d/FlannBasedDescriptorMatcherTest.java
+2
-2
ORBDescriptorExtractorTest.java
...rg/opencv/test/features2d/ORBDescriptorExtractorTest.java
+1
-1
SIFTDescriptorExtractorTest.java
...g/opencv/test/features2d/SIFTDescriptorExtractorTest.java
+1
-1
STARFeatureDetectorTest.java
...c/org/opencv/test/features2d/STARFeatureDetectorTest.java
+1
-1
SURFDescriptorExtractorTest.java
...g/opencv/test/features2d/SURFDescriptorExtractorTest.java
+1
-1
SURFFeatureDetectorTest.java
...c/org/opencv/test/features2d/SURFFeatureDetectorTest.java
+1
-1
ConvertersTest.java
...ndroid_test/src/org/opencv/test/utils/ConvertersTest.java
+2
-2
gen_java.py
modules/java/generator/gen_java.py
+1
-1
core+DMatch.java
modules/java/generator/src/java/core+DMatch.java
+1
-1
core+KeyPoint.java
modules/java/generator/src/java/core+KeyPoint.java
+1
-1
core+MatOfDMatch.java
modules/java/generator/src/java/core+MatOfDMatch.java
+1
-1
core+MatOfKeyPoint.java
modules/java/generator/src/java/core+MatOfKeyPoint.java
+1
-1
utils+Converters.java
modules/java/generator/src/java/utils+Converters.java
+2
-2
OpenCVTestCase.java
modules/java/test/src/org/opencv/test/OpenCVTestCase.java
+2
-2
CMakeLists.txt
modules/ocl/CMakeLists.txt
+1
-1
ocl.hpp
modules/ocl/include/opencv2/ocl.hpp
+1
-1
CMakeLists.txt
modules/ts/CMakeLists.txt
+1
-1
ts_perf.hpp
modules/ts/include/opencv2/ts/ts_perf.hpp
+0
-1
No files found.
modules/contrib/CMakeLists.txt
View file @
49f6dad1
ocv_define_module
(
contrib opencv_imgproc opencv_calib3d opencv_
features2d opencv_
ml opencv_video opencv_objdetect OPTIONAL opencv_highgui
)
ocv_define_module
(
contrib opencv_imgproc opencv_calib3d opencv_ml opencv_video opencv_objdetect OPTIONAL opencv_highgui
)
modules/core/include/opencv2/core.hpp
View file @
49f6dad1
...
...
@@ -826,6 +826,96 @@ public:
int
start
,
end
;
};
/////////////////////////////// KeyPoint ////////////////////////////////
/*!
The Keypoint Class
The class instance stores a keypoint, i.e. a point feature found by one of many available keypoint detectors, such as
Harris corner detector, cv::FAST, cv::StarDetector, cv::SURF, cv::SIFT, cv::LDetector etc.
The keypoint is characterized by the 2D position, scale
(proportional to the diameter of the neighborhood that needs to be taken into account),
orientation and some other parameters. The keypoint neighborhood is then analyzed by another algorithm that builds a descriptor
(usually represented as a feature vector). The keypoints representing the same object in different images can then be matched using
cv::KDTree or another method.
*/
class
CV_EXPORTS_W_SIMPLE
KeyPoint
{
public
:
//! the default constructor
CV_WRAP
KeyPoint
();
//! the full constructor
KeyPoint
(
Point2f
_pt
,
float
_size
,
float
_angle
=-
1
,
float
_response
=
0
,
int
_octave
=
0
,
int
_class_id
=-
1
);
//! another form of the full constructor
CV_WRAP
KeyPoint
(
float
x
,
float
y
,
float
_size
,
float
_angle
=-
1
,
float
_response
=
0
,
int
_octave
=
0
,
int
_class_id
=-
1
);
size_t
hash
()
const
;
//! converts vector of keypoints to vector of points
static
void
convert
(
const
std
::
vector
<
KeyPoint
>&
keypoints
,
CV_OUT
std
::
vector
<
Point2f
>&
points2f
,
const
std
::
vector
<
int
>&
keypointIndexes
=
std
::
vector
<
int
>
());
//! converts vector of points to the vector of keypoints, where each keypoint is assigned the same size and the same orientation
static
void
convert
(
const
std
::
vector
<
Point2f
>&
points2f
,
CV_OUT
std
::
vector
<
KeyPoint
>&
keypoints
,
float
size
=
1
,
float
response
=
1
,
int
octave
=
0
,
int
class_id
=-
1
);
//! computes overlap for pair of keypoints;
//! overlap is a ratio between area of keypoint regions intersection and
//! area of keypoint regions union (now keypoint region is circle)
static
float
overlap
(
const
KeyPoint
&
kp1
,
const
KeyPoint
&
kp2
);
CV_PROP_RW
Point2f
pt
;
//!< coordinates of the keypoints
CV_PROP_RW
float
size
;
//!< diameter of the meaningful keypoint neighborhood
CV_PROP_RW
float
angle
;
//!< computed orientation of the keypoint (-1 if not applicable);
//!< it's in [0,360) degrees and measured relative to
//!< image coordinate system, ie in clockwise.
CV_PROP_RW
float
response
;
//!< the response by which the most strong keypoints have been selected. Can be used for the further sorting or subsampling
CV_PROP_RW
int
octave
;
//!< octave (pyramid layer) from which the keypoint has been extracted
CV_PROP_RW
int
class_id
;
//!< object class (if the keypoints need to be clustered by an object they belong to)
};
inline
KeyPoint
::
KeyPoint
()
:
pt
(
0
,
0
),
size
(
0
),
angle
(
-
1
),
response
(
0
),
octave
(
0
),
class_id
(
-
1
)
{}
inline
KeyPoint
::
KeyPoint
(
Point2f
_pt
,
float
_size
,
float
_angle
,
float
_response
,
int
_octave
,
int
_class_id
)
:
pt
(
_pt
),
size
(
_size
),
angle
(
_angle
),
response
(
_response
),
octave
(
_octave
),
class_id
(
_class_id
)
{}
inline
KeyPoint
::
KeyPoint
(
float
x
,
float
y
,
float
_size
,
float
_angle
,
float
_response
,
int
_octave
,
int
_class_id
)
:
pt
(
x
,
y
),
size
(
_size
),
angle
(
_angle
),
response
(
_response
),
octave
(
_octave
),
class_id
(
_class_id
)
{}
//////////////////////////////// DMatch /////////////////////////////////
/*
* Struct for matching: query descriptor index, train descriptor index, train image index and distance between descriptors.
*/
struct
CV_EXPORTS_W_SIMPLE
DMatch
{
CV_WRAP
DMatch
();
CV_WRAP
DMatch
(
int
_queryIdx
,
int
_trainIdx
,
float
_distance
);
CV_WRAP
DMatch
(
int
_queryIdx
,
int
_trainIdx
,
int
_imgIdx
,
float
_distance
);
CV_PROP_RW
int
queryIdx
;
// query descriptor index
CV_PROP_RW
int
trainIdx
;
// train descriptor index
CV_PROP_RW
int
imgIdx
;
// train image index
CV_PROP_RW
float
distance
;
// less is better
bool
operator
<
(
const
DMatch
&
m
)
const
;
};
inline
DMatch
::
DMatch
()
:
queryIdx
(
-
1
),
trainIdx
(
-
1
),
imgIdx
(
-
1
),
distance
(
FLT_MAX
)
{}
inline
DMatch
::
DMatch
(
int
_queryIdx
,
int
_trainIdx
,
float
_distance
)
:
queryIdx
(
_queryIdx
),
trainIdx
(
_trainIdx
),
imgIdx
(
-
1
),
distance
(
_distance
)
{}
inline
DMatch
::
DMatch
(
int
_queryIdx
,
int
_trainIdx
,
int
_imgIdx
,
float
_distance
)
:
queryIdx
(
_queryIdx
),
trainIdx
(
_trainIdx
),
imgIdx
(
_imgIdx
),
distance
(
_distance
)
{}
inline
bool
DMatch
::
operator
<
(
const
DMatch
&
m
)
const
{
return
distance
<
m
.
distance
;
}
/////////////////////////////// DataType ////////////////////////////////
/*!
...
...
modules/core/include/opencv2/core/operations.hpp
View file @
49f6dad1
...
...
@@ -2947,6 +2947,9 @@ static inline void read(const FileNode& node, String& value, const String& defau
CV_EXPORTS_W
void
read
(
const
FileNode
&
node
,
Mat
&
mat
,
const
Mat
&
default_mat
=
Mat
()
);
CV_EXPORTS
void
read
(
const
FileNode
&
node
,
SparseMat
&
mat
,
const
SparseMat
&
default_mat
=
SparseMat
()
);
CV_EXPORTS
void
read
(
const
FileNode
&
node
,
std
::
vector
<
KeyPoint
>&
keypoints
);
CV_EXPORTS
void
write
(
FileStorage
&
fs
,
const
String
&
objname
,
const
std
::
vector
<
KeyPoint
>&
keypoints
);
inline
FileNode
::
operator
int
()
const
{
int
value
;
...
...
modules/core/src/persistence.cpp
View file @
49f6dad1
...
...
@@ -5522,6 +5522,37 @@ void read( const FileNode& node, SparseMat& mat, const SparseMat& default_mat )
SparseMat
(
m
).
copyTo
(
mat
);
}
void
write
(
FileStorage
&
fs
,
const
String
&
objname
,
const
std
::
vector
<
KeyPoint
>&
keypoints
)
{
WriteStructContext
ws
(
fs
,
objname
,
CV_NODE_SEQ
+
CV_NODE_FLOW
);
int
i
,
npoints
=
(
int
)
keypoints
.
size
();
for
(
i
=
0
;
i
<
npoints
;
i
++
)
{
const
KeyPoint
&
kpt
=
keypoints
[
i
];
cv
::
write
(
fs
,
kpt
.
pt
.
x
);
cv
::
write
(
fs
,
kpt
.
pt
.
y
);
cv
::
write
(
fs
,
kpt
.
size
);
cv
::
write
(
fs
,
kpt
.
angle
);
cv
::
write
(
fs
,
kpt
.
response
);
cv
::
write
(
fs
,
kpt
.
octave
);
cv
::
write
(
fs
,
kpt
.
class_id
);
}
}
void
read
(
const
FileNode
&
node
,
std
::
vector
<
KeyPoint
>&
keypoints
)
{
keypoints
.
resize
(
0
);
FileNodeIterator
it
=
node
.
begin
(),
it_end
=
node
.
end
();
for
(
;
it
!=
it_end
;
)
{
KeyPoint
kpt
;
it
>>
kpt
.
pt
.
x
>>
kpt
.
pt
.
y
>>
kpt
.
size
>>
kpt
.
angle
>>
kpt
.
response
>>
kpt
.
octave
>>
kpt
.
class_id
;
keypoints
.
push_back
(
kpt
);
}
}
}
/* End of file. */
modules/core/src/types.cpp
0 → 100644
View file @
49f6dad1
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#include "precomp.hpp"
namespace
cv
{
size_t
KeyPoint
::
hash
()
const
{
size_t
_Val
=
2166136261U
,
scale
=
16777619U
;
Cv32suf
u
;
u
.
f
=
pt
.
x
;
_Val
=
(
scale
*
_Val
)
^
u
.
u
;
u
.
f
=
pt
.
y
;
_Val
=
(
scale
*
_Val
)
^
u
.
u
;
u
.
f
=
size
;
_Val
=
(
scale
*
_Val
)
^
u
.
u
;
u
.
f
=
angle
;
_Val
=
(
scale
*
_Val
)
^
u
.
u
;
u
.
f
=
response
;
_Val
=
(
scale
*
_Val
)
^
u
.
u
;
_Val
=
(
scale
*
_Val
)
^
((
size_t
)
octave
);
_Val
=
(
scale
*
_Val
)
^
((
size_t
)
class_id
);
return
_Val
;
}
void
KeyPoint
::
convert
(
const
std
::
vector
<
KeyPoint
>&
keypoints
,
std
::
vector
<
Point2f
>&
points2f
,
const
std
::
vector
<
int
>&
keypointIndexes
)
{
if
(
keypointIndexes
.
empty
()
)
{
points2f
.
resize
(
keypoints
.
size
()
);
for
(
size_t
i
=
0
;
i
<
keypoints
.
size
();
i
++
)
points2f
[
i
]
=
keypoints
[
i
].
pt
;
}
else
{
points2f
.
resize
(
keypointIndexes
.
size
()
);
for
(
size_t
i
=
0
;
i
<
keypointIndexes
.
size
();
i
++
)
{
int
idx
=
keypointIndexes
[
i
];
if
(
idx
>=
0
)
points2f
[
i
]
=
keypoints
[
idx
].
pt
;
else
{
CV_Error
(
CV_StsBadArg
,
"keypointIndexes has element < 0. TODO: process this case"
);
//points2f[i] = Point2f(-1, -1);
}
}
}
}
void
KeyPoint
::
convert
(
const
std
::
vector
<
Point2f
>&
points2f
,
std
::
vector
<
KeyPoint
>&
keypoints
,
float
size
,
float
response
,
int
octave
,
int
class_id
)
{
keypoints
.
resize
(
points2f
.
size
());
for
(
size_t
i
=
0
;
i
<
points2f
.
size
();
i
++
)
keypoints
[
i
]
=
KeyPoint
(
points2f
[
i
],
size
,
-
1
,
response
,
octave
,
class_id
);
}
float
KeyPoint
::
overlap
(
const
KeyPoint
&
kp1
,
const
KeyPoint
&
kp2
)
{
float
a
=
kp1
.
size
*
0.5
f
;
float
b
=
kp2
.
size
*
0.5
f
;
float
a_2
=
a
*
a
;
float
b_2
=
b
*
b
;
Point2f
p1
=
kp1
.
pt
;
Point2f
p2
=
kp2
.
pt
;
float
c
=
(
float
)
norm
(
p1
-
p2
);
float
ovrl
=
0.
f
;
// one circle is completely encovered by the other => no intersection points!
if
(
std
::
min
(
a
,
b
)
+
c
<=
std
::
max
(
a
,
b
)
)
return
std
::
min
(
a_2
,
b_2
)
/
std
::
max
(
a_2
,
b_2
);
if
(
c
<
a
+
b
)
// circles intersect
{
float
c_2
=
c
*
c
;
float
cosAlpha
=
(
b_2
+
c_2
-
a_2
)
/
(
kp2
.
size
*
c
);
float
cosBeta
=
(
a_2
+
c_2
-
b_2
)
/
(
kp1
.
size
*
c
);
float
alpha
=
acos
(
cosAlpha
);
float
beta
=
acos
(
cosBeta
);
float
sinAlpha
=
sin
(
alpha
);
float
sinBeta
=
sin
(
beta
);
float
segmentAreaA
=
a_2
*
beta
;
float
segmentAreaB
=
b_2
*
alpha
;
float
triangleAreaA
=
a_2
*
sinBeta
*
cosBeta
;
float
triangleAreaB
=
b_2
*
sinAlpha
*
cosAlpha
;
float
intersectionArea
=
segmentAreaA
+
segmentAreaB
-
triangleAreaA
-
triangleAreaB
;
float
unionArea
=
(
a_2
+
b_2
)
*
(
float
)
CV_PI
-
intersectionArea
;
ovrl
=
intersectionArea
/
unionArea
;
}
return
ovrl
;
}
}
// cv
\ No newline at end of file
modules/features2d/include/opencv2/features2d.hpp
View file @
49f6dad1
...
...
@@ -54,64 +54,10 @@ namespace cv
CV_EXPORTS
bool
initModule_features2d
();
/*!
The Keypoint Class
The class instance stores a keypoint, i.e. a point feature found by one of many available keypoint detectors, such as
Harris corner detector, cv::FAST, cv::StarDetector, cv::SURF, cv::SIFT, cv::LDetector etc.
The keypoint is characterized by the 2D position, scale
(proportional to the diameter of the neighborhood that needs to be taken into account),
orientation and some other parameters. The keypoint neighborhood is then analyzed by another algorithm that builds a descriptor
(usually represented as a feature vector). The keypoints representing the same object in different images can then be matched using
cv::KDTree or another method.
*/
class
CV_EXPORTS_W_SIMPLE
KeyPoint
{
public
:
//! the default constructor
CV_WRAP
KeyPoint
()
:
pt
(
0
,
0
),
size
(
0
),
angle
(
-
1
),
response
(
0
),
octave
(
0
),
class_id
(
-
1
)
{}
//! the full constructor
KeyPoint
(
Point2f
_pt
,
float
_size
,
float
_angle
=-
1
,
float
_response
=
0
,
int
_octave
=
0
,
int
_class_id
=-
1
)
:
pt
(
_pt
),
size
(
_size
),
angle
(
_angle
),
response
(
_response
),
octave
(
_octave
),
class_id
(
_class_id
)
{}
//! another form of the full constructor
CV_WRAP
KeyPoint
(
float
x
,
float
y
,
float
_size
,
float
_angle
=-
1
,
float
_response
=
0
,
int
_octave
=
0
,
int
_class_id
=-
1
)
:
pt
(
x
,
y
),
size
(
_size
),
angle
(
_angle
),
response
(
_response
),
octave
(
_octave
),
class_id
(
_class_id
)
{}
size_t
hash
()
const
;
//! converts vector of keypoints to vector of points
static
void
convert
(
const
std
::
vector
<
KeyPoint
>&
keypoints
,
CV_OUT
std
::
vector
<
Point2f
>&
points2f
,
const
std
::
vector
<
int
>&
keypointIndexes
=
std
::
vector
<
int
>
());
//! converts vector of points to the vector of keypoints, where each keypoint is assigned the same size and the same orientation
static
void
convert
(
const
std
::
vector
<
Point2f
>&
points2f
,
CV_OUT
std
::
vector
<
KeyPoint
>&
keypoints
,
float
size
=
1
,
float
response
=
1
,
int
octave
=
0
,
int
class_id
=-
1
);
//! computes overlap for pair of keypoints;
//! overlap is a ratio between area of keypoint regions intersection and
//! area of keypoint regions union (now keypoint region is circle)
static
float
overlap
(
const
KeyPoint
&
kp1
,
const
KeyPoint
&
kp2
);
CV_PROP_RW
Point2f
pt
;
//!< coordinates of the keypoints
CV_PROP_RW
float
size
;
//!< diameter of the meaningful keypoint neighborhood
CV_PROP_RW
float
angle
;
//!< computed orientation of the keypoint (-1 if not applicable);
//!< it's in [0,360) degrees and measured relative to
//!< image coordinate system, ie in clockwise.
CV_PROP_RW
float
response
;
//!< the response by which the most strong keypoints have been selected. Can be used for the further sorting or subsampling
CV_PROP_RW
int
octave
;
//!< octave (pyramid layer) from which the keypoint has been extracted
CV_PROP_RW
int
class_id
;
//!< object class (if the keypoints need to be clustered by an object they belong to)
};
//! writes vector of keypoints to the file storage
CV_EXPORTS
void
write
(
FileStorage
&
fs
,
const
String
&
name
,
const
std
::
vector
<
KeyPoint
>&
keypoints
);
//! reads vector of keypoints from the specified file storage node
CV_EXPORTS
void
read
(
const
FileNode
&
node
,
CV_OUT
std
::
vector
<
KeyPoint
>&
keypoints
);
// //! writes vector of keypoints to the file storage
// CV_EXPORTS void write(FileStorage& fs, const String& name, const std::vector<KeyPoint>& keypoints);
// //! reads vector of keypoints from the specified file storage node
// CV_EXPORTS void read(const FileNode& node, CV_OUT std::vector<KeyPoint>& keypoints);
/*
* A class filters a vector of keypoints.
...
...
@@ -1028,33 +974,6 @@ template<int cellsize> struct CV_EXPORTS HammingMultilevel
}
};
/****************************************************************************************\
* DMatch *
\****************************************************************************************/
/*
* Struct for matching: query descriptor index, train descriptor index, train image index and distance between descriptors.
*/
struct
CV_EXPORTS_W_SIMPLE
DMatch
{
CV_WRAP
DMatch
()
:
queryIdx
(
-
1
),
trainIdx
(
-
1
),
imgIdx
(
-
1
),
distance
(
FLT_MAX
)
{}
CV_WRAP
DMatch
(
int
_queryIdx
,
int
_trainIdx
,
float
_distance
)
:
queryIdx
(
_queryIdx
),
trainIdx
(
_trainIdx
),
imgIdx
(
-
1
),
distance
(
_distance
)
{}
CV_WRAP
DMatch
(
int
_queryIdx
,
int
_trainIdx
,
int
_imgIdx
,
float
_distance
)
:
queryIdx
(
_queryIdx
),
trainIdx
(
_trainIdx
),
imgIdx
(
_imgIdx
),
distance
(
_distance
)
{}
CV_PROP_RW
int
queryIdx
;
// query descriptor index
CV_PROP_RW
int
trainIdx
;
// train descriptor index
CV_PROP_RW
int
imgIdx
;
// train image index
CV_PROP_RW
float
distance
;
// less is better
bool
operator
<
(
const
DMatch
&
m
)
const
{
return
distance
<
m
.
distance
;
}
};
/****************************************************************************************\
* DescriptorMatcher *
\****************************************************************************************/
...
...
modules/features2d/src/keypoint.cpp
View file @
49f6dad1
...
...
@@ -44,129 +44,6 @@
namespace
cv
{
size_t
KeyPoint
::
hash
()
const
{
size_t
_Val
=
2166136261U
,
scale
=
16777619U
;
Cv32suf
u
;
u
.
f
=
pt
.
x
;
_Val
=
(
scale
*
_Val
)
^
u
.
u
;
u
.
f
=
pt
.
y
;
_Val
=
(
scale
*
_Val
)
^
u
.
u
;
u
.
f
=
size
;
_Val
=
(
scale
*
_Val
)
^
u
.
u
;
u
.
f
=
angle
;
_Val
=
(
scale
*
_Val
)
^
u
.
u
;
u
.
f
=
response
;
_Val
=
(
scale
*
_Val
)
^
u
.
u
;
_Val
=
(
scale
*
_Val
)
^
((
size_t
)
octave
);
_Val
=
(
scale
*
_Val
)
^
((
size_t
)
class_id
);
return
_Val
;
}
void
write
(
FileStorage
&
fs
,
const
String
&
objname
,
const
std
::
vector
<
KeyPoint
>&
keypoints
)
{
WriteStructContext
ws
(
fs
,
objname
,
CV_NODE_SEQ
+
CV_NODE_FLOW
);
int
i
,
npoints
=
(
int
)
keypoints
.
size
();
for
(
i
=
0
;
i
<
npoints
;
i
++
)
{
const
KeyPoint
&
kpt
=
keypoints
[
i
];
write
(
fs
,
kpt
.
pt
.
x
);
write
(
fs
,
kpt
.
pt
.
y
);
write
(
fs
,
kpt
.
size
);
write
(
fs
,
kpt
.
angle
);
write
(
fs
,
kpt
.
response
);
write
(
fs
,
kpt
.
octave
);
write
(
fs
,
kpt
.
class_id
);
}
}
void
read
(
const
FileNode
&
node
,
std
::
vector
<
KeyPoint
>&
keypoints
)
{
keypoints
.
resize
(
0
);
FileNodeIterator
it
=
node
.
begin
(),
it_end
=
node
.
end
();
for
(
;
it
!=
it_end
;
)
{
KeyPoint
kpt
;
it
>>
kpt
.
pt
.
x
>>
kpt
.
pt
.
y
>>
kpt
.
size
>>
kpt
.
angle
>>
kpt
.
response
>>
kpt
.
octave
>>
kpt
.
class_id
;
keypoints
.
push_back
(
kpt
);
}
}
void
KeyPoint
::
convert
(
const
std
::
vector
<
KeyPoint
>&
keypoints
,
std
::
vector
<
Point2f
>&
points2f
,
const
std
::
vector
<
int
>&
keypointIndexes
)
{
if
(
keypointIndexes
.
empty
()
)
{
points2f
.
resize
(
keypoints
.
size
()
);
for
(
size_t
i
=
0
;
i
<
keypoints
.
size
();
i
++
)
points2f
[
i
]
=
keypoints
[
i
].
pt
;
}
else
{
points2f
.
resize
(
keypointIndexes
.
size
()
);
for
(
size_t
i
=
0
;
i
<
keypointIndexes
.
size
();
i
++
)
{
int
idx
=
keypointIndexes
[
i
];
if
(
idx
>=
0
)
points2f
[
i
]
=
keypoints
[
idx
].
pt
;
else
{
CV_Error
(
CV_StsBadArg
,
"keypointIndexes has element < 0. TODO: process this case"
);
//points2f[i] = Point2f(-1, -1);
}
}
}
}
void
KeyPoint
::
convert
(
const
std
::
vector
<
Point2f
>&
points2f
,
std
::
vector
<
KeyPoint
>&
keypoints
,
float
size
,
float
response
,
int
octave
,
int
class_id
)
{
keypoints
.
resize
(
points2f
.
size
());
for
(
size_t
i
=
0
;
i
<
points2f
.
size
();
i
++
)
keypoints
[
i
]
=
KeyPoint
(
points2f
[
i
],
size
,
-
1
,
response
,
octave
,
class_id
);
}
float
KeyPoint
::
overlap
(
const
KeyPoint
&
kp1
,
const
KeyPoint
&
kp2
)
{
float
a
=
kp1
.
size
*
0.5
f
;
float
b
=
kp2
.
size
*
0.5
f
;
float
a_2
=
a
*
a
;
float
b_2
=
b
*
b
;
Point2f
p1
=
kp1
.
pt
;
Point2f
p2
=
kp2
.
pt
;
float
c
=
(
float
)
norm
(
p1
-
p2
);
float
ovrl
=
0.
f
;
// one circle is completely encovered by the other => no intersection points!
if
(
std
::
min
(
a
,
b
)
+
c
<=
std
::
max
(
a
,
b
)
)
return
std
::
min
(
a_2
,
b_2
)
/
std
::
max
(
a_2
,
b_2
);
if
(
c
<
a
+
b
)
// circles intersect
{
float
c_2
=
c
*
c
;
float
cosAlpha
=
(
b_2
+
c_2
-
a_2
)
/
(
kp2
.
size
*
c
);
float
cosBeta
=
(
a_2
+
c_2
-
b_2
)
/
(
kp1
.
size
*
c
);
float
alpha
=
acos
(
cosAlpha
);
float
beta
=
acos
(
cosBeta
);
float
sinAlpha
=
sin
(
alpha
);
float
sinBeta
=
sin
(
beta
);
float
segmentAreaA
=
a_2
*
beta
;
float
segmentAreaB
=
b_2
*
alpha
;
float
triangleAreaA
=
a_2
*
sinBeta
*
cosBeta
;
float
triangleAreaB
=
b_2
*
sinAlpha
*
cosAlpha
;
float
intersectionArea
=
segmentAreaA
+
segmentAreaB
-
triangleAreaA
-
triangleAreaB
;
float
unionArea
=
(
a_2
+
b_2
)
*
(
float
)
CV_PI
-
intersectionArea
;
ovrl
=
intersectionArea
/
unionArea
;
}
return
ovrl
;
}
struct
KeypointResponseGreaterThanThreshold
{
KeypointResponseGreaterThanThreshold
(
float
_value
)
:
...
...
modules/flann/include/opencv2/flann.hpp
View file @
49f6dad1
...
...
@@ -47,8 +47,8 @@
#include "opencv2/core/types_c.h"
#include "opencv2/core.hpp"
#include "opencv2/flann/flann_base.hpp"
#include "opencv2/flann/miniflann.hpp"
#include "opencv2/flann/flann_base.hpp"
namespace
cvflann
{
...
...
modules/java/android_test/src/org/opencv/test/OpenCVTestCase.java
View file @
49f6dad1
...
...
@@ -19,8 +19,8 @@ import org.opencv.core.Point3;
import
org.opencv.core.Rect
;
import
org.opencv.core.Scalar
;
import
org.opencv.core.Size
;
import
org.opencv.
features2d
.DMatch
;
import
org.opencv.
features2d
.KeyPoint
;
import
org.opencv.
core
.DMatch
;
import
org.opencv.
core
.KeyPoint
;
import
org.opencv.highgui.Highgui
;
import
android.util.Log
;
...
...
modules/java/android_test/src/org/opencv/test/
features2d
/DMatchTest.java
→
modules/java/android_test/src/org/opencv/test/
core
/DMatchTest.java
View file @
49f6dad1
package
org
.
opencv
.
test
.
features2d
;
package
org
.
opencv
.
test
.
core
;
import
org.opencv.
features2d
.DMatch
;
import
org.opencv.
core
.DMatch
;
import
junit.framework.TestCase
;
...
...
modules/java/android_test/src/org/opencv/test/
features2d
/KeyPointTest.java
→
modules/java/android_test/src/org/opencv/test/
core
/KeyPointTest.java
View file @
49f6dad1
package
org
.
opencv
.
test
.
features2d
;
package
org
.
opencv
.
test
.
core
;
import
org.opencv.core.Point
;
import
org.opencv.
features2d
.KeyPoint
;
import
org.opencv.
core
.KeyPoint
;
import
org.opencv.test.OpenCVTestCase
;
public
class
KeyPointTest
extends
OpenCVTestCase
{
...
...
modules/java/android_test/src/org/opencv/test/features2d/BRIEFDescriptorExtractorTest.java
View file @
49f6dad1
...
...
@@ -7,7 +7,7 @@ import org.opencv.core.MatOfKeyPoint;
import
org.opencv.core.Point
;
import
org.opencv.core.Scalar
;
import
org.opencv.features2d.DescriptorExtractor
;
import
org.opencv.
features2d
.KeyPoint
;
import
org.opencv.
core
.KeyPoint
;
import
org.opencv.test.OpenCVTestCase
;
import
org.opencv.test.OpenCVTestRunner
;
...
...
modules/java/android_test/src/org/opencv/test/features2d/BruteForceDescriptorMatcherTest.java
View file @
49f6dad1
...
...
@@ -11,11 +11,11 @@ import org.opencv.core.MatOfDMatch;
import
org.opencv.core.MatOfKeyPoint
;
import
org.opencv.core.Point
;
import
org.opencv.core.Scalar
;
import
org.opencv.
features2d
.DMatch
;
import
org.opencv.
core
.DMatch
;
import
org.opencv.features2d.DescriptorExtractor
;
import
org.opencv.features2d.DescriptorMatcher
;
import
org.opencv.features2d.FeatureDetector
;
import
org.opencv.
features2d
.KeyPoint
;
import
org.opencv.
core
.KeyPoint
;
import
org.opencv.test.OpenCVTestCase
;
import
org.opencv.test.OpenCVTestRunner
;
...
...
modules/java/android_test/src/org/opencv/test/features2d/BruteForceHammingDescriptorMatcherTest.java
View file @
49f6dad1
...
...
@@ -10,7 +10,7 @@ import org.opencv.core.MatOfDMatch;
import
org.opencv.core.MatOfKeyPoint
;
import
org.opencv.core.Point
;
import
org.opencv.core.Scalar
;
import
org.opencv.
features2d
.DMatch
;
import
org.opencv.
core
.DMatch
;
import
org.opencv.features2d.DescriptorExtractor
;
import
org.opencv.features2d.DescriptorMatcher
;
import
org.opencv.features2d.FeatureDetector
;
...
...
modules/java/android_test/src/org/opencv/test/features2d/BruteForceHammingLUTDescriptorMatcherTest.java
View file @
49f6dad1
...
...
@@ -10,7 +10,7 @@ import org.opencv.core.MatOfDMatch;
import
org.opencv.core.MatOfKeyPoint
;
import
org.opencv.core.Point
;
import
org.opencv.core.Scalar
;
import
org.opencv.
features2d
.DMatch
;
import
org.opencv.
core
.DMatch
;
import
org.opencv.features2d.DescriptorExtractor
;
import
org.opencv.features2d.DescriptorMatcher
;
import
org.opencv.features2d.FeatureDetector
;
...
...
modules/java/android_test/src/org/opencv/test/features2d/BruteForceL1DescriptorMatcherTest.java
View file @
49f6dad1
...
...
@@ -10,11 +10,11 @@ import org.opencv.core.MatOfDMatch;
import
org.opencv.core.MatOfKeyPoint
;
import
org.opencv.core.Point
;
import
org.opencv.core.Scalar
;
import
org.opencv.
features2d
.DMatch
;
import
org.opencv.
core
.DMatch
;
import
org.opencv.features2d.DescriptorExtractor
;
import
org.opencv.features2d.DescriptorMatcher
;
import
org.opencv.features2d.FeatureDetector
;
import
org.opencv.
features2d
.KeyPoint
;
import
org.opencv.
core
.KeyPoint
;
import
org.opencv.test.OpenCVTestCase
;
import
org.opencv.test.OpenCVTestRunner
;
...
...
modules/java/android_test/src/org/opencv/test/features2d/BruteForceSL2DescriptorMatcherTest.java
View file @
49f6dad1
...
...
@@ -10,11 +10,11 @@ import org.opencv.core.MatOfDMatch;
import
org.opencv.core.MatOfKeyPoint
;
import
org.opencv.core.Point
;
import
org.opencv.core.Scalar
;
import
org.opencv.
features2d
.DMatch
;
import
org.opencv.
core
.DMatch
;
import
org.opencv.features2d.DescriptorExtractor
;
import
org.opencv.features2d.DescriptorMatcher
;
import
org.opencv.features2d.FeatureDetector
;
import
org.opencv.
features2d
.KeyPoint
;
import
org.opencv.
core
.KeyPoint
;
import
org.opencv.test.OpenCVTestCase
;
import
org.opencv.test.OpenCVTestRunner
;
...
...
modules/java/android_test/src/org/opencv/test/features2d/FASTFeatureDetectorTest.java
View file @
49f6dad1
...
...
@@ -9,7 +9,7 @@ import org.opencv.core.MatOfKeyPoint;
import
org.opencv.core.Point
;
import
org.opencv.core.Scalar
;
import
org.opencv.features2d.FeatureDetector
;
import
org.opencv.
features2d
.KeyPoint
;
import
org.opencv.
core
.KeyPoint
;
import
org.opencv.test.OpenCVTestCase
;
import
org.opencv.test.OpenCVTestRunner
;
...
...
modules/java/android_test/src/org/opencv/test/features2d/Features2dTest.java
View file @
49f6dad1
...
...
@@ -12,12 +12,12 @@ import org.opencv.core.MatOfKeyPoint;
import
org.opencv.core.MatOfPoint2f
;
import
org.opencv.core.Point
;
import
org.opencv.core.Range
;
import
org.opencv.
features2d
.DMatch
;
import
org.opencv.
core
.DMatch
;
import
org.opencv.features2d.DescriptorExtractor
;
import
org.opencv.features2d.DescriptorMatcher
;
import
org.opencv.features2d.FeatureDetector
;
import
org.opencv.features2d.Features2d
;
import
org.opencv.
features2d
.KeyPoint
;
import
org.opencv.
core
.KeyPoint
;
import
org.opencv.highgui.Highgui
;
import
org.opencv.test.OpenCVTestCase
;
import
org.opencv.test.OpenCVTestRunner
;
...
...
modules/java/android_test/src/org/opencv/test/features2d/FlannBasedDescriptorMatcherTest.java
View file @
49f6dad1
...
...
@@ -11,11 +11,11 @@ import org.opencv.core.MatOfDMatch;
import
org.opencv.core.MatOfKeyPoint
;
import
org.opencv.core.Point
;
import
org.opencv.core.Scalar
;
import
org.opencv.
features2d
.DMatch
;
import
org.opencv.
core
.DMatch
;
import
org.opencv.features2d.DescriptorExtractor
;
import
org.opencv.features2d.DescriptorMatcher
;
import
org.opencv.features2d.FeatureDetector
;
import
org.opencv.
features2d
.KeyPoint
;
import
org.opencv.
core
.KeyPoint
;
import
org.opencv.test.OpenCVTestCase
;
import
org.opencv.test.OpenCVTestRunner
;
...
...
modules/java/android_test/src/org/opencv/test/features2d/ORBDescriptorExtractorTest.java
View file @
49f6dad1
...
...
@@ -7,7 +7,7 @@ import org.opencv.core.MatOfKeyPoint;
import
org.opencv.core.Point
;
import
org.opencv.core.Scalar
;
import
org.opencv.features2d.DescriptorExtractor
;
import
org.opencv.
features2d
.KeyPoint
;
import
org.opencv.
core
.KeyPoint
;
import
org.opencv.test.OpenCVTestCase
;
import
org.opencv.test.OpenCVTestRunner
;
...
...
modules/java/android_test/src/org/opencv/test/features2d/SIFTDescriptorExtractorTest.java
View file @
49f6dad1
...
...
@@ -7,7 +7,7 @@ import org.opencv.core.MatOfKeyPoint;
import
org.opencv.core.Point
;
import
org.opencv.core.Scalar
;
import
org.opencv.features2d.DescriptorExtractor
;
import
org.opencv.
features2d
.KeyPoint
;
import
org.opencv.
core
.KeyPoint
;
import
org.opencv.test.OpenCVTestCase
;
import
org.opencv.test.OpenCVTestRunner
;
...
...
modules/java/android_test/src/org/opencv/test/features2d/STARFeatureDetectorTest.java
View file @
49f6dad1
...
...
@@ -9,7 +9,7 @@ import org.opencv.core.MatOfKeyPoint;
import
org.opencv.core.Point
;
import
org.opencv.core.Scalar
;
import
org.opencv.features2d.FeatureDetector
;
import
org.opencv.
features2d
.KeyPoint
;
import
org.opencv.
core
.KeyPoint
;
import
org.opencv.test.OpenCVTestCase
;
import
org.opencv.test.OpenCVTestRunner
;
...
...
modules/java/android_test/src/org/opencv/test/features2d/SURFDescriptorExtractorTest.java
View file @
49f6dad1
...
...
@@ -7,7 +7,7 @@ import org.opencv.core.MatOfKeyPoint;
import
org.opencv.core.Point
;
import
org.opencv.core.Scalar
;
import
org.opencv.features2d.DescriptorExtractor
;
import
org.opencv.
features2d
.KeyPoint
;
import
org.opencv.
core
.KeyPoint
;
import
org.opencv.test.OpenCVTestCase
;
import
org.opencv.test.OpenCVTestRunner
;
...
...
modules/java/android_test/src/org/opencv/test/features2d/SURFFeatureDetectorTest.java
View file @
49f6dad1
...
...
@@ -13,7 +13,7 @@ import org.opencv.core.MatOfKeyPoint;
import
org.opencv.core.Point
;
import
org.opencv.core.Scalar
;
import
org.opencv.features2d.FeatureDetector
;
import
org.opencv.
features2d
.KeyPoint
;
import
org.opencv.
core
.KeyPoint
;
import
org.opencv.test.OpenCVTestCase
;
import
org.opencv.test.OpenCVTestRunner
;
...
...
modules/java/android_test/src/org/opencv/test/utils/ConvertersTest.java
View file @
49f6dad1
...
...
@@ -5,8 +5,8 @@ import org.opencv.core.Mat;
import
org.opencv.core.Point
;
import
org.opencv.core.Point3
;
import
org.opencv.core.Rect
;
import
org.opencv.
features2d
.DMatch
;
import
org.opencv.
features2d
.KeyPoint
;
import
org.opencv.
core
.DMatch
;
import
org.opencv.
core
.KeyPoint
;
import
org.opencv.test.OpenCVTestCase
;
import
org.opencv.utils.Converters
;
...
...
modules/java/generator/gen_java.py
View file @
49f6dad1
...
...
@@ -10,7 +10,7 @@ except:
class_ignore_list
=
(
#core
"FileNode"
,
"FileStorage"
,
"KDTree"
,
"FileNode"
,
"FileStorage"
,
"KDTree"
,
"KeyPoint"
,
"DMatch"
,
#highgui
"VideoWriter"
,
"VideoCapture"
,
)
...
...
modules/java/generator/src/java/
features2d
+DMatch.java
→
modules/java/generator/src/java/
core
+DMatch.java
View file @
49f6dad1
package
org
.
opencv
.
features2d
;
package
org
.
opencv
.
core
;
//C++: class DMatch
...
...
modules/java/generator/src/java/
features2d
+KeyPoint.java
→
modules/java/generator/src/java/
core
+KeyPoint.java
View file @
49f6dad1
package
org
.
opencv
.
features2d
;
package
org
.
opencv
.
core
;
import
org.opencv.core.Point
;
...
...
modules/java/generator/src/java/core+MatOfDMatch.java
View file @
49f6dad1
...
...
@@ -3,7 +3,7 @@ package org.opencv.core;
import
java.util.Arrays
;
import
java.util.List
;
import
org.opencv.
features2d
.DMatch
;
import
org.opencv.
core
.DMatch
;
public
class
MatOfDMatch
extends
Mat
{
// 32FC4
...
...
modules/java/generator/src/java/core+MatOfKeyPoint.java
View file @
49f6dad1
...
...
@@ -3,7 +3,7 @@ package org.opencv.core;
import
java.util.Arrays
;
import
java.util.List
;
import
org.opencv.
features2d
.KeyPoint
;
import
org.opencv.
core
.KeyPoint
;
public
class
MatOfKeyPoint
extends
Mat
{
// 32FC7
...
...
modules/java/generator/src/java/utils+Converters.java
View file @
49f6dad1
...
...
@@ -14,8 +14,8 @@ import org.opencv.core.MatOfPoint3f;
import
org.opencv.core.Point
;
import
org.opencv.core.Point3
;
import
org.opencv.core.Rect
;
import
org.opencv.
features2d
.DMatch
;
import
org.opencv.
features2d
.KeyPoint
;
import
org.opencv.
core
.DMatch
;
import
org.opencv.
core
.KeyPoint
;
public
class
Converters
{
...
...
modules/java/test/src/org/opencv/test/OpenCVTestCase.java
View file @
49f6dad1
...
...
@@ -23,8 +23,8 @@ import org.opencv.core.Point3;
import
org.opencv.core.Rect
;
import
org.opencv.core.Scalar
;
import
org.opencv.core.Size
;
import
org.opencv.
features2d
.DMatch
;
import
org.opencv.
features2d
.KeyPoint
;
import
org.opencv.
core
.DMatch
;
import
org.opencv.
core
.KeyPoint
;
import
org.opencv.highgui.Highgui
;
public
class
OpenCVTestCase
extends
TestCase
{
...
...
modules/ocl/CMakeLists.txt
View file @
49f6dad1
...
...
@@ -3,5 +3,5 @@ if(NOT HAVE_OPENCL)
endif
()
set
(
the_description
"OpenCL-accelerated Computer Vision"
)
ocv_define_module
(
ocl opencv_core opencv_imgproc opencv_
features2d opencv_
objdetect opencv_video
)
ocv_define_module
(
ocl opencv_core opencv_imgproc opencv_objdetect opencv_video
)
ocv_warnings_disable
(
CMAKE_CXX_FLAGS -Wshadow
)
modules/ocl/include/opencv2/ocl.hpp
View file @
49f6dad1
...
...
@@ -50,7 +50,7 @@
#include "opencv2/core.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/objdetect.hpp"
#include "opencv2/features2d.hpp"
//
#include "opencv2/features2d.hpp"
namespace
cv
{
...
...
modules/ts/CMakeLists.txt
View file @
49f6dad1
...
...
@@ -16,7 +16,7 @@ endif()
ocv_warnings_disable
(
CMAKE_CXX_FLAGS -Wundef
)
ocv_add_module
(
ts opencv_core opencv_
features2d
)
ocv_add_module
(
ts opencv_core opencv_
imgproc opencv_highgui
)
ocv_glob_module_sources
()
ocv_module_include_directories
()
...
...
modules/ts/include/opencv2/ts/ts_perf.hpp
View file @
49f6dad1
...
...
@@ -2,7 +2,6 @@
#define __OPENCV_TS_PERF_HPP__
#include "opencv2/core.hpp"
#include "opencv2/features2d.hpp"
#include "ts_gtest.h"
#ifdef HAVE_TBB
...
...
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