added KeyPoint::hash() (ticket #1100)
This commit is contained in:
parent
63dc1cdd2c
commit
af2af3af9b
modules/features2d
@ -236,6 +236,9 @@ public:
|
|||||||
float _response=0, int _octave=0, int _class_id=-1)
|
float _response=0, int _octave=0, int _class_id=-1)
|
||||||
: pt(x, y), size(_size), angle(_angle),
|
: pt(x, y), size(_size), angle(_angle),
|
||||||
response(_response), octave(_octave), class_id(_class_id) {}
|
response(_response), octave(_octave), class_id(_class_id) {}
|
||||||
|
|
||||||
|
size_t hash() const;
|
||||||
|
|
||||||
//! converts vector of keypoints to vector of points
|
//! converts vector of keypoints to vector of points
|
||||||
static void convert(const std::vector<KeyPoint>& keypoints,
|
static void convert(const std::vector<KeyPoint>& keypoints,
|
||||||
CV_OUT std::vector<Point2f>& points2f,
|
CV_OUT std::vector<Point2f>& points2f,
|
||||||
|
@ -44,6 +44,19 @@
|
|||||||
namespace cv
|
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 vector<KeyPoint>& keypoints)
|
void write(FileStorage& fs, const string& objname, const vector<KeyPoint>& keypoints)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user