@@ -177,7 +177,7 @@ Class' interface is mainly based on the ones of classical detectors and extracto
177
177
Feature2d's @ref features2d_main and @ref features2d_match. Retrieved information about lines is
178
178
stored in line_descriptor::KeyLine objects.
179
179
*/
180
- class CV_EXPORTS BinaryDescriptor : public Algorithm
180
+ class CV_EXPORTS_W BinaryDescriptor : public Algorithm
181
181
{
182
182
183
183
public:
@@ -221,33 +221,33 @@ class CV_EXPORTS BinaryDescriptor : public Algorithm
221
221
/* * @brief Create a BinaryDescriptor object with default parameters (or with the ones provided)
222
222
and return a smart pointer to it
223
223
*/
224
- static Ptr<BinaryDescriptor> createBinaryDescriptor ();
224
+ CV_WRAP static Ptr<BinaryDescriptor> createBinaryDescriptor ();
225
225
static Ptr<BinaryDescriptor> createBinaryDescriptor ( Params parameters );
226
226
227
227
/* * destructor */
228
228
~BinaryDescriptor ();
229
229
230
230
/* * @brief Get current number of octaves
231
231
*/
232
- int getNumOfOctaves ();/* CV_WRAP */
232
+ CV_WRAP int getNumOfOctaves ();
233
233
/* * @brief Set number of octaves
234
234
@param octaves number of octaves
235
235
*/
236
- void setNumOfOctaves ( int octaves );/* CV_WRAP */
236
+ CV_WRAP void setNumOfOctaves ( int octaves );
237
237
/* * @brief Get current width of bands
238
238
*/
239
- int getWidthOfBand ();/* CV_WRAP */
239
+ CV_WRAP int getWidthOfBand ();
240
240
/* * @brief Set width of bands
241
241
@param width width of bands
242
242
*/
243
- void setWidthOfBand ( int width );/* CV_WRAP */
243
+ CV_WRAP void setWidthOfBand ( int width );
244
244
/* * @brief Get current reduction ratio (used in Gaussian pyramids)
245
245
*/
246
- int getReductionRatio ();/* CV_WRAP */
246
+ CV_WRAP int getReductionRatio ();
247
247
/* * @brief Set reduction ratio (used in Gaussian pyramids)
248
248
@param rRatio reduction ratio
249
249
*/
250
- void setReductionRatio ( int rRatio );
250
+ CV_WRAP void setReductionRatio ( int rRatio );
251
251
252
252
/* * @brief Read parameters from a FileNode object and store them
253
253
@@ -267,7 +267,7 @@ class CV_EXPORTS BinaryDescriptor : public Algorithm
267
267
@param keypoints vector that will store extracted lines for one or more images
268
268
@param mask mask matrix to detect only KeyLines of interest
269
269
*/
270
- void detect ( const Mat& image, CV_OUT std::vector<KeyLine>& keypoints, const Mat& mask = Mat() );
270
+ CV_WRAP void detect ( const Mat& image, CV_OUT std::vector<KeyLine>& keypoints, const Mat& mask = Mat() );
271
271
272
272
/* * @overload
273
273
@@ -285,7 +285,7 @@ class CV_EXPORTS BinaryDescriptor : public Algorithm
285
285
@param descriptors
286
286
@param returnFloatDescr flag (when set to true, original non-binary descriptors are returned)
287
287
*/
288
- void compute ( const Mat& image, CV_OUT CV_IN_OUT std::vector<KeyLine>& keylines, CV_OUT Mat& descriptors, bool returnFloatDescr = false ) 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 ;
289
289
290
290
/* * @overload
291
291
@@ -432,15 +432,15 @@ class CV_EXPORTS BinaryDescriptor : public Algorithm
432
432
433
433
typedef std::list<Pixel> PixelChain; // each edge is a pixel chain
434
434
435
- struct EDLineParam
435
+ struct CV_EXPORTS_W_SIMPLE EDLineParam
436
436
{
437
- int ksize;
438
- float sigma;
439
- float gradientThreshold;
440
- float anchorThreshold;
441
- int scanIntervals;
442
- int minLineLen;
443
- double lineFitErrThreshold;
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;
444
444
};
445
445
446
446
#define RELATIVE_ERROR_FACTOR 100.0
@@ -455,13 +455,19 @@ class CV_EXPORTS BinaryDescriptor : public Algorithm
455
455
* PS: The linking step of edge detection has a little bit difference with the Edge drawing algorithm
456
456
* described in the paper. The edge chain doesn't stop when the pixel direction is changed.
457
457
*/
458
- class EDLineDetector
458
+ class CV_EXPORTS_W EDLineDetector
459
459
{
460
460
public:
461
- EDLineDetector ();
462
- EDLineDetector ( EDLineParam param );
461
+ CV_WRAP EDLineDetector ();
462
+ CV_WRAP_AS (EDLineDetectorWithParams) EDLineDetector( EDLineParam param );
463
463
~EDLineDetector ();
464
464
465
+ /* * @brief Creates an EDLineDetector object, using smart pointers.
466
+ */
467
+ CV_WRAP static Ptr<EDLineDetector> createEDLineDetector ();
468
+
469
+
470
+ CV_WRAP_AS (createEDLineDetectorWithParams) static Ptr<EDLineDetector> createEDLineDetector (EDLineParam params);
465
471
/* extract edges from image
466
472
*image: In, gray image;
467
473
*edges: Out, store the edges, each edge is a pixel chain
@@ -477,7 +483,7 @@ class CV_EXPORTS BinaryDescriptor : public Algorithm
477
483
int EDline ( cv::Mat &image, LineChains &lines );
478
484
479
485
/* * extract line from image, and store them */
480
- int EDline ( cv::Mat &image );
486
+ CV_WRAP int EDline ( cv::Mat &image );
481
487
482
488
cv::Mat dxImg_; // store the dxImg;
483
489
@@ -892,13 +898,38 @@ the one used in *BinaryDescriptor* class, data associated to a line's extremes i
892
898
in octave it was extracted from, coincide. KeyLine's field *class_id* is used as an index to
893
899
indicate the order of extraction of a line inside a single octave.
894
900
*/
901
+ struct CV_EXPORTS_W_SIMPLE LSDParam
902
+ {
903
+ CV_PROP_RW double scale ;
904
+ CV_PROP_RW double sigma_scale;
905
+ CV_PROP_RW double quant;
906
+ CV_PROP_RW double ang_th;
907
+ CV_PROP_RW double log_eps;
908
+ CV_PROP_RW double density_th ;
909
+ CV_PROP_RW int n_bins ;
910
+
911
+
912
+ CV_WRAP LSDParam ():scale(0.8 ),
913
+ sigma_scale(0.6 ),
914
+ quant(2.0 ),
915
+ ang_th(22.5 ),
916
+ log_eps(0 ),
917
+ density_th(0.7 ),
918
+ n_bins(1024 ){}
919
+
920
+ };
921
+
895
922
class CV_EXPORTS_W LSDDetector : public Algorithm
896
923
{
897
924
public:
898
925
899
926
/* constructor */
900
- /* CV_WRAP*/
901
- LSDDetector ()
927
+ CV_WRAP LSDDetector () : params()
928
+ {
929
+ }
930
+ ;
931
+
932
+ CV_WRAP_AS (LSDDetectorWithParams) LSDDetector(LSDParam _params) : params(_params)
902
933
{
903
934
}
904
935
;
@@ -907,6 +938,10 @@ LSDDetector()
907
938
*/
908
939
CV_WRAP static Ptr<LSDDetector> createLSDDetector ();
909
940
941
+
942
+ CV_WRAP_AS (createLSDDetectorWithParams) static Ptr<LSDDetector> createLSDDetector (LSDParam params);
943
+
944
+
910
945
/* * @brief Detect lines inside an image.
911
946
912
947
@param image input image
@@ -936,6 +971,9 @@ void detectImpl( const Mat& imageSrc, std::vector<KeyLine>& keylines, int numOct
936
971
937
972
/* matrices for Gaussian pyramids */
938
973
std::vector<cv::Mat> gaussianPyrs;
974
+
975
+ /* parameters */
976
+ LSDParam params;
939
977
};
940
978
941
979
/* * @brief furnishes all functionalities for querying a dataset provided by user or internal to
@@ -976,7 +1014,7 @@ candidates \f$\mathcal{N}_i(\mathbf{q})\f$ is obtained. The union of sets
976
1014
of **q**. Then, last step of algorithm is computing the Hamming distance between **q** and each
977
1015
element in \f$\mathcal{N}(\mathbf{q})\f$, deleting the codes that are distant more that *r* from **q**.
978
1016
*/
979
- class CV_EXPORTS BinaryDescriptorMatcher : public Algorithm
1017
+ class CV_EXPORTS_W BinaryDescriptorMatcher : public Algorithm
980
1018
{
981
1019
982
1020
public:
@@ -988,7 +1026,7 @@ or from the one internal to class
988
1026
@param matches vector to host retrieved matches
989
1027
@param mask mask to select which input descriptors must be matched to one in dataset
990
1028
*/
991
- void match ( const Mat& queryDescriptors, const Mat& trainDescriptors, std::vector<DMatch>& matches, const Mat& mask = Mat() ) const ;
1029
+ CV_WRAP void match ( const Mat& queryDescriptors, const Mat& trainDescriptors, CV_OUT std::vector<DMatch>& matches, const Mat& mask = Mat() ) const ;
992
1030
993
1031
/* * @overload
994
1032
@param queryDescriptors query descriptors
@@ -997,7 +1035,7 @@ void match( const Mat& queryDescriptors, const Mat& trainDescriptors, std::vecto
997
1035
(the *i*-th mask in vector indicates whether each input query can be matched with descriptors in
998
1036
dataset relative to *i*-th image)
999
1037
*/
1000
- void match ( const Mat& queryDescriptors, std::vector<DMatch>& matches, const std::vector<Mat>& masks = std::vector<Mat>() );
1038
+ CV_WRAP_AS (matchQuery) void match ( const Mat& queryDescriptors, CV_OUT std::vector<DMatch>& matches, const std::vector<Mat>& masks = std::vector<Mat>() );
1001
1039
1002
1040
/* * @brief For every input query descriptor, retrieve the best *k* matching ones from a dataset provided from
1003
1041
user or from the one internal to class
@@ -1010,7 +1048,7 @@ user or from the one internal to class
1010
1048
@param compactResult flag to obtain a compact result (if true, a vector that doesn't contain any
1011
1049
matches for a given query is not inserted in final result)
1012
1050
*/
1013
- void knnMatch ( const Mat& queryDescriptors, const Mat& trainDescriptors, std::vector<std::vector<DMatch> >& matches, int k, const Mat& mask = Mat(),
1051
+ CV_WRAP void knnMatch ( const Mat& queryDescriptors, const Mat& trainDescriptors, CV_OUT std::vector<std::vector<DMatch> >& matches, int k, const Mat& mask = Mat(),
1014
1052
bool compactResult = false ) const ;
1015
1053
1016
1054
/* * @overload
@@ -1023,7 +1061,7 @@ dataset relative to *i*-th image)
1023
1061
@param compactResult flag to obtain a compact result (if true, a vector that doesn't contain any
1024
1062
matches for a given query is not inserted in final result)
1025
1063
*/
1026
- void knnMatch ( const Mat& queryDescriptors, std::vector<std::vector<DMatch> >& matches, int k, const std::vector<Mat>& masks = std::vector<Mat>(),
1064
+ 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>(),
1027
1065
bool compactResult = false );
1028
1066
1029
1067
/* * @brief For every input query descriptor, retrieve, from a dataset provided from user or from the one
@@ -1082,7 +1120,7 @@ void clear() CV_OVERRIDE;
1082
1120
1083
1121
The BinaryDescriptorMatcher constructed is able to store and manage 256-bits long entries.
1084
1122
*/
1085
- BinaryDescriptorMatcher ();
1123
+ CV_WRAP BinaryDescriptorMatcher ();
1086
1124
1087
1125
/* * destructor */
1088
1126
~BinaryDescriptorMatcher ()
@@ -1314,9 +1352,9 @@ int descrInDS;
1314
1352
-------------------------------------------------------------------------------------------- */
1315
1353
1316
1354
/* * struct for drawing options */
1317
- struct CV_EXPORTS DrawLinesMatchesFlags
1355
+ struct CV_EXPORTS_W_SIMPLE DrawLinesMatchesFlags
1318
1356
{
1319
- enum
1357
+ CV_PROP_RW enum
1320
1358
{
1321
1359
DEFAULT = 0 , // !< Output image matrix will be created (Mat::create),
1322
1360
// !< i.e. existing memory of output image may be reused.
@@ -1345,10 +1383,10 @@ NOT_DRAW_SINGLE_LINES = 2//!< Single keylines will not be drawn.
1345
1383
@note If both *matchColor* and *singleLineColor* are set to their default values, function draws
1346
1384
matched lines and line connecting them with same color
1347
1385
*/
1348
- CV_EXPORTS void drawLineMatches ( const Mat& img1, const std::vector<KeyLine>& keylines1, const Mat& img2, const std::vector<KeyLine>& keylines2,
1349
- const std::vector<DMatch>& matches1to2, Mat& outImg, const Scalar& matchColor = Scalar::all( -1 ),
1350
- const Scalar& singleLineColor = Scalar::all( -1 ), const std::vector<char>& matchesMask = std::vector<char>(),
1351
- int flags = DrawLinesMatchesFlags::DEFAULT );
1386
+ CV_EXPORTS_W void drawLineMatches ( const Mat& img1, const std::vector<KeyLine>& keylines1, const Mat& img2, const std::vector<KeyLine>& keylines2,
1387
+ const std::vector<DMatch>& matches1to2, CV_OUT Mat& outImg, const Scalar& matchColor = Scalar::all( -1 ),
1388
+ const Scalar& singleLineColor = Scalar::all( -1 ), const std::vector<char>& matchesMask = std::vector<char>(),
1389
+ int flags = DrawLinesMatchesFlags::DEFAULT );
1352
1390
1353
1391
/* * @brief Draws keylines.
1354
1392
@@ -1358,8 +1396,8 @@ CV_EXPORTS void drawLineMatches( const Mat& img1, const std::vector<KeyLine>& ke
1358
1396
@param color color of lines to be drawn (if set to defaul value, color is chosen randomly)
1359
1397
@param flags drawing flags
1360
1398
*/
1361
- CV_EXPORTS void drawKeylines ( const Mat& image, const std::vector<KeyLine>& keylines, Mat& outImage, const Scalar& color = Scalar::all( -1 ),
1362
- int flags = DrawLinesMatchesFlags::DEFAULT );
1399
+ CV_EXPORTS_W void drawKeylines ( const Mat& image, const std::vector<KeyLine>& keylines, CV_OUT Mat& outImage, const Scalar& color = Scalar::all( -1 ),
1400
+ int flags = DrawLinesMatchesFlags::DEFAULT );
1363
1401
1364
1402
// ! @}
1365
1403
0 commit comments