@@ -66,9 +66,13 @@ PYBIND11_MODULE(_pym3t_mod, m) {
66
66
.def (" AddViewer" , &Tracker::AddViewer)
67
67
.def (" AddDetector" , &Tracker::AddDetector)
68
68
.def (" AddOptimizer" , &Tracker::AddOptimizer)
69
+ .def (" ClearOptimizers" , &Tracker::ClearOptimizers)
69
70
.def_property (" name" , &Tracker::name, &Tracker::set_name)
70
71
.def_property (" n_corr_iterations" , &Tracker::n_corr_iterations, &Tracker::set_n_corr_iterations)
71
72
.def_property (" n_update_iterations" , &Tracker::n_update_iterations, &Tracker::set_n_update_iterations)
73
+ .def_property_readonly (" set_up" , &Tracker::set_up)
74
+ .def_property_readonly (" optimizers" , &Tracker::optimizer_ptrs)
75
+ .def_property_readonly (" modalities" , &Tracker::modality_ptrs)
72
76
;
73
77
74
78
// --------------------------//
@@ -119,25 +123,29 @@ PYBIND11_MODULE(_pym3t_mod, m) {
119
123
#ifdef PYM3T_WITH_REALSENSE
120
124
// RealSenseColorCamera
121
125
py::class_<RealSenseColorCamera, ColorCamera, std::shared_ptr<RealSenseColorCamera>>(m, " RealSenseColorCamera" )
126
+ .def (" SetUp" , &RealSenseColorCamera::SetUp)
122
127
.def (py::init<const std::string &, bool >(), " name" _a, " use_depth_as_world_frame" _a=false )
123
128
;
124
129
125
130
// RealSenseDepthCamera
126
131
py::class_<RealSenseDepthCamera, DepthCamera, std::shared_ptr<RealSenseDepthCamera>>(m, " RealSenseDepthCamera" )
132
+ .def (" SetUp" , &RealSenseDepthCamera::SetUp)
127
133
.def (py::init<const std::string &, bool >(), " name" _a, " use_color_as_world_frame" _a=true )
128
134
;
129
135
#endif
130
136
131
137
// DummyColorCamera
132
138
py::class_<DummyColorCamera, ColorCamera, std::shared_ptr<DummyColorCamera>>(m, " DummyColorCamera" )
133
139
.def (py::init<const std::string &>(), " name" _a)
140
+ .def (" SetUp" , &DummyColorCamera::SetUp)
134
141
.def_property (" image" , &Camera::image, &DummyColorCamera::set_image)
135
142
.def_property (" intrinsics" , &DummyColorCamera::get_intrinsics, &DummyColorCamera::set_intrinsics)
136
143
;
137
144
138
145
// DummyDepthCamera
139
146
py::class_<DummyDepthCamera, DepthCamera, std::shared_ptr<DummyDepthCamera>>(m, " DummyDepthCamera" )
140
147
.def (py::init<const std::string &, float >(), " name" _a, " depth_scale" _a=0.001 )
148
+ .def (" SetUp" , &DummyDepthCamera::SetUp)
141
149
.def_property (" image" , &Camera::image, &DummyDepthCamera::set_image)
142
150
.def_property (" intrinsics" , &DummyDepthCamera::get_intrinsics, &DummyDepthCamera::set_intrinsics)
143
151
.def_property (" depth_scale" , &DummyDepthCamera::depth_scale, &DummyDepthCamera::set_depth_scale)
@@ -148,6 +156,7 @@ PYBIND11_MODULE(_pym3t_mod, m) {
148
156
// RendererGeometry
149
157
py::class_<RendererGeometry, std::shared_ptr<RendererGeometry>>(m, " RendererGeometry" )
150
158
.def (py::init<const std::string &>(), " name" _a)
159
+ .def (" SetUp" , &RendererGeometry::SetUp)
151
160
.def (" AddBody" , &RendererGeometry::AddBody)
152
161
.def (" DeleteBody" , &RendererGeometry::DeleteBody)
153
162
.def (" ClearBodies" , &RendererGeometry::ClearBodies)
@@ -191,6 +200,7 @@ PYBIND11_MODULE(_pym3t_mod, m) {
191
200
py::class_<NormalDepthViewer, Viewer, std::shared_ptr<NormalDepthViewer>>(m, " NormalDepthViewer" )
192
201
.def (py::init<const std::string &, const std::shared_ptr<DepthCamera> &, const std::shared_ptr<RendererGeometry> &, float , float , float >(),
193
202
" name" _a, " depth_camera_ptr" _a, " renderer_geometry_ptr" _a, " min_depth" _a=0 .0f , " max_depth" _a=1 .0f , " opacity" _a=0 .5f )
203
+ .def (" SetUp" , &NormalDepthViewer::SetUp)
194
204
.def (" UpdateViewer" , &NormalDepthViewer::UpdateViewer, " save_index" _a)
195
205
.def (" set_opacity" , &NormalDepthViewer::set_opacity, " opacity" _a)
196
206
;
@@ -210,6 +220,7 @@ PYBIND11_MODULE(_pym3t_mod, m) {
210
220
py::class_<FocusedBasicDepthRenderer, FocusedDepthRenderer, std::shared_ptr<FocusedBasicDepthRenderer>>(m, " FocusedBasicDepthRenderer" )
211
221
.def (py::init<const std::string &, const std::shared_ptr<RendererGeometry> &, const std::shared_ptr<Camera> &, int , float , float >(),
212
222
" name" _a, " renderer_geometry_ptr" _a, " camera_ptr" _a, " image_size" _a=200 , " z_min" _a=0 .01f , " z_max" _a=5 .0f )
223
+ .def (" SetUp" , &FocusedBasicDepthRenderer::SetUp)
213
224
.def (" AddReferencedBody" , &FocusedBasicDepthRenderer::AddReferencedBody)
214
225
;
215
226
@@ -219,6 +230,7 @@ PYBIND11_MODULE(_pym3t_mod, m) {
219
230
" name" _a, " renderer_geometry_ptr" _a, " camera_ptr" _a, " id_type" _a=IDType::BODY, " image_size" _a=200 , " z_min" _a=0 .01f , " z_max" _a=5 .0f )
220
231
.def (py::init<const std::string &, const std::filesystem::path&, const std::shared_ptr<RendererGeometry> &, const std::shared_ptr<Camera>&>(),
221
232
" name" _a, " metafile_path" _a, " renderer_geometry_ptr" _a, " camera_ptr" _a)
233
+ .def (" SetUp" , &FocusedSilhouetteRenderer::SetUp)
222
234
.def (" AddReferencedBody" , &FocusedSilhouetteRenderer::AddReferencedBody)
223
235
;
224
236
@@ -230,6 +242,7 @@ PYBIND11_MODULE(_pym3t_mod, m) {
230
242
.def (py::init<const std::string &, const std::filesystem::path &, float , bool , bool , const Transform3fA &>(),
231
243
" name" _a, " geometry_path" _a, " geometry_unit_in_meter" _a, " geometry_counterclockwise" _a, " geometry_enable_culling" _a, " geometry2body_pose" _a)
232
244
.def (py::init<const std::string &, const std::filesystem::path &>(), " name" _a, " metafile_path" _a)
245
+ .def (" SetUp" , &Body::SetUp)
233
246
.def_property (" name" , &Body::name, &Body::set_name)
234
247
.def_property (" geometry_path" , &Body::geometry_path, &Body::set_geometry_path)
235
248
.def_property (" metafile_path" , &Body::metafile_path, &Body::set_metafile_path)
@@ -250,9 +263,11 @@ PYBIND11_MODULE(_pym3t_mod, m) {
250
263
" body2joint_pose" _a=Transform3fA::Identity (), " joint2parent_pose" _a=Transform3fA::Identity (), " link2world_pose" _a=Transform3fA::Identity (),
251
264
" free_directions" _a=std::array<bool , 6 >({true , true , true , true , true , true }), " fixed_body2joint_pose" _a=true )
252
265
.def (py::init<const std::string &, const std::filesystem::path &, const std::shared_ptr<Body> &>(), " name" _a, " metafile_path" _a, " body_ptr" _a)
266
+ .def (" SetUp" , &Link::SetUp)
253
267
.def (" AddModality" , &Link::AddModality)
254
268
.def (" CalculateGradientAndHessian" , &Link::CalculateGradientAndHessian)
255
269
.def_property (" name" , &Link::name, &Link::set_name)
270
+ .def_property (" body" , &Link::body_ptr, &Link::set_body_ptr)
256
271
.def_property (" link2world_pose" , &Link::link2world_pose, &Link::set_link2world_pose)
257
272
.def_property_readonly (" modalities" , &Link::modality_ptrs)
258
273
.def (" gradient" , &Link::gradient)
@@ -274,6 +289,7 @@ PYBIND11_MODULE(_pym3t_mod, m) {
274
289
275
290
// Detector
276
291
py::class_<Detector, PyDetector, std::shared_ptr<Detector>>(m, " Detector" )
292
+ .def (" SetUp" , &Detector::SetUp)
277
293
.def_property (" name" , &Detector::name, &Detector::set_name)
278
294
;
279
295
@@ -289,12 +305,27 @@ PYBIND11_MODULE(_pym3t_mod, m) {
289
305
290
306
// --------------------------//
291
307
308
+ // ColorHistograms
309
+ py::class_<ColorHistograms, std::shared_ptr<ColorHistograms>>(m, " ColorHistograms" )
310
+ .def (py::init<const std::string &, int , float , float >(),
311
+ " name" _a,
312
+ " n_bins" _a=16 , " learning_rate_f" _a=0 .2f , " learning_rate_b" _a=0 .2f )
313
+ .def (" SetUp" , &ColorHistograms::SetUp)
314
+ .def_property (" name" , &ColorHistograms::name, &ColorHistograms::set_name)
315
+ .def_property (" n_bins" , &ColorHistograms::n_bins, &ColorHistograms::set_n_bins)
316
+ .def_property (" learning_rate_f" , &ColorHistograms::learning_rate_f, &ColorHistograms::set_learning_rate_f)
317
+ .def_property (" learning_rate_b" , &ColorHistograms::learning_rate_b, &ColorHistograms::set_learning_rate_b)
318
+ ;
319
+
320
+ // --------------------------//
321
+
292
322
// RegionModel
293
323
py::class_<RegionModel, std::shared_ptr<RegionModel>>(m, " RegionModel" )
294
324
.def (py::init<const std::string &, const std::shared_ptr<Body> &, const std::filesystem::path &,
295
325
float , int , int , float , float , bool , int >(),
296
326
" name" _a, " body_ptr" _a, " model_path" _a,
297
327
" sphere_radius" _a=0 .8f , " n_divides" _a=4 , " n_points_max" _a=200 , " max_radius_depth_offset" _a=0 .05f , " stride_depth_offset" _a=0 .002f , " use_random_seed" _a=false , " image_size" _a=2000 )
328
+ .def (" SetUp" , &RegionModel::SetUp)
298
329
.def_property (" name" , &RegionModel::name, &RegionModel::set_name)
299
330
;
300
331
@@ -304,6 +335,7 @@ PYBIND11_MODULE(_pym3t_mod, m) {
304
335
float , int , int , float , float , bool , int >(),
305
336
" name" _a, " body_ptr" _a, " model_path" _a,
306
337
" sphere_radius" _a=0 .8f , " n_divides" _a=4 , " n_points_max" _a=200 , " max_radius_depth_offset" _a=0 .05f , " stride_depth_offset" _a=0 .002f , " use_random_seed" _a=false , " image_size" _a=2000 )
338
+ .def (" SetUp" , &DepthModel::SetUp)
307
339
.def_property (" name" , &DepthModel::name, &DepthModel::set_name)
308
340
;
309
341
@@ -335,6 +367,7 @@ PYBIND11_MODULE(_pym3t_mod, m) {
335
367
336
368
// Modality -> not constructible, just to enable automatic downcasting and binding of child classes
337
369
py::class_<Modality, PyModality, std::shared_ptr<Modality>>(m, " Modality" )
370
+ .def (" SetUp" , &Modality::SetUp)
338
371
.def_property_readonly (" gradient" , &Modality::gradient)
339
372
.def_property_readonly (" hessian" , &Modality::hessian)
340
373
.def_property (" name" , &Modality::name, &Modality::set_name)
@@ -344,6 +377,7 @@ PYBIND11_MODULE(_pym3t_mod, m) {
344
377
py::class_<RegionModality, Modality, std::shared_ptr<RegionModality>>(m, " RegionModality" )
345
378
.def (py::init<const std::string &, const std::shared_ptr<Body> &, const std::shared_ptr<ColorCamera> &, const std::shared_ptr<RegionModel> &>(),
346
379
" name" _a, " body_ptr" _a, " color_camera_ptr" _a, " region_model_ptr" _a)
380
+ .def (" SetUp" , &RegionModality::SetUp)
347
381
.def_property (" n_lines_max" , &RegionModality::n_lines_max, &RegionModality::set_n_lines_max)
348
382
.def_property (" use_adaptive_coverage" , &RegionModality::use_adaptive_coverage, &RegionModality::set_use_adaptive_coverage)
349
383
.def_property (" reference_contour_length" , &RegionModality::reference_contour_length, &RegionModality::set_reference_contour_length)
@@ -357,6 +391,9 @@ PYBIND11_MODULE(_pym3t_mod, m) {
357
391
.def_property (" scales" , &RegionModality::scales, &RegionModality::set_scales)
358
392
.def_property (" standard_deviations" , &RegionModality::standard_deviations, &RegionModality::set_standard_deviations)
359
393
394
+ .def (" UseSharedColorHistograms" , &RegionModality::UseSharedColorHistograms, " color_histograms_ptr" _a)
395
+ .def (" DoNotUseSharedColorHistograms" , &RegionModality::DoNotUseSharedColorHistograms)
396
+
360
397
.def_property (" n_histogram_bins" , &RegionModality::n_histogram_bins, &RegionModality::set_n_histogram_bins)
361
398
.def_property (" learning_rate_f" , &RegionModality::learning_rate_f, &RegionModality::set_learning_rate_f)
362
399
.def_property (" learning_rate_b" , &RegionModality::learning_rate_b, &RegionModality::set_learning_rate_b)
@@ -393,6 +430,7 @@ PYBIND11_MODULE(_pym3t_mod, m) {
393
430
py::class_<DepthModality, Modality, std::shared_ptr<DepthModality>>(m, " DepthModality" )
394
431
.def (py::init<const std::string &, const std::shared_ptr<Body> &, const std::shared_ptr<DepthCamera> &, const std::shared_ptr<DepthModel> &>(),
395
432
" name" _a, " body_ptr" _a, " depth_camera_ptr" _a, " depth_model_ptr" _a)
433
+ .def (" SetUp" , &DepthModality::SetUp)
396
434
397
435
.def_property (" n_points_max" , &DepthModality::n_points_max, &DepthModality::set_n_points_max)
398
436
.def_property (" use_adaptive_coverage" , &DepthModality::use_adaptive_coverage, &DepthModality::set_use_adaptive_coverage)
@@ -420,16 +458,64 @@ PYBIND11_MODULE(_pym3t_mod, m) {
420
458
.def_property (" visualize_points_result" , &DepthModality::visualize_points_result, &DepthModality::set_visualize_points_result)
421
459
;
422
460
461
+ py::enum_<TextureModality::DescriptorType>(m, " DescriptorType" )
462
+ .value (" BRISK" , TextureModality::DescriptorType::BRISK)
463
+ .value (" DAISY" , TextureModality::DescriptorType::DAISY)
464
+ .value (" FREAK" , TextureModality::DescriptorType::FREAK)
465
+ .value (" SIFT" , TextureModality::DescriptorType::SIFT)
466
+ .value (" ORB" , TextureModality::DescriptorType::ORB)
467
+ #ifdef USE_CUDA
468
+ .value (" ORB_CUDA" , TextureModality::DescriptorType::ORB_CUDA)
469
+ #endif
470
+ .export_values ();
471
+
423
472
424
473
// TextureModality
425
474
py::class_<TextureModality, Modality, std::shared_ptr<TextureModality>>(m, " TextureModality" )
426
475
.def (py::init<const std::string &, const std::shared_ptr<Body> &, const std::shared_ptr<ColorCamera> &, const std::shared_ptr<FocusedSilhouetteRenderer>&>(),
427
476
" name" _a, " body_ptr" _a, " color_camera_ptr" _a, " silhouette_renderer_ptr" _a)
428
477
.def (py::init<const std::string &, const std::filesystem::path &, const std::shared_ptr<Body> &, const std::shared_ptr<ColorCamera> &, const std::shared_ptr<FocusedSilhouetteRenderer>&>(),
429
478
" name" _a, " metafile_path" _a, " body_ptr" _a, " color_camera_ptr" _a, " silhouette_renderer_ptr" _a)
479
+ .def (" SetUp" , &TextureModality::SetUp)
430
480
431
481
.def (" ModelOcclusions" , &TextureModality::ModelOcclusions)
432
482
.def (" MeasureOcclusions" , &TextureModality::MeasureOcclusions)
483
+
484
+ .def_property (" descriptor_type" , &TextureModality::descriptor_type, &TextureModality::set_descriptor_type)
485
+ .def_property (" focused_image_size" , &TextureModality::focused_image_size, &TextureModality::set_focused_image_size)
486
+ .def_property (" descriptor_distance_threshold" , &TextureModality::descriptor_distance_threshold, &TextureModality::set_descriptor_distance_threshold)
487
+ .def_property (" tukey_norm_constant" , &TextureModality::tukey_norm_constant, &TextureModality::set_tukey_norm_constant)
488
+ .def_property (" standard_deviations" , &TextureModality::standard_deviations, &TextureModality::set_standard_deviations)
489
+ .def_property (" max_keyframe_rotation_difference" , &TextureModality::max_keyframe_rotation_difference, &TextureModality::set_max_keyframe_rotation_difference)
490
+ .def_property (" max_keyframe_age" , &TextureModality::max_keyframe_age, &TextureModality::set_max_keyframe_age)
491
+ .def_property (" n_keyframes" , &TextureModality::n_keyframes, &TextureModality::set_n_keyframes)
492
+
493
+ .def_property (" orb_n_features" , &TextureModality::orb_n_features, &TextureModality::set_orb_n_features)
494
+ .def_property (" orb_scale_factor" , &TextureModality::orb_scale_factor, &TextureModality::set_orb_scale_factor)
495
+ .def_property (" orb_n_levels" , &TextureModality::orb_n_levels, &TextureModality::set_orb_n_levels)
496
+ .def_property (" brisk_threshold" , &TextureModality::brisk_threshold, &TextureModality::set_brisk_threshold)
497
+ .def_property (" brisk_octave" , &TextureModality::brisk_octave, &TextureModality::set_brisk_octave)
498
+ .def_property (" brisk_pattern_scale" , &TextureModality::brisk_pattern_scale, &TextureModality::set_brisk_pattern_scale)
499
+ .def_property (" daisy_radius" , &TextureModality::daisy_radius, &TextureModality::set_daisy_radius)
500
+ .def_property (" daisy_q_radius" , &TextureModality::daisy_q_radius, &TextureModality::set_daisy_q_radius)
501
+ .def_property (" daisy_q_theta" , &TextureModality::daisy_q_theta, &TextureModality::set_daisy_q_theta)
502
+ .def_property (" daisy_q_hist" , &TextureModality::daisy_q_hist, &TextureModality::set_daisy_q_hist)
503
+ .def_property (" freak_orientation_normalized" , &TextureModality::freak_orientation_normalized, &TextureModality::set_freak_orientation_normalized)
504
+ .def_property (" freak_scale_normalized" , &TextureModality::freak_scale_normalized, &TextureModality::set_freak_scale_normalized)
505
+ .def_property (" freak_pattern_scale" , &TextureModality::freak_pattern_scale, &TextureModality::set_freak_pattern_scale)
506
+ .def_property (" freak_n_octaves" , &TextureModality::freak_n_octaves, &TextureModality::set_freak_n_octaves)
507
+ .def_property (" sift_n_features" , &TextureModality::sift_n_features, &TextureModality::set_sift_n_features)
508
+ .def_property (" sift_n_octave_layers" , &TextureModality::sift_n_octave_layers, &TextureModality::set_sift_n_octave_layers)
509
+ .def_property (" sift_contrast_threshold" , &TextureModality::sift_contrast_threshold, &TextureModality::set_sift_contrast_threshold)
510
+ .def_property (" sift_edge_threshold" , &TextureModality::sift_edge_threshold, &TextureModality::set_sift_edge_threshold)
511
+ .def_property (" sift_sigma" , &TextureModality::sift_sigma, &TextureModality::set_sift_sigma)
512
+
513
+ .def_property (" measured_occlusion_radius" , &TextureModality::measured_occlusion_radius, &TextureModality::set_measured_occlusion_radius)
514
+ .def_property (" measured_occlusion_threshold" , &TextureModality::measured_occlusion_threshold, &TextureModality::set_measured_occlusion_threshold)
515
+ .def_property (" modeled_occlusion_radius" , &TextureModality::modeled_occlusion_radius, &TextureModality::set_modeled_occlusion_radius)
516
+ .def_property (" modeled_occlusion_threshold" , &TextureModality::modeled_occlusion_threshold, &TextureModality::set_modeled_occlusion_threshold)
517
+
518
+
433
519
;
434
520
435
521
// Optimizer
@@ -441,6 +527,7 @@ PYBIND11_MODULE(_pym3t_mod, m) {
441
527
.def_property (" metafile_path" , &Optimizer::metafile_path, &Optimizer::set_metafile_path)
442
528
.def_property (" tikhonov_parameter_rotation" , &Optimizer::tikhonov_parameter_rotation, &Optimizer::set_tikhonov_parameter_rotation)
443
529
.def_property (" tikhonov_parameter_translation" , &Optimizer::tikhonov_parameter_translation, &Optimizer::set_tikhonov_parameter_translation)
530
+ .def_property_readonly (" root_link" , &Optimizer::root_link_ptr)
444
531
;
445
532
446
533
// Constants
0 commit comments