42
#ifndef __OPENCV_DESCRIPTOR_HPP__
43
#define __OPENCV_DESCRIPTOR_HPP__
49
#if defined _MSC_VER && _MSC_VER <= 1700
58
#include "opencv2/core/utility.hpp"
59
#include <opencv2/imgproc.hpp>
60
#include "opencv2/core.hpp"
63
typedef
uint64_t UINT64;
64
typedef
uint32_t UINT32;
65
typedef
uint16_t UINT16;
66
typedef
uint8_t UINT8;
69
#define UINT64_1 ((UINT64)0x01)
70
#define UINT32_1 ((UINT32)0x01)
74
namespace
line_descriptor
106
CV_PROP_RW
float
angle;
109
CV_PROP_RW
int
class_id;
112
CV_PROP_RW
int
octave;
120
CV_PROP_RW
float
response;
123
CV_PROP_RW
float
size;
126
CV_PROP_RW
float
startPointX;
127
CV_PROP_RW
float
startPointY;
128
CV_PROP_RW
float
endPointX;
129
CV_PROP_RW
float
endPointY;
132
CV_PROP_RW
float
sPointInOctaveX;
133
CV_PROP_RW
float
sPointInOctaveY;
134
CV_PROP_RW
float
ePointInOctaveX;
135
CV_PROP_RW
float
ePointInOctaveY;
138
CV_PROP_RW
float
lineLength;
141
CV_PROP_RW
int
numOfPixels;
146
return
Point2f(startPointX, startPointY);
152
return
Point2f(endPointX, endPointY);
158
return
Point2f(sPointInOctaveX, sPointInOctaveY);
164
return
Point2f(ePointInOctaveX, ePointInOctaveY);
232
CV_WRAP
int
getNumOfOctaves();
236
CV_WRAP
void
setNumOfOctaves(
int
octaves );
239
CV_WRAP
int
getWidthOfBand();
243
CV_WRAP
void
setWidthOfBand(
int
width );
246
CV_WRAP
int
getReductionRatio();
250
CV_WRAP
void
setReductionRatio(
int
rRatio );
270
CV_WRAP
void
detect(
const
Mat& image, CV_OUT std::vector<KeyLine>& keypoints,
const
Mat& mask =
Mat() );
278
void
detect(
const
std::vector<Mat>& images, std::vector<std::vector<KeyLine> >& keylines,
const
std::vector<Mat>& masks =
279
std::vector<Mat>() )
const;
288
CV_WRAP
void
compute(
const
Mat& image, CV_OUT CV_IN_OUT std::vector<KeyLine>& keylines, CV_OUT
Mat& descriptors,
bool
returnFloatDescr =
false
)
const;
297
void
compute(
const
std::vector<Mat>& images, std::vector<std::vector<KeyLine> >& keylines, std::vector<Mat>& descriptors,
bool
returnFloatDescr =
324
virtual
void
operator()( InputArray image, InputArray mask, CV_OUT std::vector<KeyLine>& keylines,
OutputArray
descriptors,
325
bool
useProvidedKeyLines =
false,
bool
returnFloatDescr =
false
)
const;
329
virtual
void
detectImpl(
const
Mat& imageSrc, std::vector<KeyLine>& keylines,
const
Mat& mask =
Mat() )
const;
332
virtual
void
computeImpl(
const
Mat& imageSrc, std::vector<KeyLine>& keylines,
Mat& descriptors,
bool
returnFloatDescr,
333
bool
useDetectionData )
const;
339
unsigned
int
octaveCount;
340
unsigned
int
lineIDInOctave;
341
unsigned
int
lineIDInScaleLineVec;
361
double
gradientMagnitude;
363
double
darkSideGrayValue;
365
double
lightSideGrayValue;
373
std::vector<double> descriptor;
377
typedef
std::vector<SingleLine> Lines_list;
379
struct
OctaveSingleLine
388
float
sPointInOctaveX;
389
float
sPointInOctaveY;
390
float
ePointInOctaveX;
391
float
ePointInOctaveY;
399
unsigned
int
numOfPixels;
401
unsigned
int
octaveCount;
403
std::vector<float> descriptor;
405
OctaveSingleLine() : startPointX(0), startPointY(0), endPointX(0), endPointY(0),
406
sPointInOctaveX(0), sPointInOctaveY(0), ePointInOctaveX(0), ePointInOctaveY(0),
407
direction(0), salience(0), lineLength(0), numOfPixels(0), octaveCount(0),
408
descriptor(std::vector<float>())
419
std::vector<unsigned int> xCors;
420
std::vector<unsigned int> yCors;
421
std::vector<unsigned int> sId;
422
unsigned
int
numOfEdges;
427
std::vector<unsigned int> xCors;
428
std::vector<unsigned int> yCors;
429
std::vector<unsigned int> sId;
430
unsigned
int
numOfLines;
433
typedef
std::list<Pixel> PixelChain;
435
struct
CV_EXPORTS_W_SIMPLE EDLineParam
437
CV_PROP_RW
int
ksize;
438
CV_PROP_RW
float
sigma;
439
CV_PROP_RW
float
gradientThreshold;
440
CV_PROP_RW
float
anchorThreshold;
441
CV_PROP_RW
int
scanIntervals;
442
CV_PROP_RW
int
minLineLen;
443
CV_PROP_RW
double
lineFitErrThreshold;
446
#define RELATIVE_ERROR_FACTOR 100.0
447
#define MLN10 2.30258509299404568402
448
#define log_gamma(x) ((x)>15.0?log_gamma_windschitl(x):log_gamma_lanczos(x))
458
class
CV_EXPORTS_W EDLineDetector
461
CV_WRAP EDLineDetector();
462
CV_WRAP_AS(EDLineDetectorWithParams) EDLineDetector( EDLineParam param );
467
CV_WRAP
static
Ptr<EDLineDetector> createEDLineDetector();
470
CV_WRAP_AS(createEDLineDetectorWithParams)
static
Ptr<EDLineDetector> createEDLineDetector(EDLineParam params);
476
int
EdgeDrawing(
cv::Mat
&image, EdgeChains &edgeChains );
483
int
EDline(
cv::Mat
&image, LineChains &lines );
486
CV_WRAP
int
EDline(
cv::Mat
&image );
497
std::vector<std::vector<double> > lineEquations_;
500
std::vector<std::vector<float> > lineEndpoints_;
503
std::vector<float> lineDirection_;
506
std::vector<float> lineSalience_;
509
unsigned
int
imageWidth;
510
unsigned
int
imageHeight;
515
double
lineFitErrThreshold_;
520
short
gradienThreshold_;
525
unsigned
char
anchorThreshold_;
530
unsigned
int
scanIntervals_;
544
double
LeastSquaresLineFit_(
unsigned
int
*xCors,
unsigned
int
*yCors,
unsigned
int
offsetS, std::vector<double> &lineEquation );
558
double
LeastSquaresLineFit_(
unsigned
int
*xCors,
unsigned
int
*yCors,
unsigned
int
offsetS,
unsigned
int
newOffsetS,
unsigned
int
offsetE,
559
std::vector<double> &lineEquation );
565
bool
LineValidation_(
unsigned
int
*xCors,
unsigned
int
*yCors,
unsigned
int
offsetS,
unsigned
int
offsetE, std::vector<double> &lineEquation,
587
unsigned
int
*pFirstPartEdgeX_;
590
unsigned
int
*pFirstPartEdgeY_;
593
unsigned
int
*pFirstPartEdgeS_;
596
unsigned
int
*pSecondPartEdgeX_;
599
unsigned
int
*pSecondPartEdgeY_;
602
unsigned
int
*pSecondPartEdgeS_;
605
unsigned
int
*pAnchorX_;
608
unsigned
int
*pAnchorY_;
634
typedef
std::vector<OctaveSingleLine> LinesVec;
638
typedef
std::vector<LinesVec> ScaleLines;
641
void
computeGaussianPyramid(
const
Mat& image,
const
int
numOctaves );
644
void
computeSobel(
const
Mat& image,
const
int
numOctaves );
647
unsigned
char
binaryConversion(
float* f1,
float* f2 );
650
int
computeLBD( ScaleLines &keyLines,
bool
useDetectionData =
false
);
654
int
OctaveKeyLines(
cv::Mat& image, ScaleLines &keyLines );
657std::vector<double> gaussCoefL_;
660std::vector<double> gaussCoefG_;
666std::vector<cv::Size> images_sizes;
672std::vector<Ptr<EDLineDetector> > edLineVec_;
675std::vector<cv::Mat> dxImg_vector, dyImg_vector;
678std::vector<cv::Mat> octaveImages;
701
CV_PROP_RW
double
scale ;
702
CV_PROP_RW
double
sigma_scale;
703
CV_PROP_RW
double
quant;
704
CV_PROP_RW
double
ang_th;
705
CV_PROP_RW
double
log_eps;
706
CV_PROP_RW
double
density_th ;
707
CV_PROP_RW
int
n_bins ;
751
CV_WRAP
void
detect(
const
Mat& image, CV_OUT std::vector<KeyLine>& keypoints,
int
scale,
int
numOctaves,
const
Mat& mask =
Mat() );
760
CV_WRAP
void
detect(
const
std::vector<Mat>& images, std::vector<std::vector<KeyLine> >& keylines,
int
scale,
int
numOctaves,
761
const
std::vector<Mat>& masks = std::vector<Mat>() )
const;
765
void
computeGaussianPyramid(
const
Mat& image,
int
numOctaves,
int
scale );
768
void
detectImpl(
const
Mat& imageSrc, std::vector<KeyLine>& keylines,
int
numOctaves,
int
scale,
const
Mat& mask )
const;
771std::vector<cv::Mat> gaussianPyrs;
827
CV_WRAP
void
match(
const
Mat& queryDescriptors,
const
Mat& trainDescriptors, CV_OUT std::vector<DMatch>& matches,
const
Mat& mask =
Mat() )
const;
836
CV_WRAP_AS(matchQuery)
void
match(
const
Mat& queryDescriptors, CV_OUT std::vector<DMatch>& matches,
const
std::vector<Mat>& masks = std::vector<Mat>() );
849
CV_WRAP
void
knnMatch(
const
Mat& queryDescriptors,
const
Mat& trainDescriptors, CV_OUT std::vector<std::vector<DMatch> >& matches,
int
k,
const
Mat& mask =
Mat(),
850
bool
compactResult =
false
)
const;
862
CV_WRAP_AS(knnMatchQuery)
void
knnMatch(
const
Mat& queryDescriptors, std::vector<std::vector<DMatch> >& matches,
int
k,
const
std::vector<Mat>& masks = std::vector<Mat>(),
863
bool
compactResult =
false
);
876
void
radiusMatch(
const
Mat& queryDescriptors,
const
Mat& trainDescriptors, std::vector<std::vector<DMatch> >& matches,
float
maxDistance,
877
const
Mat& mask =
Mat(),
bool
compactResult =
false
)
const;
889
void
radiusMatch(
const
Mat& queryDescriptors, std::vector<std::vector<DMatch> >& matches,
float
maxDistance,
const
std::vector<Mat>& masks =
891
bool
compactResult =
false
);
900
void
add(
const
std::vector<Mat>& descriptors );
934BucketGroup(
bool
needAllocateGroup =
true);
940
void
insert(
int
subindex, UINT32 data );
943UINT32* query(
int
subindex,
int
*size );
946
void
insert_value( std::vector<uint32_t>& vec,
int
index, UINT32 data );
947
void
push_value( std::vector<uint32_t>& vec, UINT32 Data );
951std::vector<uint32_t> group;
956
class
SparseHashtable
962
static
const
int
MAX_B;
965std::vector<BucketGroup> table;
979
void
insert( UINT64 index, UINT32 data );
982UINT32* query( UINT64 index,
int* size );
1009bitarray( UINT64 _bits )
1016
void
init( UINT64 _bits )
1020length = (UINT32) ceil( _bits / 32.00 );
1021arr =
new
UINT32[length];
1032
inline
void
flip( UINT64 index )
1034arr[index >> 5] ^= ( (UINT32) 0x01 ) << ( index % 32 );
1037
inline
void
set( UINT64 index )
1039arr[index >> 5] |= ( (UINT32) 0x01 ) << ( index % 32 );
1042
inline
UINT8 get( UINT64 index )
1044
return
( arr[index >> 5] & ( ( (UINT32) 0x01 ) << ( index % 32 ) ) ) != 0;
1050memset( arr, 0,
sizeof(UINT32) * length );
1090Ptr<bitarray> counter;
1093std::vector<SparseHashtable> H;
1096std::vector<UINT32> xornum;
1108Mihasher(
int
B,
int
m );
1114
void
populate(
cv::Mat
& codes, UINT32 N,
int
dim1codes );
1117
void
batchquery( UINT32 * results, UINT32 *numres,
const
cv::Mat
& q, UINT32 numq,
int
dim1queries );
1122
void
query( UINT32 * results, UINT32* numres, UINT8 *q, UINT64 * chunks, UINT32 * res );
1126
void
checkKDistances( UINT32 * numres,
int
k, std::vector<int>& k_distances,
int
row,
int
string_length )
const;
1132std::map<int, int> indexesMap;
1135Ptr<Mihasher> dataset;
1164NOT_DRAW_SINGLE_LINES = 2
1184
CV_EXPORTS_W
void
drawLineMatches(
const
Mat& img1,
const
std::vector<KeyLine>& keylines1,
const
Mat& img2,
const
std::vector<KeyLine>& keylines2,
1185
const
std::vector<DMatch>& matches1to2, CV_OUT
Mat& outImg,
const
Scalar& matchColor =
Scalar::all( -1 ),
1186
const
Scalar& singleLineColor =
Scalar::all( -1 ),
const
std::vector<char>& matchesMask = std::vector<char>(),
This type is very similar to InputArray except that it is used for input/output and output function p...
Definition:
mat.hpp:295
This is a base class for all more or less complex algorithms in OpenCV
Definition:
core.hpp:3091
File Storage Node class.
Definition:
persistence.hpp:482
XML/YAML/JSON file storage class that encapsulates all the information necessary for writing or readi...
Definition:
persistence.hpp:304
Template matrix class derived from Mat
Definition:
mat.hpp:2199
n-dimensional dense array class
Definition:
mat.hpp:802
static Scalar_< double > all(double v0)
returns a scalar with all elements set to v0
Class implements both functionalities for detection of lines and computation of their binary descript...
Definition:
line_descriptor/descriptor.hpp:181
void detect(const std::vector< Mat > &images, std::vector< std::vector< KeyLine > > &keylines, const std::vector< Mat > &masks=std::vector< Mat >()) const
void compute(const std::vector< Mat > &images, std::vector< std::vector< KeyLine > > &keylines, std::vector< Mat > &descriptors, bool returnFloatDescr=false) const
int descriptorType() const
Return data type
virtual void detectImpl(const Mat &imageSrc, std::vector< KeyLine > &keylines, const Mat &mask=Mat()) const
virtual void write(cv::FileStorage &fs) const CV_OVERRIDE
Store parameters to a FileStorage object
virtual void computeImpl(const Mat &imageSrc, std::vector< KeyLine > &keylines, Mat &descriptors, bool returnFloatDescr, bool useDetectionData) const
virtual void read(const cv::FileNode &fn) CV_OVERRIDE
Read parameters from a FileNode object and store them
BinaryDescriptor(const BinaryDescriptor::Params ¶meters=BinaryDescriptor::Params())
Constructor
int descriptorSize() const
Return descriptor size
virtual void operator()(InputArray image, InputArray mask, CV_OUT std::vector< KeyLine > &keylines, OutputArray descriptors, bool useProvidedKeyLines=false, bool returnFloatDescr=false) const
Define operator '()' to perform detection of KeyLines and computation of descriptors in a row.
furnishes all functionalities for querying a dataset provided by user or internal to class (that user...
Definition:
line_descriptor/descriptor.hpp:816
void add(const std::vector< Mat > &descriptors)
Store locally new descriptors to be inserted in dataset, without updating dataset.
void clear() CV_OVERRIDE
Clear dataset and internal data
void train()
Update dataset by inserting into it all descriptors that were stored locally by add function.
CV_WRAP_AS(knnMatchQuery) void knnMatch(const Mat &queryDescriptors
void radiusMatch(const Mat &queryDescriptors, std::vector< std::vector< DMatch > > &matches, float maxDistance, const std::vector< Mat > &masks=std::vector< Mat >(), bool compactResult=false)
CV_WRAP_AS(matchQuery) void match(const Mat &queryDescriptors
static Ptr< BinaryDescriptorMatcher > createBinaryDescriptorMatcher()
Create a BinaryDescriptorMatcher object and return a smart pointer to it.
void radiusMatch(const Mat &queryDescriptors, const Mat &trainDescriptors, std::vector< std::vector< DMatch > > &matches, float maxDistance, const Mat &mask=Mat(), bool compactResult=false) const
For every input query descriptor, retrieve, from a dataset provided from user or from the one interna...
Definition:
line_descriptor/descriptor.hpp:721
CV_EXPORTS_W void flip(InputArray src, OutputArray dst, int flipCode)
Flips a 2D array around vertical, horizontal, or both axes.
CV_EXPORTS CV_WRAP_AS(goodFeaturesToTrackWithQuality) void goodFeaturesToTrack(InputArray image
Same as above, but returns also quality measure of the detected corners.
CV_EXPORTS_W void drawLineMatches(const Mat &img1, const std::vector< KeyLine > &keylines1, const Mat &img2, const std::vector< KeyLine > &keylines2, const std::vector< DMatch > &matches1to2, CV_OUT Mat &outImg, const Scalar &matchColor=Scalar::all(-1), const Scalar &singleLineColor=Scalar::all(-1), const std::vector< char > &matchesMask=std::vector< char >(), int flags=DrawLinesMatchesFlags::DEFAULT)
Draws the found matches of keylines from two images.
CV_EXPORTS_W void drawKeylines(const Mat &image, const std::vector< KeyLine > &keylines, CV_OUT Mat &outImage, const Scalar &color=Scalar::all(-1), int flags=DrawLinesMatchesFlags::DEFAULT)
Draws keylines.
"black box" representation of the file storage associated with a file on disk.
Definition:
aruco.hpp:75
DualQuat< T > power(const DualQuat< T > &dq, const T t, QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT)
Definition:
dualquaternion.inl.hpp:358
Definition:
cvstd_wrapper.hpp:74
List of BinaryDescriptor parameters:
Definition:
line_descriptor/descriptor.hpp:187
int numOfOctave_
Definition:
line_descriptor/descriptor.hpp:193
int reductionRatio
Definition:
line_descriptor/descriptor.hpp:200
void write(FileStorage &fs) const
void read(const FileNode &fn)
int widthOfBand_
Definition:
line_descriptor/descriptor.hpp:197
Definition:
line_descriptor/descriptor.hpp:1154
@ DEFAULT
Definition:
line_descriptor/descriptor.hpp:1157
A class to represent a line
Definition:
line_descriptor/descriptor.hpp:103
Definition:
line_descriptor/descriptor.hpp:700