Commit d84b970b authored by Ethan Rublee's avatar Ethan Rublee

adding the Brief descriptor, associated hamming distance functors for bruteforce…

adding the Brief descriptor, associated hamming distance functors for bruteforce matching.  Also adding cout << cv::Mat functions in core.
parent 4065f17a
......@@ -4055,5 +4055,6 @@ public:
#include "opencv2/core/operations.hpp"
#include "opencv2/core/mat.hpp"
#include "opencv2/core/cvout.hpp"
#endif /*__OPENCV_CORE_HPP__*/
#ifndef __OPENCV_CORE_CVOUT_HPP__
#define __OPENCV_CORE_CVOUT_HPP__
#ifdef __cplusplus
#ifndef SKIP_INCLUDES
#include <iomanip>
#include <iostream>
#include <vector>
#endif
namespace cv
{
/** Writes a point to an output stream in Matlab notation
*/
inline std::ostream & operator<<(std::ostream & out, const Point2f & p)
{
out << "[ " << p.x << "," << p.y << " ]";
return out;
}
/** Writes a point to an output stream in Matlab notation
*/
inline std::ostream & operator<<(std::ostream & out, const Point3f & p)
{
out << "[ " << p.x << "," << p.y << "," << p.z << " ]";
return out;
}
/** \brief write points to and output stream
* \param out typically cout
* \param points the points to be written to the stream
* \return the stream
**/
CV_EXPORTS std::ostream & operator<<(std::ostream & out, const std::vector<Point2f> & points);
/** \brief write points to and output stream
* \param out typically cout
* \param points the points to be written to the stream
* \return the stream
**/
std::ostream & operator<<(std::ostream & out, const std::vector<Point3f> & points);
/** \brief allows each output of Mat in Matlab for Mat to std::cout
* use like
@verbatim
Mat my_mat = Mat::eye(3,3,CV_32F);
std::cout << my_mat;
@endverbatim
*/
CV_EXPORTS std::ostream & operator<<(std::ostream & out, const Mat & mat);
/** \brief write a Mat in csv compatible for Matlab.
This means that the rows are seperated by newlines and the
columns by commas ....
331.413896619595,0,122.365880226491
0,249.320451610369,122.146722131871
0,0,1
* \param out output stream to write to
* \param Mat write a Mat to a csv
*/
CV_EXPORTS std::ostream & writeCSV(std::ostream & out, const Mat & mat);
/** \brief write a vector of points to an
output stream if possible
**/
CV_EXPORTS std::ostream & writeCSV(std::ostream & out, const std::vector<Point2f> & points);
/** \brief write a vector of points to an
output stream if possible
**/
CV_EXPORTS std::ostream & writeCSV(std::ostream & out, const std::vector<Point3f> & points);
} //namespace cv
#endif
#endif
#include "opencv2/core/core.hpp"
namespace cv
{
namespace
{
template<typename T>
std::ostream & writevec(std::ostream & out, const std::vector<T> & points)
{
typedef T MT_T;
typedef typename std::vector<T>::const_iterator CIT;
/* Draw Me:
plot2( pts1(:,1),pts1(:,2),'r.') */
std::streamsize pp = out.precision();
out.precision(15);
out << "[";
CIT it = points.begin();
for (; it != points.end(); ++it)
{
out << *it;
CIT next = it;
if (++next != points.end())
{
out << " ";
}
}
out << "]";
out.precision(pp);
return out;
}
std::ostream & writeelem(std::ostream & out, const Mat & mat, int i, int j)
{
if (mat.type() == CV_32F)
out << mat.at<float> (i, j);
else if (mat.type() == CV_64F)
out << mat.at<double> (i, j);
else if (mat.type() == CV_32S)
out << mat.at<int> (i, j);
else if (mat.type() == CV_8U)
out << int(mat.at<unsigned char> (i, j));
else if (mat.type() == CV_16U)
out << int(mat.at<unsigned short> (i, j));
else
out << "?";
return out;
}
}
std::ostream & operator<<(std::ostream & out, const std::vector<Point2f> & points)
{
return writevec(out, points);
}
std::ostream & operator<<(std::ostream & out, const std::vector<Point3f> & points)
{
return writevec(out, points);
}
std::ostream & operator<<(std::ostream & out, const Mat & _mat)
{
std::streamsize pp = out.precision();
out.precision(15);
std::vector<Mat> channels;
split(_mat, channels);
for (int chn = 0; chn < _mat.channels(); chn++)
{
Mat mat = channels[chn];
out << "[";
for (int i = 0; i < mat.rows; i++)
{
for (int j = 0; j < mat.cols; j++)
{
writeelem(out,mat,i,j);
if (j < mat.cols - 1)
out << " ";
}
if (i < mat.rows - 1)
out << ";\n";
}
out << "]";
}
out.precision(pp);
return out;
}
std::ostream & writeCSV(std::ostream & out, const std::vector<Point3f> & points)
{
std::streamsize pp = out.precision();
out.precision(15);
std::vector<Point3f>::const_iterator it = points.begin();
for (; it != points.end(); ++it)
{
out << it->x << "," << it->y << ","<< it->z << "\n";
}
out.precision(pp);
return out;
}
std::ostream & writeCSV(std::ostream & out, const std::vector<Point2f> & points)
{
std::streamsize pp = out.precision();
out.precision(15);
std::vector<Point2f>::const_iterator it = points.begin();
for (; it != points.end(); ++it)
{
out << it->x << "," << it->y << "\n";
}
out.precision(pp);
return out;
}
std::ostream & writeCSV(std::ostream & out, const Mat & mat)
{
std::streamsize pp = out.precision();
out.precision(15);
for (int i = 0; i < mat.rows; i++)
{
for (int j = 0; j < mat.cols; j++)
{
writeelem(out,mat,i,j);
if (j < mat.cols - 1)
out << ",";
}
out << "\n";
}
out.precision(pp);
return out;
}
}
......@@ -2456,7 +2456,7 @@ protected:
};
/*
* Class to compute image descriptor using bad of visual words.
* Class to compute image descriptor using bag of visual words.
*/
class CV_EXPORTS BOWImgDescriptorExtractor
{
......@@ -2478,6 +2478,106 @@ protected:
Ptr<DescriptorMatcher> dmatcher;
};
/****************************************************************************************\
* BRIEF Descriptor *
\****************************************************************************************/
class CV_EXPORTS BriefDescriptorExtractor : public DescriptorExtractor
{
public:
BriefDescriptorExtractor(int bytes = 32);
virtual void compute(const Mat& image, std::vector<KeyPoint>& keypoints, Mat& descriptors) const;
virtual int descriptorSize() const
{
return bytes_;
}
virtual int descriptorType() const
{
return CV_8UC1;
}
/// @todo read and write for brief
//virtual void read(const FileNode& fn);
//virtual void write(FileStorage& fs) const;
protected:
static const int PATCH_SIZE = 48;
static const int KERNEL_SIZE = 9;
int bytes_;
typedef void(*PixelTestFn)(const Mat&, const std::vector<KeyPoint>&, Mat&);
PixelTestFn test_fn_;
static int32_t smoothedSum(const Mat& sum, const KeyPoint& pt, int y, int x);
static void pixelTests16(const Mat& sum, const std::vector<KeyPoint>& keypoints, Mat& descriptors);
static void pixelTests32(const Mat& sum, const std::vector<KeyPoint>& keypoints, Mat& descriptors);
static void pixelTests64(const Mat& sum, const std::vector<KeyPoint>& keypoints, Mat& descriptors);
};
inline int32_t BriefDescriptorExtractor::smoothedSum(const Mat& sum, const KeyPoint& pt, int y, int x)
{
static const int HALF_KERNEL = KERNEL_SIZE / 2;
int img_y = (int)(pt.pt.y + 0.5) + y;
int img_x = (int)(pt.pt.x + 0.5) + x;
return sum.at<int32_t> (img_y + HALF_KERNEL + 1, img_x + HALF_KERNEL + 1) - sum.at<int32_t> (img_y + HALF_KERNEL + 1,
img_x - HALF_KERNEL)
- sum.at<int32_t> (img_y - HALF_KERNEL, img_x + HALF_KERNEL + 1) + sum.at<int32_t> (img_y - HALF_KERNEL, img_x
- HALF_KERNEL);
}
struct CV_EXPORTS HammingLUT
{
typedef unsigned char ValueType;
typedef int ResultType;
ResultType operator()(const unsigned char* a, const unsigned char* b, int size) const
{
ResultType result = 0;
for (int i = 0; i < size; i++)
{
result += byteBitsLookUp(a[i] ^ b[i]);
}
return result;
}
/** \brief given a byte, count the bits using a compile time generated look up table
* \param b the byte to count bits. The look up table has an entry for all
* values of b, where that entry is the number of bits.
* \return the number of bits in byte b
*/
static unsigned char byteBitsLookUp(unsigned char b);
};
#if __GNUC__
/// Hamming distance functor
/// @todo Variable-length version, maybe default size=0 and specialize
/// @todo Need to choose C/SSE4 at runtime, but amortize this at matcher level for efficiency...
//template<int size>
struct Hamming
{
typedef unsigned char ValueType;
typedef int ResultType;
ResultType operator()(const unsigned char* a, const unsigned char* b, int size) const
{
/// @todo Non-GCC-specific version
ResultType result = 0;
for (int i = 0; i < size; i += sizeof(unsigned long))
{
unsigned long a2 = *reinterpret_cast<const unsigned long*> (a + i);
unsigned long b2 = *reinterpret_cast<const unsigned long*> (b + i);
result += __builtin_popcountl(a2 ^ b2);
}
return result;
}
};
#else
typedef HammingLUT Hamming;
#endif
} /* namespace cv */
#endif /* __cplusplus */
......
#include <opencv2/features2d/features2d.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <algorithm>
#include <vector>
using std::vector;
namespace cv
{
BriefDescriptorExtractor::BriefDescriptorExtractor(int bytes) :
bytes_(bytes), test_fn_(NULL)
{
switch (bytes)
{
case 16:
test_fn_ = pixelTests16;
break;
case 32:
test_fn_ = pixelTests32;
break;
case 64:
test_fn_ = pixelTests64;
break;
default:
CV_Error(CV_StsBadArg, "bytes must be 16, 32, or 64");
}
}
void BriefDescriptorExtractor::compute(const Mat& image, std::vector<KeyPoint>& keypoints, Mat& descriptors) const
{
// Construct integral image for fast smoothing (box filter)
Mat sum;
if(image.type() == CV_32S)
sum = image;
else
integral(image, sum, CV_32S);
//Remove keypoints very close to the border
removeBorderKeypoints(keypoints, image.size(), PATCH_SIZE/2 + KERNEL_SIZE/2);
descriptors = Mat::zeros(keypoints.size(), bytes_, CV_8U);
test_fn_(sum, keypoints, descriptors);
}
void BriefDescriptorExtractor::pixelTests16(const Mat& sum, const std::vector<KeyPoint>& keypoints, Mat& descriptors)
{
for (int i = 0; i < (int)keypoints.size(); ++i)
{
uchar* desc = descriptors.ptr(i);
const KeyPoint& pt = keypoints[i];
#include "generated_16.i"
}
}
void BriefDescriptorExtractor::pixelTests32(const Mat& sum, const std::vector<KeyPoint>& keypoints, Mat& descriptors)
{
for (int i = 0; i < (int)keypoints.size(); ++i)
{
uchar* desc = descriptors.ptr(i);
const KeyPoint& pt = keypoints[i];
#include "generated_32.i"
}
}
void BriefDescriptorExtractor::pixelTests64(const Mat& sum, const std::vector<KeyPoint>& keypoints, Mat& descriptors)
{
for (int i = 0; i < (int)keypoints.size(); ++i)
{
uchar* desc = descriptors.ptr(i);
const KeyPoint& pt = keypoints[i];
#include "generated_64.i"
}
}
/**
* \brief template meta programming struct that gives number of bits in a byte
* @TODO Maybe unintuitive and should just use python to generate the entries in the LUT
*/
template<unsigned char b>
struct ByteBits
{
/**
* number of bits in the byte given by the template constant
*/
enum
{
COUNT = ((b >> 0) & 1) +
((b >> 1) & 1) +
((b >> 2) & 1) +
((b >> 3) & 1) +
((b >> 4) & 1) +
((b >> 5) & 1) +
((b >> 6) & 1) +
((b >> 7) & 1)
};
};
unsigned char HammingLUT::byteBitsLookUp(unsigned char b){
static const unsigned char table[256] =
{
ByteBits<0>::COUNT,
ByteBits<1>::COUNT,
ByteBits<2>::COUNT,
ByteBits<3>::COUNT,
ByteBits<4>::COUNT,
ByteBits<5>::COUNT,
ByteBits<6>::COUNT,
ByteBits<7>::COUNT,
ByteBits<8>::COUNT,
ByteBits<9>::COUNT,
ByteBits<10>::COUNT,
ByteBits<11>::COUNT,
ByteBits<12>::COUNT,
ByteBits<13>::COUNT,
ByteBits<14>::COUNT,
ByteBits<15>::COUNT,
ByteBits<16>::COUNT,
ByteBits<17>::COUNT,
ByteBits<18>::COUNT,
ByteBits<19>::COUNT,
ByteBits<20>::COUNT,
ByteBits<21>::COUNT,
ByteBits<22>::COUNT,
ByteBits<23>::COUNT,
ByteBits<24>::COUNT,
ByteBits<25>::COUNT,
ByteBits<26>::COUNT,
ByteBits<27>::COUNT,
ByteBits<28>::COUNT,
ByteBits<29>::COUNT,
ByteBits<30>::COUNT,
ByteBits<31>::COUNT,
ByteBits<32>::COUNT,
ByteBits<33>::COUNT,
ByteBits<34>::COUNT,
ByteBits<35>::COUNT,
ByteBits<36>::COUNT,
ByteBits<37>::COUNT,
ByteBits<38>::COUNT,
ByteBits<39>::COUNT,
ByteBits<40>::COUNT,
ByteBits<41>::COUNT,
ByteBits<42>::COUNT,
ByteBits<43>::COUNT,
ByteBits<44>::COUNT,
ByteBits<45>::COUNT,
ByteBits<46>::COUNT,
ByteBits<47>::COUNT,
ByteBits<48>::COUNT,
ByteBits<49>::COUNT,
ByteBits<50>::COUNT,
ByteBits<51>::COUNT,
ByteBits<52>::COUNT,
ByteBits<53>::COUNT,
ByteBits<54>::COUNT,
ByteBits<55>::COUNT,
ByteBits<56>::COUNT,
ByteBits<57>::COUNT,
ByteBits<58>::COUNT,
ByteBits<59>::COUNT,
ByteBits<60>::COUNT,
ByteBits<61>::COUNT,
ByteBits<62>::COUNT,
ByteBits<63>::COUNT,
ByteBits<64>::COUNT,
ByteBits<65>::COUNT,
ByteBits<66>::COUNT,
ByteBits<67>::COUNT,
ByteBits<68>::COUNT,
ByteBits<69>::COUNT,
ByteBits<70>::COUNT,
ByteBits<71>::COUNT,
ByteBits<72>::COUNT,
ByteBits<73>::COUNT,
ByteBits<74>::COUNT,
ByteBits<75>::COUNT,
ByteBits<76>::COUNT,
ByteBits<77>::COUNT,
ByteBits<78>::COUNT,
ByteBits<79>::COUNT,
ByteBits<80>::COUNT,
ByteBits<81>::COUNT,
ByteBits<82>::COUNT,
ByteBits<83>::COUNT,
ByteBits<84>::COUNT,
ByteBits<85>::COUNT,
ByteBits<86>::COUNT,
ByteBits<87>::COUNT,
ByteBits<88>::COUNT,
ByteBits<89>::COUNT,
ByteBits<90>::COUNT,
ByteBits<91>::COUNT,
ByteBits<92>::COUNT,
ByteBits<93>::COUNT,
ByteBits<94>::COUNT,
ByteBits<95>::COUNT,
ByteBits<96>::COUNT,
ByteBits<97>::COUNT,
ByteBits<98>::COUNT,
ByteBits<99>::COUNT,
ByteBits<100>::COUNT,
ByteBits<101>::COUNT,
ByteBits<102>::COUNT,
ByteBits<103>::COUNT,
ByteBits<104>::COUNT,
ByteBits<105>::COUNT,
ByteBits<106>::COUNT,
ByteBits<107>::COUNT,
ByteBits<108>::COUNT,
ByteBits<109>::COUNT,
ByteBits<110>::COUNT,
ByteBits<111>::COUNT,
ByteBits<112>::COUNT,
ByteBits<113>::COUNT,
ByteBits<114>::COUNT,
ByteBits<115>::COUNT,
ByteBits<116>::COUNT,
ByteBits<117>::COUNT,
ByteBits<118>::COUNT,
ByteBits<119>::COUNT,
ByteBits<120>::COUNT,
ByteBits<121>::COUNT,
ByteBits<122>::COUNT,
ByteBits<123>::COUNT,
ByteBits<124>::COUNT,
ByteBits<125>::COUNT,
ByteBits<126>::COUNT,
ByteBits<127>::COUNT,
ByteBits<128>::COUNT,
ByteBits<129>::COUNT,
ByteBits<130>::COUNT,
ByteBits<131>::COUNT,
ByteBits<132>::COUNT,
ByteBits<133>::COUNT,
ByteBits<134>::COUNT,
ByteBits<135>::COUNT,
ByteBits<136>::COUNT,
ByteBits<137>::COUNT,
ByteBits<138>::COUNT,
ByteBits<139>::COUNT,
ByteBits<140>::COUNT,
ByteBits<141>::COUNT,
ByteBits<142>::COUNT,
ByteBits<143>::COUNT,
ByteBits<144>::COUNT,
ByteBits<145>::COUNT,
ByteBits<146>::COUNT,
ByteBits<147>::COUNT,
ByteBits<148>::COUNT,
ByteBits<149>::COUNT,
ByteBits<150>::COUNT,
ByteBits<151>::COUNT,
ByteBits<152>::COUNT,
ByteBits<153>::COUNT,
ByteBits<154>::COUNT,
ByteBits<155>::COUNT,
ByteBits<156>::COUNT,
ByteBits<157>::COUNT,
ByteBits<158>::COUNT,
ByteBits<159>::COUNT,
ByteBits<160>::COUNT,
ByteBits<161>::COUNT,
ByteBits<162>::COUNT,
ByteBits<163>::COUNT,
ByteBits<164>::COUNT,
ByteBits<165>::COUNT,
ByteBits<166>::COUNT,
ByteBits<167>::COUNT,
ByteBits<168>::COUNT,
ByteBits<169>::COUNT,
ByteBits<170>::COUNT,
ByteBits<171>::COUNT,
ByteBits<172>::COUNT,
ByteBits<173>::COUNT,
ByteBits<174>::COUNT,
ByteBits<175>::COUNT,
ByteBits<176>::COUNT,
ByteBits<177>::COUNT,
ByteBits<178>::COUNT,
ByteBits<179>::COUNT,
ByteBits<180>::COUNT,
ByteBits<181>::COUNT,
ByteBits<182>::COUNT,
ByteBits<183>::COUNT,
ByteBits<184>::COUNT,
ByteBits<185>::COUNT,
ByteBits<186>::COUNT,
ByteBits<187>::COUNT,
ByteBits<188>::COUNT,
ByteBits<189>::COUNT,
ByteBits<190>::COUNT,
ByteBits<191>::COUNT,
ByteBits<192>::COUNT,
ByteBits<193>::COUNT,
ByteBits<194>::COUNT,
ByteBits<195>::COUNT,
ByteBits<196>::COUNT,
ByteBits<197>::COUNT,
ByteBits<198>::COUNT,
ByteBits<199>::COUNT,
ByteBits<200>::COUNT,
ByteBits<201>::COUNT,
ByteBits<202>::COUNT,
ByteBits<203>::COUNT,
ByteBits<204>::COUNT,
ByteBits<205>::COUNT,
ByteBits<206>::COUNT,
ByteBits<207>::COUNT,
ByteBits<208>::COUNT,
ByteBits<209>::COUNT,
ByteBits<210>::COUNT,
ByteBits<211>::COUNT,
ByteBits<212>::COUNT,
ByteBits<213>::COUNT,
ByteBits<214>::COUNT,
ByteBits<215>::COUNT,
ByteBits<216>::COUNT,
ByteBits<217>::COUNT,
ByteBits<218>::COUNT,
ByteBits<219>::COUNT,
ByteBits<220>::COUNT,
ByteBits<221>::COUNT,
ByteBits<222>::COUNT,
ByteBits<223>::COUNT,
ByteBits<224>::COUNT,
ByteBits<225>::COUNT,
ByteBits<226>::COUNT,
ByteBits<227>::COUNT,
ByteBits<228>::COUNT,
ByteBits<229>::COUNT,
ByteBits<230>::COUNT,
ByteBits<231>::COUNT,
ByteBits<232>::COUNT,
ByteBits<233>::COUNT,
ByteBits<234>::COUNT,
ByteBits<235>::COUNT,
ByteBits<236>::COUNT,
ByteBits<237>::COUNT,
ByteBits<238>::COUNT,
ByteBits<239>::COUNT,
ByteBits<240>::COUNT,
ByteBits<241>::COUNT,
ByteBits<242>::COUNT,
ByteBits<243>::COUNT,
ByteBits<244>::COUNT,
ByteBits<245>::COUNT,
ByteBits<246>::COUNT,
ByteBits<247>::COUNT,
ByteBits<248>::COUNT,
ByteBits<249>::COUNT,
ByteBits<250>::COUNT,
ByteBits<251>::COUNT,
ByteBits<252>::COUNT,
ByteBits<253>::COUNT,
ByteBits<254>::COUNT,
ByteBits<255>::COUNT
};
return table[b];
}
} // namespace cv
......@@ -277,26 +277,30 @@ void OpponentColorDescriptorExtractor::write( FileStorage& fs ) const
* Factory function for descriptor extractor creating *
\****************************************************************************************/
Ptr<DescriptorExtractor> createDescriptorExtractor( const string& descriptorExtractorType )
Ptr<DescriptorExtractor> createDescriptorExtractor(const string& descriptorExtractorType)
{
DescriptorExtractor* de = 0;
if( !descriptorExtractorType.compare( "SIFT" ) )
{
de = new SiftDescriptorExtractor();
}
else if( !descriptorExtractorType.compare( "SURF" ) )
{
de = new SurfDescriptorExtractor();
}
else if( !descriptorExtractorType.compare( "OpponentSIFT" ) )
{
de = new OpponentColorDescriptorExtractor( new SiftDescriptorExtractor );
}
else if( !descriptorExtractorType.compare( "OpponentSURF" ) )
{
de = new OpponentColorDescriptorExtractor( new SurfDescriptorExtractor );
}
return de;
DescriptorExtractor* de = 0;
if (!descriptorExtractorType.compare("SIFT"))
{
de = new SiftDescriptorExtractor();
}
else if (!descriptorExtractorType.compare("SURF"))
{
de = new SurfDescriptorExtractor();
}
else if (!descriptorExtractorType.compare("OpponentSIFT"))
{
de = new OpponentColorDescriptorExtractor(new SiftDescriptorExtractor);
}
else if (!descriptorExtractorType.compare("OpponentSURF"))
{
de = new OpponentColorDescriptorExtractor(new SurfDescriptorExtractor);
}
else if (!descriptorExtractorType.compare("BRIEF"))
{
de = new BriefDescriptorExtractor(32);
}
return de;
}
}
// Code generated with '$ scripts/generate_code.py src/test_pairs.txt 16'
#define SMOOTHED(y,x) smoothedSum(sum, pt, y, x)
desc[0] = ((SMOOTHED(-2, -1) < SMOOTHED(7, -1)) << 7) + ((SMOOTHED(-14, -1) < SMOOTHED(-3, 3)) << 6) + ((SMOOTHED(1, -2) < SMOOTHED(11, 2)) << 5) + ((SMOOTHED(1, 6) < SMOOTHED(-10, -7)) << 4) + ((SMOOTHED(13, 2) < SMOOTHED(-1, 0)) << 3) + ((SMOOTHED(-14, 5) < SMOOTHED(5, -3)) << 2) + ((SMOOTHED(-2, 8) < SMOOTHED(2, 4)) << 1) + ((SMOOTHED(-11, 8) < SMOOTHED(-15, 5)) << 0) ;
desc[1] = ((SMOOTHED(-6, -23) < SMOOTHED(8, -9)) << 7) + ((SMOOTHED(-12, 6) < SMOOTHED(-10, 8)) << 6) + ((SMOOTHED(-3, -1) < SMOOTHED(8, 1)) << 5) + ((SMOOTHED(3, 6) < SMOOTHED(5, 6)) << 4) + ((SMOOTHED(-7, -6) < SMOOTHED(5, -5)) << 3) + ((SMOOTHED(22, -2) < SMOOTHED(-11, -8)) << 2) + ((SMOOTHED(14, 7) < SMOOTHED(8, 5)) << 1) + ((SMOOTHED(-1, 14) < SMOOTHED(-5, -14)) << 0) ;
desc[2] = ((SMOOTHED(-14, 9) < SMOOTHED(2, 0)) << 7) + ((SMOOTHED(7, -3) < SMOOTHED(22, 6)) << 6) + ((SMOOTHED(-6, 6) < SMOOTHED(-8, -5)) << 5) + ((SMOOTHED(-5, 9) < SMOOTHED(7, -1)) << 4) + ((SMOOTHED(-3, -7) < SMOOTHED(-10, -18)) << 3) + ((SMOOTHED(4, -5) < SMOOTHED(0, 11)) << 2) + ((SMOOTHED(2, 3) < SMOOTHED(9, 10)) << 1) + ((SMOOTHED(-10, 3) < SMOOTHED(4, 9)) << 0) ;
desc[3] = ((SMOOTHED(0, 12) < SMOOTHED(-3, 19)) << 7) + ((SMOOTHED(1, 15) < SMOOTHED(-11, -5)) << 6) + ((SMOOTHED(14, -1) < SMOOTHED(7, 8)) << 5) + ((SMOOTHED(7, -23) < SMOOTHED(-5, 5)) << 4) + ((SMOOTHED(0, -6) < SMOOTHED(-10, 17)) << 3) + ((SMOOTHED(13, -4) < SMOOTHED(-3, -4)) << 2) + ((SMOOTHED(-12, 1) < SMOOTHED(-12, 2)) << 1) + ((SMOOTHED(0, 8) < SMOOTHED(3, 22)) << 0) ;
desc[4] = ((SMOOTHED(-13, 13) < SMOOTHED(3, -1)) << 7) + ((SMOOTHED(-16, 17) < SMOOTHED(6, 10)) << 6) + ((SMOOTHED(7, 15) < SMOOTHED(-5, 0)) << 5) + ((SMOOTHED(2, -12) < SMOOTHED(19, -2)) << 4) + ((SMOOTHED(3, -6) < SMOOTHED(-4, -15)) << 3) + ((SMOOTHED(8, 3) < SMOOTHED(0, 14)) << 2) + ((SMOOTHED(4, -11) < SMOOTHED(5, 5)) << 1) + ((SMOOTHED(11, -7) < SMOOTHED(7, 1)) << 0) ;
desc[5] = ((SMOOTHED(6, 12) < SMOOTHED(21, 3)) << 7) + ((SMOOTHED(-3, 2) < SMOOTHED(14, 1)) << 6) + ((SMOOTHED(5, 1) < SMOOTHED(-5, 11)) << 5) + ((SMOOTHED(3, -17) < SMOOTHED(-6, 2)) << 4) + ((SMOOTHED(6, 8) < SMOOTHED(5, -10)) << 3) + ((SMOOTHED(-14, -2) < SMOOTHED(0, 4)) << 2) + ((SMOOTHED(5, -7) < SMOOTHED(-6, 5)) << 1) + ((SMOOTHED(10, 4) < SMOOTHED(4, -7)) << 0) ;
desc[6] = ((SMOOTHED(22, 0) < SMOOTHED(7, -18)) << 7) + ((SMOOTHED(-1, -3) < SMOOTHED(0, 18)) << 6) + ((SMOOTHED(-4, 22) < SMOOTHED(-5, 3)) << 5) + ((SMOOTHED(1, -7) < SMOOTHED(2, -3)) << 4) + ((SMOOTHED(19, -20) < SMOOTHED(17, -2)) << 3) + ((SMOOTHED(3, -10) < SMOOTHED(-8, 24)) << 2) + ((SMOOTHED(-5, -14) < SMOOTHED(7, 5)) << 1) + ((SMOOTHED(-2, 12) < SMOOTHED(-4, -15)) << 0) ;
desc[7] = ((SMOOTHED(4, 12) < SMOOTHED(0, -19)) << 7) + ((SMOOTHED(20, 13) < SMOOTHED(3, 5)) << 6) + ((SMOOTHED(-8, -12) < SMOOTHED(5, 0)) << 5) + ((SMOOTHED(-5, 6) < SMOOTHED(-7, -11)) << 4) + ((SMOOTHED(6, -11) < SMOOTHED(-3, -22)) << 3) + ((SMOOTHED(15, 4) < SMOOTHED(10, 1)) << 2) + ((SMOOTHED(-7, -4) < SMOOTHED(15, -6)) << 1) + ((SMOOTHED(5, 10) < SMOOTHED(0, 24)) << 0) ;
desc[8] = ((SMOOTHED(3, 6) < SMOOTHED(22, -2)) << 7) + ((SMOOTHED(-13, 14) < SMOOTHED(4, -4)) << 6) + ((SMOOTHED(-13, 8) < SMOOTHED(-18, -22)) << 5) + ((SMOOTHED(-1, -1) < SMOOTHED(-7, 3)) << 4) + ((SMOOTHED(-19, -12) < SMOOTHED(4, 3)) << 3) + ((SMOOTHED(8, 10) < SMOOTHED(13, -2)) << 2) + ((SMOOTHED(-6, -1) < SMOOTHED(-6, -5)) << 1) + ((SMOOTHED(2, -21) < SMOOTHED(-3, 2)) << 0) ;
desc[9] = ((SMOOTHED(4, -7) < SMOOTHED(0, 16)) << 7) + ((SMOOTHED(-6, -5) < SMOOTHED(-12, -1)) << 6) + ((SMOOTHED(1, -1) < SMOOTHED(9, 18)) << 5) + ((SMOOTHED(-7, 10) < SMOOTHED(-11, 6)) << 4) + ((SMOOTHED(4, 3) < SMOOTHED(19, -7)) << 3) + ((SMOOTHED(-18, 5) < SMOOTHED(-4, 5)) << 2) + ((SMOOTHED(4, 0) < SMOOTHED(-20, 4)) << 1) + ((SMOOTHED(7, -11) < SMOOTHED(18, 12)) << 0) ;
desc[10] = ((SMOOTHED(-20, 17) < SMOOTHED(-18, 7)) << 7) + ((SMOOTHED(2, 15) < SMOOTHED(19, -11)) << 6) + ((SMOOTHED(-18, 6) < SMOOTHED(-7, 3)) << 5) + ((SMOOTHED(-4, 1) < SMOOTHED(-14, 13)) << 4) + ((SMOOTHED(17, 3) < SMOOTHED(2, -8)) << 3) + ((SMOOTHED(-7, 2) < SMOOTHED(1, 6)) << 2) + ((SMOOTHED(17, -9) < SMOOTHED(-2, 8)) << 1) + ((SMOOTHED(-8, -6) < SMOOTHED(-1, 12)) << 0) ;
desc[11] = ((SMOOTHED(-2, 4) < SMOOTHED(-1, 6)) << 7) + ((SMOOTHED(-2, 7) < SMOOTHED(6, 8)) << 6) + ((SMOOTHED(-8, -1) < SMOOTHED(-7, -9)) << 5) + ((SMOOTHED(8, -9) < SMOOTHED(15, 0)) << 4) + ((SMOOTHED(0, 22) < SMOOTHED(-4, -15)) << 3) + ((SMOOTHED(-14, -1) < SMOOTHED(3, -2)) << 2) + ((SMOOTHED(-7, -4) < SMOOTHED(17, -7)) << 1) + ((SMOOTHED(-8, -2) < SMOOTHED(9, -4)) << 0) ;
desc[12] = ((SMOOTHED(5, -7) < SMOOTHED(7, 7)) << 7) + ((SMOOTHED(-5, 13) < SMOOTHED(-8, 11)) << 6) + ((SMOOTHED(11, -4) < SMOOTHED(0, 8)) << 5) + ((SMOOTHED(5, -11) < SMOOTHED(-9, -6)) << 4) + ((SMOOTHED(2, -6) < SMOOTHED(3, -20)) << 3) + ((SMOOTHED(-6, 2) < SMOOTHED(6, 10)) << 2) + ((SMOOTHED(-6, -6) < SMOOTHED(-15, 7)) << 1) + ((SMOOTHED(-6, -3) < SMOOTHED(2, 1)) << 0) ;
desc[13] = ((SMOOTHED(11, 0) < SMOOTHED(-3, 2)) << 7) + ((SMOOTHED(7, -12) < SMOOTHED(14, 5)) << 6) + ((SMOOTHED(0, -7) < SMOOTHED(-1, -1)) << 5) + ((SMOOTHED(-16, 0) < SMOOTHED(6, 8)) << 4) + ((SMOOTHED(22, 11) < SMOOTHED(0, -3)) << 3) + ((SMOOTHED(19, 0) < SMOOTHED(5, -17)) << 2) + ((SMOOTHED(-23, -14) < SMOOTHED(-13, -19)) << 1) + ((SMOOTHED(-8, 10) < SMOOTHED(-11, -2)) << 0) ;
desc[14] = ((SMOOTHED(-11, 6) < SMOOTHED(-10, 13)) << 7) + ((SMOOTHED(1, -7) < SMOOTHED(14, 0)) << 6) + ((SMOOTHED(-12, 1) < SMOOTHED(-5, -5)) << 5) + ((SMOOTHED(4, 7) < SMOOTHED(8, -1)) << 4) + ((SMOOTHED(-1, -5) < SMOOTHED(15, 2)) << 3) + ((SMOOTHED(-3, -1) < SMOOTHED(7, -10)) << 2) + ((SMOOTHED(3, -6) < SMOOTHED(10, -18)) << 1) + ((SMOOTHED(-7, -13) < SMOOTHED(-13, 10)) << 0) ;
desc[15] = ((SMOOTHED(1, -1) < SMOOTHED(13, -10)) << 7) + ((SMOOTHED(-19, 14) < SMOOTHED(8, -14)) << 6) + ((SMOOTHED(-4, -13) < SMOOTHED(7, 1)) << 5) + ((SMOOTHED(1, -2) < SMOOTHED(12, -7)) << 4) + ((SMOOTHED(3, -5) < SMOOTHED(1, -5)) << 3) + ((SMOOTHED(-2, -2) < SMOOTHED(8, -10)) << 2) + ((SMOOTHED(2, 14) < SMOOTHED(8, 7)) << 1) + ((SMOOTHED(3, 9) < SMOOTHED(8, 2)) << 0) ;
#undef SMOOTHED
This diff is collapsed.
This diff is collapsed.
......@@ -485,6 +485,14 @@ Ptr<DescriptorMatcher> createDescriptorMatcher( const string& descriptorMatcherT
{
dm = new FlannBasedMatcher();
}
else if (!descriptorMatcherType.compare("BruteForce-Hamming"))
{
dm = new BruteForceMatcher<Hamming> ();
}
else if (!descriptorMatcherType.compare("BruteForce-HammingLUT"))
{
dm = new BruteForceMatcher<HammingLUT> ();
}
else
{
//CV_Error( CV_StsBadArg, "unsupported descriptor matcher type");
......
# x1 y1 x2 y2
-1 -2 -1 7
-1 -14 3 -3
-2 1 2 11
6 1 -7 -10
2 13 0 -1
5 -14 -3 5
8 -2 4 2
8 -11 5 -15
-23 -6 -9 8
6 -12 8 -10
-1 -3 1 8
6 3 6 5
-6 -7 -5 5
-2 22 -8 -11
7 14 5 8
14 -1 -14 -5
9 -14 0 2
-3 7 6 22
6 -6 -5 -8
9 -5 -1 7
-7 -3 -18 -10
-5 4 11 0
3 2 10 9
3 -10 9 4
12 0 19 -3
15 1 -5 -11
-1 14 8 7
-23 7 5 -5
-6 0 17 -10
-4 13 -4 -3
1 -12 2 -12
8 0 22 3
13 -13 -1 3
17 -16 10 6
15 7 0 -5
-12 2 -2 19
-6 3 -15 -4
3 8 14 0
-11 4 5 5
-7 11 1 7
12 6 3 21
2 -3 1 14
1 5 11 -5
-17 3 2 -6
8 6 -10 5
-2 -14 4 0
-7 5 5 -6
4 10 -7 4
0 22 -18 7
-3 -1 18 0
22 -4 3 -5
-7 1 -3 2
-20 19 -2 17
-10 3 24 -8
-14 -5 5 7
12 -2 -15 -4
12 4 -19 0
13 20 5 3
-12 -8 0 5
6 -5 -11 -7
-11 6 -22 -3
4 15 1 10
-4 -7 -6 15
10 5 24 0
6 3 -2 22
14 -13 -4 4
8 -13 -22 -18
-1 -1 3 -7
-12 -19 3 4
10 8 -2 13
-1 -6 -5 -6
-21 2 2 -3
-7 4 16 0
-5 -6 -1 -12
-1 1 18 9
10 -7 6 -11
3 4 -7 19
5 -18 5 -4
0 4 4 -20
-11 7 12 18
17 -20 7 -18
15 2 -11 19
6 -18 3 -7
1 -4 13 -14
3 17 -8 2
2 -7 6 1
-9 17 8 -2
-6 -8 12 -1
4 -2 6 -1
7 -2 8 6
-1 -8 -9 -7
-9 8 0 15
22 0 -15 -4
-1 -14 -2 3
-4 -7 -7 17
-2 -8 -4 9
-7 5 7 7
13 -5 11 -8
-4 11 8 0
-11 5 -6 -9
-6 2 -20 3
2 -6 10 6
-6 -6 7 -15
-3 -6 1 2
0 11 2 -3
-12 7 5 14
-7 0 -1 -1
0 -16 8 6
11 22 -3 0
0 19 -17 5
-14 -23 -19 -13
10 -8 -2 -11
6 -11 13 -10
-7 1 0 14
1 -12 -5 -5
7 4 -1 8
-5 -1 2 15
-1 -3 -10 7
-6 3 -18 10
-13 -7 10 -13
-1 1 -10 13
14 -19 -14 8
-13 -4 1 7
-2 1 -7 12
-5 3 -5 1
-2 -2 -10 8
14 2 7 8
9 3 2 8
1 -9 0 -18
0 4 12 1
9 0 -10 -14
-9 -13 6 -2
5 1 10 10
-6 -3 -5 -16
6 11 0 -5
10 -23 2 1
-5 13 9 -3
-1 -4 -5 -13
13 10 8 -11
20 19 2 -9
-8 4 -9 0
10 -14 19 15
-12 -14 -3 -10
-3 -23 -2 17
-11 -3 -14 6
-2 19 2 -4
5 -5 -13 3
-2 2 4 -5
4 17 -11 17
-2 -7 23 1
13 8 -16 1
-5 -13 -17 1
6 4 -3 -8
-9 -5 -10 -2
0 -9 -2 -7
0 5 2 5
-16 -4 3 6
-15 2 12 -2
-1 4 2 6
1 1 -8 -2
12 -2 -2 -5
8 -8 9 -9
-10 2 1 3
10 -4 4 -9
12 6 5 2
-8 -3 5 0
1 -13 2 -7
-10 -1 -18 7
8 -1 -10 -9
-1 -23 2 6
-3 -5 2 3
11 0 -7 -4
2 15 -3 -10
-8 -20 3 -13
-12 -19 -11 5
-13 -17 2 -3
4 7 0 -12
-1 5 -6 -14
11 -4 -4 0
10 3 -3 7
21 13 6 -11
24 -12 -4 -7
16 4 -14 3
5 -3 -12 -7
-4 0 -5 7
-9 -17 -7 13
-6 22 5 -11
-8 2 -11 23
-10 7 14 -1
-10 -3 3 8
1 -13 0 -6
-21 -7 -14 6
19 18 -6 -4
7 10 -4 -1
21 -1 -5 1
6 -10 -2 -11
-3 18 7 -1
-9 -3 10 -5
14 -13 -3 17
-19 11 -18 -1
-2 8 -23 -18
-5 0 -9 -2
-11 -4 -8 2
6 14 -6 -3
0 -3 0 -15
4 -9 -9 -15
11 -1 11 3
-16 -10 7 -7
-10 -2 -2 -10
-3 -5 -23 5
-8 13 -11 -15
11 -15 -6 6
-3 -16 2 -2
12 6 24 -16
0 -10 11 8
7 -7 -7 -19
16 5 -3 9
7 9 -16 -7
2 3 9 -10
1 21 7 8
0 7 17 1
12 -8 6 9
-7 11 -6 -8
0 19 3 9
-7 1 -11 -5
8 0 14 -2
-2 12 -6 -15
12 4 -21 0
-4 17 -7 -6
-9 -10 -7 -14
-10 -15 -14 -15
-5 -7 -12 5
0 -4 -4 15
2 5 -23 -6
-21 -4 4 -6
5 -10 6 -15
-3 4 5 -1
19 -4 -4 -23
17 -4 -11 13
12 1 -14 4
-6 -11 10 -20
5 4 20 3
-20 -8 1 3
9 -19 -3 9
15 18 -4 11
16 12 7 8
-8 -14 9 -3
0 -6 -4 2
-10 1 2 -1
-7 8 18 -6
12 9 -23 -7
-6 8 2 5
6 -9 -7 -12
-2 -1 2 -7
9 9 15 7
2 6 6 -6
12 16 19 0
3 4 0 6
-1 -2 17 2
1 8 1 3
-1 -12 0 -11
2 -11 9 7
3 -1 4 -19
-11 -1 3 -1
-10 1 -4 -10
3 -2 11 6
7 3 -8 -9
-14 24 -10 -2
-3 -3 -6 -18
-10 -13 -1 -7
-7 2 -6 9
-4 2 -13 6
-4 4 3 -2
2 -4 13 9
5 -11 -11 -6
-2 4 -9 11
0 -19 -5 -23
-7 -5 -6 -3
-4 -6 14 12
-11 12 -16 -8
15 -21 6 -12
-1 -2 16 -8
-1 6 -2 -8
-1 1 8 -9
-4 3 -2 -2
0 -7 -8 4
-11 11 2 -12
3 2 7 11
-4 -7 -6 -9
-7 3 0 -5
-7 3 -5 -10
-1 -3 -10 8
8 0 1 5
0 9 16 1
4 8 -3 -11
9 -15 17 8
2 0 17 -9
-11 -6 -3 -10
1 1 -8 15
-13 -12 4 -2
4 -6 -10 -6
-7 5 -5 7
6 10 9 8
7 -5 -3 -18
3 -6 4 5
-13 -10 -3 -5
2 -11 0 -16
-21 7 -13 -5
-14 -14 -4 -4
9 4 -3 7
11 4 -4 10
17 6 17 9
8 -10 -11 0
-16 -6 8 -6
5 -13 -5 10
2 3 16 12
-8 13 -6 0
0 10 -11 4
5 8 -2 10
-7 11 3 -13
4 2 -3 -7
-2 -14 16 -11
-6 11 6 7
15 -3 -10 8
8 -3 -12 12
6 -13 7 -14
-5 -11 -6 -8
-6 7 3 6
10 -4 1 5
16 9 13 10
10 -17 8 2
1 -5 -4 4
8 -14 2 -5
-9 4 -3 -6
-7 3 0 -10
-8 -2 4 -10
5 -8 24 -9
-8 2 -9 8
17 -4 2 -5
0 14 9 -9
15 11 5 -6
1 -8 4 -3
-21 9 2 10
-1 2 11 4
3 24 -2 2
17 -8 -10 -14
5 6 7 -13
10 11 -1 0
6 4 6 -10
-2 -12 6 5
-1 3 -15 8
-4 1 11 -7
11 1 0 5
-12 6 1 10
-2 -3 4 -1
-11 -2 12 -1
-8 7 -18 -20
0 2 2 -9
-1 -13 2 -16
-1 3 -17 -5
8 15 -14 3
-12 -13 15 6
-8 2 6 2
22 6 -23 -3
-7 -2 0 -6
-10 13 6 -6
7 6 12 -10
7 -6 11 -2
-22 0 -17 -2
-1 -4 -14 -11
-8 -2 12 7
-5 12 -13 7
-2 2 6 -7
8 0 23 -3
12 6 -11 13
-10 -21 8 10
0 -3 15 7
-6 7 -12 -5
-10 -21 -11 12
-11 -5 -11 8
0 5 -1 -11
-9 8 -1 7
-23 11 -5 21
-5 0 6 -8
8 -6 12 8
5 -7 -2 3
-20 -5 9 -12
12 -6 3 -11
5 4 11 13
12 2 -12 13
-13 -4 7 4
15 0 -16 -3
2 -3 14 -2
-14 4 -11 16
3 -13 10 23
-19 9 5 2
3 5 -7 14
-13 19 15 -11
0 14 -5 -2
-4 11 -6 0
5 -2 -8 -13
-15 -11 -17 -7
3 1 -8 -10
-10 -13 -12 7
-13 0 -6 23
-17 2 -3 -7
3 1 -10 4
4 13 -6 14
-2 -19 5 -1
-8 9 -5 10
-1 7 7 5
-10 9 0 19
5 7 -7 -4
1 -11 -11 -1
-1 2 11 -4
7 -1 -2 2
-20 1 -6 -9
-18 -4 -18 8
-2 -16 -6 7
-6 -3 -4 -1
-16 0 -5 24
-2 -4 9 -1
2 -8 15 -6
4 11 -3 0
6 7 -10 2
-9 -7 -6 12
15 24 -1 -8
-9 15 -15 -3
-5 17 -10 11
13 -2 4 -15
-1 -2 -23 4
3 -16 -14 -7
-5 -3 -9 -10
3 -5 -1 -2
4 -1 8 1
9 12 -14 9
17 -9 0 -3
4 5 -6 13
-8 -1 10 19
-5 8 2 -15
-9 -12 -5 -4
0 12 4 24
-2 8 4 14
-4 8 16 -7
-1 5 -4 -8
18 -2 17 -5
-2 8 -2 -9
-7 3 -6 1
-22 -5 -2 -5
-10 -8 1 14
-13 -3 9 3
-1 -4 0 -1
-21 -7 -19 12
8 -8 8 24
-6 12 3 -2
-11 -5 -4 -22
5 -3 4 -4
24 -16 -9 7
23 -10 18 -9
12 1 21 17
-6 24 -11 -3
17 -7 -6 1
4 4 -7 2
6 14 3 -12
0 -6 13 -16
5 -10 12 7
2 5 -3 6
0 7 1 -23
-5 15 14 1
-1 -3 6 6
-9 6 12 -9
-2 4 7 -4
-5 -4 4 4
0 -13 -10 6
-12 2 -3 -6
0 16 3 -3
-14 5 11 6
11 5 -13 0
5 7 -5 -1
4 12 10 6
4 -10 -11 -1
10 4 5 -14
-14 11 0 -13
8 2 24 12
3 -1 2 -1
-14 9 3 -23
-6 -8 9 0
14 -15 -10 10
-6 -10 -5 -7
5 11 -15 -3
0 1 8 1
-6 -11 -18 -4
0 9 -4 22
-1 -5 4 -9
2 -20 6 1
2 1 -12 -9
15 5 -6 4
4 19 11 4
-4 17 -1 -8
-12 -8 -3 7
9 11 1 8
22 9 15 -15
-7 -7 -23 1
13 -5 2 -8
-5 3 -11 11
-18 3 -5 14
7 -20 -23 -10
-5 -2 0 6
-13 -17 2 -3
-1 -6 -2 14
-16 -12 6 15
-2 -12 -19 3
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment