ethz-asl / kalibr

The Kalibr visual-inertial calibration toolbox
Other
4.39k stars 1.41k forks source link

Rosbag UnicodeDecodeError with D435i #419

Closed jukhang closed 3 years ago

jukhang commented 3 years ago

I record three topic with D435i,/infra_left, /infra_right, /color.Well, the "infra_left" and the "infra_right" is IR camera. "color" is the RGB camera。

infra_left and infra_right are not problem。But The RGB color is wrong.

UnicodeDecodeError: 'ascii' codec can't decode byte 0x84 in position 6: ordinal not in range(128)

terminal shell

kalibr_calibrate_cameras --target Workspace/kalibr/pril_6x6_A4.yaml --bag  Workspace/kalibr/multicameras_calibration.bag --models pinhole-equi pinhole-equi pinhole-equi --topics /infra_left /infra_right /color --bag-from-to 10 250 --show-extraction

Result

importing libraries
Initializing cam0:
    Camera model:     pinhole-equi
    Dataset:          Workspace/kalibr/multicameras_calibration.bag
    Topic:            /infra_left
[ WARN] [1614305103.291629]: BagImageDatasetReader: truncated 1200 / 2099 images.
    Number of images: 899
Extracting calibration target corners
  Extracted corners for 856 images (of 899 images)
    Projection initialized to: [ 368.56031692  368.71679395  320.76990869  243.65294828]
    Distortion initialized to: [ 0.25590242  0.564951   -1.12014092  0.99070065]
Initializing cam1:
    Camera model:     pinhole-equi
    Dataset:          Workspace/kalibr/multicameras_calibration.bag
    Topic:            /infra_right
[ WARN] [1614305693.668690]: BagImageDatasetReader: truncated 1199 / 2098 images.
    Number of images: 899
Extracting calibration target corners
  Extracted corners for 893 images (of 899 images)
    Projection initialized to: [ 368.98189974  369.3260945   323.98954495  243.78849673]
    Distortion initialized to: [ 0.25799118  0.48332864 -0.84993938  0.84299661]
Initializing cam2:
    Camera model:     pinhole-equi
    Dataset:          Workspace/kalibr/multicameras_calibration.bag
    Topic:            /color
[ WARN] [1614306445.607304]: BagImageDatasetReader: truncated 1199 / 2098 images.
    Number of images: 899
Extracting calibration target corners
Traceback (most recent call last):
  File "/home/ubuntu/kalibr_ws/devel/bin/kalibr_calibrate_cameras", line 15, in <module>
    exec(compile(fh.read(), python_script, 'exec'), context)
  File "/home/ubuntu/kalibr_ws/src/kalibr/aslam_offline_calibration/kalibr/python/kalibr_calibrate_cameras", line 447, in <module>
    main()
  File "/home/ubuntu/kalibr_ws/src/kalibr/aslam_offline_calibration/kalibr/python/kalibr_calibrate_cameras", line 178, in main
    noTransformation=True)
  File "/home/ubuntu/kalibr_ws/src/kalibr/aslam_offline_calibration/kalibr/python/kalibr_common/TargetExtractor.py", line 87, in extractCornersFromDataset
    for timestamp, image in dataset.readDataset():
  File "/home/ubuntu/kalibr_ws/src/kalibr/aslam_offline_calibration/kalibr/python/kalibr_common/ImageDatasetReader.py", line 25, in next
    return self.dataset.getImage(idx)
  File "/home/ubuntu/kalibr_ws/src/kalibr/aslam_offline_calibration/kalibr/python/kalibr_common/ImageDatasetReader.py", line 141, in getImage
    img_data = np.array(self.CVB.imgmsg_to_cv2(data))
  File "/home/ubuntu/meta_ws/src/vision_opencv/cv_bridge/python/cv_bridge/core.py", line 172, in imgmsg_to_cv2
    dtype=dtype, buffer=img_msg.data.encode())
**UnicodeDecodeError: 'ascii' codec can't decode byte 0x84 in position 6: ordinal not in range(128)**
jukhang commented 3 years ago

/home/ubuntu/meta_ws/src/vision_opencv/cv_bridge/python/cv_bridge/core.py

171 line:

dtype=dtype, buffer=img_msg.data.encode())

to

dtype=dtype, buffer=img_msg.data)

lanzipoi commented 3 years ago

Hello, I would like to ask how to calibrate the IR camera with kalibr, why I was prompted that the corner points cannot be extracted, and after unpacking, the depth image is pure blue after pseudo-color rendering