fregu856 / 3DOD_thesis

3D Object Detection for Autonomous Driving in PyTorch, trained on the KITTI dataset.

Home Page:http://www.fregu856.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AttributeError: 'open3d.open3d.camera.PinholeCameraTrajectory' object has no attribute 'intrinsic'

tianchengdw opened this issue · comments

Hi,! I met an error when I used Open3D to visualize eval_seq result. And I wanna output the result as a Video. The following message is from terminal.

python visualization/visualize_eval_val_seq.py
PinholeCameraTrajectory read JSON failed: empty trajectory.
000000
Traceback (most recent call last):
File "visualization/visualize_eval_val_seq.py", line 802, in
img_lidar = lidar_img_creator.create_img(gt_bboxes + pred_bboxes + [pcd])
File "visualization/visualize_eval_val_seq.py", line 448, in create_img
vis.run()
File "visualization/visualize_eval_val_seq.py", line 422, in move_forward
ctr.convert_from_pinhole_camera_parameters(self.trajectory.intrinsic, self.trajectory.extrinsic[0])
AttributeError: 'open3d.open3d.camera.PinholeCameraTrajectory' object has no attribute 'intrinsic'

Any solution for this?

Regards,
Cheng

commented

@tianchengdw

I changed three parts of the code to work well
Here is my solution.

camera_trajectory.json

{
	"class_name" : "PinholeCameraTrajectory",
    "parameters": [
        {
        "extrinsic" :
            [
                    1.0,
                    0.0,
                    0.0,
                    0,
                    0.0,
                    0.866,
                    0.5,
                    0,
                    0.0,
                    -0.5,
                    0.866,
                    0,
                    0.0,
                    3.0,
                    5.0,
                    1
            ],
            "intrinsic" :
            {
                "height" : 1080,
                "intrinsic_matrix" : [ 935.30743608719376, 0, 0, 0, 935.30743608719376, 0, 959.5, 539.5, 1 ],
                "width" : 1920
            },
            "version_major" : 1,
            "version_minor" : 0
        }
    ]
}

visualization/visualize_eval_val_seq.py line 415~

def move_forward(self, vis):
        # this function is called within the Visualizer::run() loop.
        # the run loop calls the function, then re-renders the image.

        if self.counter < 2: # (the counter is for making sure the camera view has been changed before the img is captured)
            # set the camera view:
            ctr = vis.get_view_control()
            #ctr.convert_from_pinhole_camera_parameters(self.trajectory.parameters[0].intrinsic, self.trajectory.parameters[0].extrinsic[0])
            ctr.convert_from_pinhole_camera_parameters(self.trajectory.parameters[0])

            self.counter += 1
        else:
            # capture an image:
            img = vis.capture_screen_float_buffer()
            img = 255*np.asarray(img)
            img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
            img = img.astype(np.uint8)
            self.lidar_img = img

            # close the window:
            vis.destroy_window()

            self.counter = 0

        return False

Also, we need to rewrite line 806

    combined_img[-small_img_height:, int(((1920/2)-(small_img_width/2))):int(((1920/2)+(small_img_width/2)))] = small_img_with_bboxes