carla-simulator / carla

Open-source simulator for autonomous driving research.
http://carla.org
MIT License
11.36k stars 3.69k forks source link

Lens distortion attributes #3130

Open ffabi opened 4 years ago

ffabi commented 4 years ago

Can you help me find the correlation between the lens distortion attributes defined in Carla and radial/tangential distortion coefficients?

OpenCV documentation defines k1-k6 for radial distortion and p1, p2 for tangential distortion: https://docs.opencv.org/2.4/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.html

I would like to define these values, can you help me calculate the attributes needed for Carla camera sensor? Can you provide a more detailed description of these values?

Maybe lens_k = k1 and lens_kcube = k2 ?

I could not find these Carla attributes in Unreal engine documentation either.

germanros1987 commented 4 years ago

@marcgpuig which model did you follow to implement the lens distortion?

ffabi commented 4 years ago

For a while, pinhole camera model was sufficient for me, but I would like to generate images with a given radial and tangential distortion according to the Brown–Conrady model. I would like to mimic a real-world sensor which has defined k1, k2, p1, p2, k3 parameters.

germanros1987 commented 4 years ago

@marcgpuig are we using the Brown–Conrady model to create the lens distortion?

jerryliu20001 commented 4 years ago

I have the same problem about the lens distortion attributes defined in CARLA.
If the default value of the lens_k and lens_kcube mean without distortion, the assumption of the lens_k=k1 and lens_kcube=k2 are unreasonable.
In addition, I am also confused about the other attributes.

image

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

germanros1987 commented 3 years ago

@marcgpuig do you have 10 min to answer this?

YifuTao commented 3 years ago

Hi, I have found that the distortion model is "plumb_bob".

I used the ros-bridge, ran rostopic echo /carla/ego_vehicle/rgb_view/camera_info and get something like this:


header: seq: 10 stamp: secs: 435 nsecs: 313154742 frame_id: "ego_vehicle/rgb_test" height: 480 width: 848 distortion_model: "plumb_bob" D: [0.0, 0.0, 0.0, 0.0, 0.0] K: [431.4655346201811, 0.0, 424.0, 0.0, 431.4655346201811, 240.0, 0.0, 0.0, 1.0] R: [1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0] P: [431.4655346201811, 0.0, 424.0, 0.0, 0.0, 431.4655346201811, 240.0, 0.0, 0.0, 0.0, 1.0, 0.0] binning_x: 0 binning_y: 0 roi: x_offset: 0 y_offset: 0 height: 0 width: 0 do_rectify: False

We changed K (and hence P) by setting the fov and image size. Specifically, K1, K5 (fx, fy) by fov (fov = 2 arctan (fx/2f)) and K3, K6 (cx, cy) by image size (halve). Definition of D,K,R,P and more information of plumb_bob distortion model can be found in http://docs.ros.org/en/melodic/api/sensor_msgs/html/msg/CameraInfo.html.

Question remained: we still cannot set D, the distortion model. I have tried to set the CARLA Camera lens distortion attributes as mentioned above, but that does not lead to changes in nor D or other matrix in the above camera information.

Can you help on this? It would be very helpful for the community if the camera distortion section documentation can be improved.

Many thanks in advance!

Axel1092 commented 3 years ago

Hi all, we are on the way of changing the lens distortion algorithms as we found some issues and inaccurate results with the current implementation. We plan to expose these parameters so that they can be tuned easily.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

jimmyw404 commented 3 years ago

Hi all, we are on the way of changing the lens distortion algorithms as we found some issues and inaccurate results with the current implementation. We plan to expose these parameters so that they can be tuned easily.

Hi @Axel1092 , any update on this! I'm very interested in getting basic lens distortion with matching OpenCV parameters!

Kait0 commented 3 years ago

I am also interested in this issue.

AbanobSoliman commented 2 years ago

Hi, I am also interested in this topic/issue. any updates ! Thanks

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

jimmyw404 commented 2 years ago

I am still interested in this!

qiangt commented 2 years ago

Does any one know any update on this? I just checked the latest Carla version 0.9.13, and it still uses the old model

yuanhaorannnnnn commented 2 years ago

so upset to see that no updates with such a basic concept

1999010168 commented 1 year ago

also sad

dengping023 commented 1 year ago

Looking forward to distortion model of opencv used in carla

Hassan-BABAOUSMAIL commented 1 year ago

Hi all, we are on the way of changing the lens distortion algorithms as we found some issues and inaccurate results with the current implementation. We plan to expose these parameters so that they can be tuned easily.

Hello sir, Is there any update? Which model was used in CARLA to model distortion? How can we modify it?

ZijianHan commented 1 year ago

Hi all, we are on the way of changing the lens distortion algorithms as we found some issues and inaccurate results with the current implementation. We plan to expose these parameters so that they can be tuned easily.

any updates on the distortion model?

alanhuang1990 commented 1 year ago

If you look into Carla/PostProcessingMaterials/PhysicLensDistortion.uasset, you will find that carla use this distortion model: https://www.ssontech.com/content/lensalg.html But it seems to be a bug that this uasset does not works properly.
image

zhengxh-git commented 11 months ago

I am still interested in this!

MinnanZhou commented 6 months ago

Still interested in this issue