@@ -76,6 +76,7 @@ def homogeneous_no_scaling(object: bproc.types.MeshObject, frame=None):
76
76
localTworld = np .eye (4 )
77
77
localTworld [:3 , :3 ] = object .get_rotation_mat (frame )
78
78
localTworld [:3 , 3 ] = object .get_location (frame )
79
+ print ('LOCAL T WORLD = ' , localTworld )
79
80
return localTworld
80
81
81
82
def convert_to_visp_frame (aTb ):
@@ -84,7 +85,9 @@ def convert_to_visp_frame(aTb):
84
85
Blender: +X = Right, +Y = Up, +Z = Behind
85
86
Same as converting to an OpenCV frame
86
87
'''
87
- return bproc .math .change_source_coordinate_frame_of_transformation_matrix (aTb , ["X" , "-Y" , "-Z" ])
88
+ aTbbis = aTb .copy ()
89
+ aTbbis [1 :3 ] = - aTbbis [1 :3 ]
90
+ return aTbbis
88
91
89
92
def convert_points_to_visp_frame (points : np .ndarray ):
90
93
'''
@@ -339,6 +342,10 @@ def save_data(self, path: Path, objects: List[bproc.types.MeshObject], data: Dic
339
342
if out_object_pose :
340
343
worldTobj = homogeneous_no_scaling (object , frame )
341
344
camTobj = camTworld @ worldTobj
345
+ print ('WorldTObject: ' , worldTobj )
346
+ print ('camTObject: ' , camTobj )
347
+ print ('camTworld: ' , camTworld )
348
+
342
349
object_data ['cTo' ] = convert_to_visp_frame (camTobj )
343
350
if out_bounding_box :
344
351
bb_corners , z_front_proportion , points_im = bounding_box_2d_from_vertices (object , K , camTworld )
@@ -583,7 +590,7 @@ def create_target_objects(self) -> List[bproc.types.MeshObject]:
583
590
random_scale = np .random .uniform (- scale_noise , scale_noise ) + 1.0
584
591
object .set_scale ([random_scale , random_scale , random_scale ]) # Uniform scaling
585
592
object .set_location ([0.0 , 0.0 , 0.0 ])
586
- object .persist_transformation_into_mesh ()
593
+ object .persist_transformation_into_mesh (location = False , rotation = False , scale = True )
587
594
588
595
if displacement_amount > 0.0 :
589
596
add_displacement (objects , displacement_amount )
@@ -659,7 +666,8 @@ def sample_pose(obj: bproc.types.MeshObject):
659
666
)
660
667
661
668
for object in objects :
662
- object .persist_transformation_into_mesh ()
669
+ object .persist_transformation_into_mesh (location = False , rotation = False , scale = True )
670
+
663
671
664
672
distractors = self .create_distractors (size )
665
673
@@ -670,8 +678,7 @@ def sample_pose(obj: bproc.types.MeshObject):
670
678
object .enable_rigidbody (False , collision_shape = 'BOX' )
671
679
672
680
bproc .object .simulate_physics_and_fix_final_poses (min_simulation_time = 3 , max_simulation_time = 3.5 , check_object_interval = 1 )
673
- for object in objects :
674
- object .persist_transformation_into_mesh ()
681
+
675
682
def filter_objects_outside_room (objects : List [bproc .types .MeshObject ]) -> List [bproc .types .MeshObject ]:
676
683
inside = []
677
684
outside = []
@@ -787,5 +794,3 @@ def run(self):
787
794
bproc .init () # Works if you have a GPU
788
795
789
796
generator .run ()
790
-
791
-
0 commit comments