Closed yongguanjiangshan closed 1 year ago
@yongguanjiangshan Hi, I recommend you use "cv2.undistort" to rectify fisheye camera, because we use pinhole camera model in Pytorch3D.
@yongguanjiangshan Hi, I recommend you use "cv2.undistort" to rectify fisheye camera, because we use pinhole camera model in Pytorch3D.
OK, thank you very much! I will try it!
hi, sorry for bother again. I want to use our dataset, which are fisheye images. but the output seems bad. could you tell me what i need to consider if use fisheye images? below is my output image and dataset file. looking forward your suggestion, thank you!
output:
custom_dataset.py: ` import numpy as np import cv2 from multiprocessing.pool import ThreadPool as Pool from os import listdir from os.path import join, isfile from copy import deepcopy from datasets.base import BaseDataset from utils.plane_fit import robust_estimate_flatplane
class CustomDataset(BaseDataset): def init(self, configs): super().init() self.resized_image_size = (configs["image_width"], configs["image_height"]) self.label_dir = configs["label_dir"] self.image_dir = configs["image_dir"] self.pose_path = configs["poses_path"] self.sequence = configs["sequence"] camera_names = configs["camera_names"] # image_2 or image_3 self.choose_pt = [configs["choose_point"]["x"], configs["choose_point"]["y"]] x_offset = -configs["center_point"]["x"] + configs["bev_x_length"]/2 y_offset = -configs["center_point"]["y"] + configs["bev_y_length"]/2 self.intrinsic = np.asarray([ # need to modify here [3.1670000000e+02, 0.000000000000e+00, 4.8000000e+02], [0.000000000000e+00, 3.1670000000e+02, 2.7000000e+02], [0.000000000000e+00, 0.000000000000e+00, 1.000000000000e+00] ], dtype=np.float32) # image_2 self.transform_02 = np.asarray([[9.999758e-01, -5.267463e-03, -4.552439e-03, 5.956621e-02],
[5.251945e-03, 9.999804e-01, -3.413835e-03, 2.900141e-04], [4.570332e-03, 3.389843e-03, 9.999838e-01, 2.577209e-03], [0.0, 0.0, 0.0, 1.0]], dtype=np.float32) self.transform_03 = np.asarray([[9.995599e-01, 1.699522e-02, -2.431313e-02, -4.731050e-01], [-1.704422e-02, 9.998531e-01, -1.809756e-03, 5.551470e-03], [2.427880e-02, 2.223358e-03, 9.997028e-01, -5.250882e-03], [0.0, 0.0, 0.0, 1.0]], dtype=np.float32) self.transform_32 = np.linalg.inv(self.transform_03) @ self.transform_02 # need to check here self.extrinsic = np.eye(4) # only support image_2 now self.camera_extrinsics = [] self.d = 0 self.camera_height = 1.066
self.camera2chassis = np.asarray([ # need to check here need to know the dire of x, y, z axis
`