Zoom camera calibration in ROS?
How would you tackle the task of zoom camera calibration using standard ROS tools? Both the calibration process itself, and camera_info
publication afterwards? I haven't found anything in camera_calibration
or camera_info_manager
.
If I understand it correctly, you have to estimate the dependency of the K
matrix on the current zoom level using a function. The dependency of K
on focal length is IMO linear (as long as we ignore skew and the other odd terms).
There are several quantities that can be reported by the camera:
- "zoom ratio": then I'd just multiply the
f_x
andf_y
terms of theK
matrix with this ratio (assuming the camera was calibrated with ratio 1) - focal length: I'd simply put the focal length in the matrix
- field of view: I can estimate sensor width from the calibration, and then use it to get the focal length (
2*atan(0.5*width/f)
).
This of course ignores radial (and other) distortion, which may also by influenced by the focal length (at least so do I think).
Then I'd publish the updated camera matrix to the appropriate camera_info
topic.
What do you think about this approach? Has there already been something doing a similar task?
That seems like a reasonable approach, and the right way to integrate with ROS.
Most of the image pipeline nodes will probably be fine, but you will probably hit edge cases where some nodes assume the camera_info is fixed, and only use the first message instead of subscribing.
Yes, and I'd have to avoid all
loadCalibration
andsaveCalibration
calls in the camera info manager (otherwise the "zoomed" matrices would get saved). This is in no way optimal, but I'm afraid we can't do better...