@@ -60,27 +60,27 @@ namespace linemod {
60
60
/* *
61
61
* \brief Discriminant feature described by its location and label.
62
62
*/
63
- struct CV_EXPORTS Feature
63
+ struct CV_EXPORTS_W_SIMPLE Feature
64
64
{
65
- int x; // /< x offset
66
- int y; // /< y offset
67
- int label; // /< Quantization
65
+ CV_PROP_RW int x; // /< x offset
66
+ CV_PROP_RW int y; // /< y offset
67
+ CV_PROP_RW int label; // /< Quantization
68
68
69
- Feature () : x(0 ), y(0 ), label(0 ) {}
70
- Feature (int x, int y, int label);
69
+ CV_WRAP Feature () : x(0 ), y(0 ), label(0 ) {}
70
+ CV_WRAP Feature (int x, int y, int label);
71
71
72
72
void read (const FileNode& fn);
73
73
void write (FileStorage& fs) const ;
74
74
};
75
75
76
76
inline Feature::Feature (int _x, int _y, int _label) : x(_x), y(_y), label(_label) {}
77
77
78
- struct CV_EXPORTS Template
78
+ struct CV_EXPORTS_W_SIMPLE Template
79
79
{
80
- int width;
81
- int height;
82
- int pyramid_level;
83
- std::vector<Feature> features;
80
+ CV_PROP int width;
81
+ CV_PROP int height;
82
+ CV_PROP int pyramid_level;
83
+ CV_PROP std::vector<Feature> features;
84
84
85
85
void read (const FileNode& fn);
86
86
void write (FileStorage& fs) const ;
@@ -89,7 +89,7 @@ struct CV_EXPORTS Template
89
89
/* *
90
90
* \brief Represents a modality operating over an image pyramid.
91
91
*/
92
- class QuantizedPyramid
92
+ class CV_EXPORTS_W QuantizedPyramid
93
93
{
94
94
public:
95
95
// Virtual destructor
@@ -101,21 +101,21 @@ class QuantizedPyramid
101
101
* \param[out] dst The destination 8-bit image. For each pixel at most one bit is set,
102
102
* representing its classification.
103
103
*/
104
- virtual void quantize (Mat& dst) const =0;
104
+ CV_WRAP virtual void quantize (CV_OUT Mat& dst) const =0;
105
105
106
106
/* *
107
107
* \brief Extract most discriminant features at current pyramid level to form a new template.
108
108
*
109
109
* \param[out] templ The new template.
110
110
*/
111
- virtual bool extractTemplate (Template& templ) const =0;
111
+ CV_WRAP virtual bool extractTemplate (CV_OUT Template& templ) const =0;
112
112
113
113
/* *
114
114
* \brief Go to the next pyramid level.
115
115
*
116
116
* \todo Allow pyramid scale factor other than 2
117
117
*/
118
- virtual void pyrDown () =0;
118
+ CV_WRAP virtual void pyrDown () =0;
119
119
120
120
protected:
121
121
// / Candidate feature with a score
@@ -153,7 +153,7 @@ inline QuantizedPyramid::Candidate::Candidate(int x, int y, int label, float _sc
153
153
*
154
154
* \todo Max response, to allow optimization of summing (255/MAX) features as uint8
155
155
*/
156
- class CV_EXPORTS Modality
156
+ class CV_EXPORTS_W Modality
157
157
{
158
158
public:
159
159
// Virtual destructor
@@ -166,15 +166,15 @@ class CV_EXPORTS Modality
166
166
* \param[in] mask Optional mask. If not empty, unmasked pixels are set to zero
167
167
* in quantized image and cannot be extracted as features.
168
168
*/
169
- Ptr<QuantizedPyramid> process (const Mat& src,
169
+ CV_WRAP Ptr<QuantizedPyramid> process (const Mat& src,
170
170
const Mat& mask = Mat()) const
171
171
{
172
172
return processImpl (src, mask);
173
173
}
174
174
175
- virtual String name () const =0;
175
+ CV_WRAP virtual String name () const =0;
176
176
177
- virtual void read (const FileNode& fn) =0;
177
+ CV_WRAP virtual void read (const FileNode& fn) =0;
178
178
virtual void write (FileStorage& fs) const =0;
179
179
180
180
/* *
@@ -184,12 +184,12 @@ class CV_EXPORTS Modality
184
184
* - "ColorGradient"
185
185
* - "DepthNormal"
186
186
*/
187
- static Ptr<Modality> create (const String& modality_type);
187
+ CV_WRAP static Ptr<Modality> create (const String& modality_type);
188
188
189
189
/* *
190
190
* \brief Load a modality from file.
191
191
*/
192
- static Ptr<Modality> create (const FileNode& fn);
192
+ CV_WRAP static Ptr<Modality> create (const FileNode& fn);
193
193
194
194
protected:
195
195
// Indirection is because process() has a default parameter.
@@ -274,18 +274,18 @@ class CV_EXPORTS DepthNormal : public Modality
274
274
/* *
275
275
* \brief Debug function to colormap a quantized image for viewing.
276
276
*/
277
- void colormap (const Mat& quantized, Mat& dst);
277
+ CV_EXPORTS_W void colormap (const Mat& quantized, CV_OUT Mat& dst);
278
278
279
279
/* *
280
280
* \brief Represents a successful template match.
281
281
*/
282
- struct CV_EXPORTS Match
282
+ struct CV_EXPORTS_W_SIMPLE Match
283
283
{
284
- Match ()
284
+ CV_WRAP Match ()
285
285
{
286
286
}
287
287
288
- Match (int x, int y, float similarity, const String& class_id, int template_id);
288
+ CV_WRAP Match (int x, int y, float similarity, const String& class_id, int template_id);
289
289
290
290
// / Sort matches with high similarity to the front
291
291
bool operator <(const Match& rhs) const
@@ -302,11 +302,11 @@ struct CV_EXPORTS Match
302
302
return x == rhs.x && y == rhs.y && similarity == rhs.similarity && class_id == rhs.class_id ;
303
303
}
304
304
305
- int x;
306
- int y;
307
- float similarity;
308
- String class_id;
309
- int template_id;
305
+ CV_PROP_RW int x;
306
+ CV_PROP_RW int y;
307
+ CV_PROP_RW float similarity;
308
+ CV_PROP_RW String class_id;
309
+ CV_PROP_RW int template_id;
310
310
};
311
311
312
312
inline
@@ -318,13 +318,13 @@ Match::Match(int _x, int _y, float _similarity, const String& _class_id, int _te
318
318
* \brief Object detector using the LINE template matching algorithm with any set of
319
319
* modalities.
320
320
*/
321
- class CV_EXPORTS Detector
321
+ class CV_EXPORTS_W Detector
322
322
{
323
323
public:
324
324
/* *
325
325
* \brief Empty constructor, initialize with read().
326
326
*/
327
- Detector ();
327
+ CV_WRAP Detector ();
328
328
329
329
/* *
330
330
* \brief Constructor.
@@ -333,7 +333,7 @@ class CV_EXPORTS Detector
333
333
* \param T_pyramid Value of the sampling step T at each pyramid level. The
334
334
* number of pyramid levels is T_pyramid.size().
335
335
*/
336
- Detector (const std::vector< Ptr<Modality> >& modalities, const std::vector<int >& T_pyramid);
336
+ CV_WRAP Detector (const std::vector< Ptr<Modality> >& modalities, const std::vector<int >& T_pyramid);
337
337
338
338
/* *
339
339
* \brief Detect objects by template matching.
@@ -350,7 +350,7 @@ class CV_EXPORTS Detector
350
350
* the same size as sources. Each element must be
351
351
* empty or the same size as its corresponding source.
352
352
*/
353
- void match (const std::vector<Mat>& sources, float threshold, std::vector<Match>& matches,
353
+ CV_WRAP void match (const std::vector<Mat>& sources, float threshold, CV_OUT std::vector<Match>& matches,
354
354
const std::vector<String>& class_ids = std::vector<String>(),
355
355
OutputArrayOfArrays quantized_images = noArray(),
356
356
const std::vector<Mat>& masks = std::vector<Mat>()) const ;
@@ -365,55 +365,55 @@ class CV_EXPORTS Detector
365
365
*
366
366
* \return Template ID, or -1 if failed to extract a valid template.
367
367
*/
368
- int addTemplate (const std::vector<Mat>& sources, const String& class_id,
369
- const Mat& object_mask, Rect* bounding_box = NULL );
368
+ CV_WRAP int addTemplate (const std::vector<Mat>& sources, const String& class_id,
369
+ const Mat& object_mask, CV_OUT Rect* bounding_box = NULL );
370
370
371
371
/* *
372
372
* \brief Add a new object template computed by external means.
373
373
*/
374
- int addSyntheticTemplate (const std::vector<Template>& templates, const String& class_id);
374
+ CV_WRAP int addSyntheticTemplate (const std::vector<Template>& templates, const String& class_id);
375
375
376
376
/* *
377
377
* \brief Get the modalities used by this detector.
378
378
*
379
379
* You are not permitted to add/remove modalities, but you may dynamic_cast them to
380
380
* tweak parameters.
381
381
*/
382
- const std::vector< Ptr<Modality> >& getModalities () const { return modalities; }
382
+ CV_WRAP const std::vector< Ptr<Modality> >& getModalities () const { return modalities; }
383
383
384
384
/* *
385
385
* \brief Get sampling step T at pyramid_level.
386
386
*/
387
- int getT (int pyramid_level) const { return T_at_level[pyramid_level]; }
387
+ CV_WRAP int getT (int pyramid_level) const { return T_at_level[pyramid_level]; }
388
388
389
389
/* *
390
390
* \brief Get number of pyramid levels used by this detector.
391
391
*/
392
- int pyramidLevels () const { return pyramid_levels; }
392
+ CV_WRAP int pyramidLevels () const { return pyramid_levels; }
393
393
394
394
/* *
395
395
* \brief Get the template pyramid identified by template_id.
396
396
*
397
397
* For example, with 2 modalities (Gradient, Normal) and two pyramid levels
398
398
* (L0, L1), the order is (GradientL0, NormalL0, GradientL1, NormalL1).
399
399
*/
400
- const std::vector<Template>& getTemplates (const String& class_id, int template_id) const ;
400
+ CV_WRAP const std::vector<Template>& getTemplates (const String& class_id, int template_id) const ;
401
401
402
- int numTemplates () const ;
403
- int numTemplates (const String& class_id) const ;
404
- int numClasses () const { return static_cast <int >(class_templates.size ()); }
402
+ CV_WRAP int numTemplates () const ;
403
+ CV_WRAP int numTemplates (const String& class_id) const ;
404
+ CV_WRAP int numClasses () const { return static_cast <int >(class_templates.size ()); }
405
405
406
- std::vector<String> classIds () const ;
406
+ CV_WRAP std::vector<String> classIds () const ;
407
407
408
- void read (const FileNode& fn);
408
+ CV_WRAP void read (const FileNode& fn);
409
409
void write (FileStorage& fs) const ;
410
410
411
411
String readClass (const FileNode& fn, const String &class_id_override = " " );
412
412
void writeClass (const String& class_id, FileStorage& fs) const ;
413
413
414
- void readClasses (const std::vector<String>& class_ids,
414
+ CV_WRAP void readClasses (const std::vector<String>& class_ids,
415
415
const String& format = " templates_%s.yml.gz" );
416
- void writeClasses (const String& format = " templates_%s.yml.gz" ) const ;
416
+ CV_WRAP void writeClasses (const String& format = " templates_%s.yml.gz" ) const ;
417
417
418
418
protected:
419
419
std::vector< Ptr<Modality> > modalities;
@@ -440,15 +440,15 @@ class CV_EXPORTS Detector
440
440
*
441
441
* Default parameter settings suitable for VGA images.
442
442
*/
443
- CV_EXPORTS Ptr<Detector> getDefaultLINE ();
443
+ CV_EXPORTS_W Ptr<linemod:: Detector> getDefaultLINE ();
444
444
445
445
/* *
446
446
* \brief Factory function for detector using LINE-MOD algorithm with color gradients
447
447
* and depth normals.
448
448
*
449
449
* Default parameter settings suitable for VGA images.
450
450
*/
451
- CV_EXPORTS Ptr<Detector> getDefaultLINEMOD ();
451
+ CV_EXPORTS_W Ptr<linemod:: Detector> getDefaultLINEMOD ();
452
452
453
453
// ! @}
454
454
0 commit comments