pal-robotics / aruco_ros

Software package and ROS wrappers of the Aruco Augmented Reality marker detector library
MIT License
439 stars 304 forks source link

why the size of distorsionCoeff is 4? #130

Open xibeisiber opened 3 months ago

xibeisiber commented 3 months ago

Hi, the distorsion coeff in sensor_msgs/CameraInfo has size of 5.

But in aruco_ros_utils.cpp, only 4 elements is used in distorsionCoeff. besides, it checks whether the size of D is 4, if not, all distortion elements are set to 0...

why the last element is not used?

Thanks!

saikishor commented 3 months ago

Hello @xibeisiber !

A very good question, I'm pretty sure there is a reason for it. I've to take a look and get back to you.

Thank you

saikishor commented 3 months ago

Hello @xibeisiber!

I remember now, what we have observed is in general for normal camera models when the rectified image is parsed it usually works without any issues and the estimation is good. In the case of fisheye cameras, we have 4 distortion parameters and we usually undistort when we use a fisheye camera. If you want to add support for other cameras as well, please go ahead and open a PR, we will be happy to review and get it merged.

Thank you,

Best Regards, PAL Robotics Team

xibeisiber commented 2 months ago

I remember now, what we have observed is in general for normal camera models when the rectified image is parsed it usually works without any issues and the estimation is good.

For a normal camera, if I use a raw image and set "image_is_rectified" to false, aruco will not actually accept the distortion coefficient, since all distortion elements are set to 0 if the coefficient size is not 4.

Is this a problem? Thanks!

saikishor commented 2 months ago

Hello @xibeisiber!

I don't think it is a big problem. There might be a slight estimation error when the aruco is at the edges, but when it is at the center of the image, usually the estimation is fine enough

Thank you,

Best Regards, PAL Robotics Team

xibeisiber commented 2 months ago

I assume that it depends on how much the image is distorted.

If the distortion coefficient is relatively larger for a normal camera, wouldn't the estimation be improved more or less if the distortion coefficient is considered?

Thanks! xibeisiber