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
2249f191
Commit
2249f191
authored
Mar 26, 2013
by
Andrey Kamaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move cv::Range, cv::KeyPoint and cv::DMatch
parent
93d76ac2
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
118 additions
and
121 deletions
+118
-121
core.hpp
modules/core/include/opencv2/core.hpp
+0
-110
operations.hpp
modules/core/include/opencv2/core/operations.hpp
+0
-9
types.hpp
modules/core/include/opencv2/core/types.hpp
+109
-0
types_c.h
modules/core/include/opencv2/core/types_c.h
+8
-2
CMakeLists.txt
modules/python/CMakeLists.txt
+1
-0
No files found.
modules/core/include/opencv2/core.hpp
View file @
2249f191
...
...
@@ -563,116 +563,6 @@ typedef Scalar_<double> Scalar;
CV_EXPORTS
void
scalarToRawData
(
const
Scalar
&
s
,
void
*
buf
,
int
type
,
int
unroll_to
=
0
);
//////////////////////////////// Range /////////////////////////////////
/*!
The 2D range class
This is the class used to specify a continuous subsequence, i.e. part of a contour, or a column span in a matrix.
*/
class
CV_EXPORTS
Range
{
public
:
Range
();
Range
(
int
_start
,
int
_end
);
Range
(
const
CvSlice
&
slice
);
int
size
()
const
;
bool
empty
()
const
;
static
Range
all
();
operator
CvSlice
()
const
;
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 @
2249f191
...
...
@@ -2084,11 +2084,6 @@ Scalar_<_Tp>& operator /= (Scalar_<_Tp>& a, const Scalar_<_Tp>& b)
inline
Range
::
Range
()
:
start
(
0
),
end
(
0
)
{}
inline
Range
::
Range
(
int
_start
,
int
_end
)
:
start
(
_start
),
end
(
_end
)
{}
inline
Range
::
Range
(
const
CvSlice
&
slice
)
:
start
(
slice
.
start_index
),
end
(
slice
.
end_index
)
{
if
(
start
==
0
&&
end
==
CV_WHOLE_SEQ_END_INDEX
)
*
this
=
Range
::
all
();
}
inline
int
Range
::
size
()
const
{
return
end
-
start
;
}
inline
bool
Range
::
empty
()
const
{
return
start
==
end
;
}
...
...
@@ -2131,10 +2126,6 @@ static inline Range operator - (const Range& r1, int delta)
return
r1
+
(
-
delta
);
}
inline
Range
::
operator
CvSlice
()
const
{
return
*
this
!=
Range
::
all
()
?
cvSlice
(
start
,
end
)
:
CV_WHOLE_SEQ
;
}
//////////////////////////////// Vector ////////////////////////////////
...
...
modules/core/include/opencv2/core/types.hpp
View file @
2249f191
...
...
@@ -45,6 +45,7 @@
#define __OPENCV_CORE_TYPES_HPP__
#include <climits>
#include <vector>
#ifndef OPENCV_NOSTL
# include <complex>
...
...
@@ -361,6 +362,114 @@ public:
//////////////////////////////// Range /////////////////////////////////
/*!
The 2D range class
This is the class used to specify a continuous subsequence, i.e. part of a contour, or a column span in a matrix.
*/
class
CV_EXPORTS
Range
{
public
:
Range
();
Range
(
int
_start
,
int
_end
);
//Range(const CvSlice& slice);
int
size
()
const
;
bool
empty
()
const
;
static
Range
all
();
//operator CvSlice() const;
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
;
}
}
// cv
...
...
modules/core/include/opencv2/core/types_c.h
View file @
2249f191
...
...
@@ -983,10 +983,18 @@ CvLineIterator;
/************************************* CvSlice ******************************************/
#define CV_WHOLE_SEQ_END_INDEX 0x3fffffff
#define CV_WHOLE_SEQ cvSlice(0, CV_WHOLE_SEQ_END_INDEX)
typedef
struct
CvSlice
{
int
start_index
,
end_index
;
#ifdef __cplusplus
CvSlice
(
int
start
=
0
,
int
end
=
0
)
:
start_index
(
start
),
end_index
(
end
)
{}
CvSlice
(
const
cv
::
Range
&
r
)
{
*
this
=
(
r
.
start
!=
INT_MIN
&&
r
.
end
!=
INT_MAX
)
?
CvSlice
(
r
.
start
,
r
.
end
)
:
CvSlice
(
0
,
CV_WHOLE_SEQ_END_INDEX
);
}
operator
cv
::
Range
()
const
{
return
(
start_index
==
0
&&
end_index
==
CV_WHOLE_SEQ_END_INDEX
)
?
cv
::
Range
::
all
()
:
cv
::
Range
(
start_index
,
end_index
);
}
#endif
}
CvSlice
;
...
...
@@ -999,8 +1007,6 @@ CV_INLINE CvSlice cvSlice( int start, int end )
return
slice
;
}
#define CV_WHOLE_SEQ_END_INDEX 0x3fffffff
#define CV_WHOLE_SEQ cvSlice(0, CV_WHOLE_SEQ_END_INDEX)
/************************************* CvScalar *****************************************/
...
...
modules/python/CMakeLists.txt
View file @
2249f191
...
...
@@ -24,6 +24,7 @@ ocv_module_include_directories(
set
(
opencv_hdrs
"
${
OPENCV_MODULE_opencv_core_LOCATION
}
/include/opencv2/core.hpp"
"
${
OPENCV_MODULE_opencv_core_LOCATION
}
/include/opencv2/core/types.hpp"
"
${
OPENCV_MODULE_opencv_core_LOCATION
}
/include/opencv2/core/utility.hpp"
"
${
OPENCV_MODULE_opencv_flann_LOCATION
}
/include/opencv2/flann/miniflann.hpp"
"
${
OPENCV_MODULE_opencv_imgproc_LOCATION
}
/include/opencv2/imgproc.hpp"
...
...
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