DLR-RM / BlenderProc

A procedural Blender pipeline for photorealistic training image generation
GNU General Public License v3.0
2.82k stars 451 forks source link

camera view is alway shifted #598

Closed Pengfeicc closed 2 years ago

Pengfeicc commented 2 years ago

hello guys, i have a problem with camera view, i have 10 camera poses, none of them are placed in the center of the whole dropping set image

can someone help to me?

poses = 0
while poses <10:
        # Sample location
        location = bproc.sampler.shell(center = [0, 0, 0],
                            radius_min = 0.8,
                            radius_max = 1.2,
                            elevation_min = 45,
                            elevation_max = 89) 
        poi = bproc.object.compute_poi(np.random.choice(sampled_bop_objs, size=10))
        rotation_matrix = bproc.camera.rotation_from_forward_vec(poi - location, inplane_rot=np.random.uniform(-0.7854, 0.7854))
        cam2world_matrix = bproc.math.build_transformation_mat(location, rotation_matrix)

        if bproc.camera.perform_obstacle_in_view_check(cam2world_matrix, {"min": 0.3}, bop_bvh_tree):
            bproc.camera.add_camera_pose(cam2world_matrix)
        poses += 1
themasterlink commented 2 years ago

Hey,

the only reason can be that your sampled_bop_objs are not all on the surface, maybe some fell down or are further apart and not visible. You could fix that if you remove the size=10 in the np.random.choice call.

Best, Max

LeroyChou commented 2 years ago

Another possibility is your setting of cx, cy in camera.json is not correct. cx/cy should be around half of your image width/height. And you'd better check these params from your real camera if you have.