Skip to content

feat(autoware_image_distortion): correct camera image distortion#337

Open
sakunaka39 wants to merge 5 commits intoautowarefoundation:mainfrom
sakunaka39:main
Open

feat(autoware_image_distortion): correct camera image distortion#337
sakunaka39 wants to merge 5 commits intoautowarefoundation:mainfrom
sakunaka39:main

Conversation

@sakunaka39
Copy link

@sakunaka39 sakunaka39 commented Jan 13, 2026

Description

This PR introduces a new package autoware_image_distortion to rectify distorted images from cameras. This package subscribes to raw or compressed images and camera info, performs rectification using image_geometry, and publishes the rectified images.

Changes

  • Added autoware_image_distortion package.
  • Implemented ImageDistortion node to rectify images using image_geometry::PinholeCameraModel.
  • Added launch files for single camera and multi-camera configurations (e.g., aip_x2_gen2).
  • Supports both raw and compressed image transport.
  • Added license headers and resolved pre-commit errors.

Results

Before (Distorted)

image

After (Rectified)

image

How was this PR tested?

  1. Launch the node with a camera driver.
    ros2 launch autoware_image_distortion distortion.launch.xml sensor_model:=sample_sensor_kit
  2. Verify that rectified images are published to /sensing/camera/camera*/image_rect.
  3. Check the images using rviz2.

Signed-off-by: sakunaka39 <shotaro.nakamura@tier4.jp>
@github-actions
Copy link

github-actions bot commented Jan 13, 2026

Thank you for contributing to the Autoware project!

🚧 If your pull request is in progress, switch it to draft mode.

Please ensure:

pre-commit-ci bot and others added 3 commits January 13, 2026 08:05
Signed-off-by: sakunaka39 <shotaro.nakamura@tier4.jp>
Signed-off-by: sakunaka39 <shotaro.nakamura@tier4.jp>
@sakunaka39 sakunaka39 closed this Jan 13, 2026
@sakunaka39 sakunaka39 reopened this Jan 13, 2026
@sakunaka39 sakunaka39 marked this pull request as ready for review January 14, 2026 07:35
@isseitzk isseitzk requested a review from manato January 21, 2026 00:35
Copy link

@manato manato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sakunaka39
Thank you for your contribution!
I left some comments that I noticed. I'd appreciate if if you could consider them.
Besides, from the perspective of the node behavior, I think autoware_image_"un"distortion is a more appropriate name for the node because this node performs undistortion (getting rid of lens distortion). Considering this point would also be appreciated!

<arg name="sensor_model" default="aip_x2_gen2" description="sensor model name (e.g. aip_x2_gen2)"/>

<arg name="transport_type" default="compressed"/>
<arg name="interpolation_method" default="1"/>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to add description for the interpolation_method argument, like other launch files?
Judging from the PR description, I guess this file will be the entry point, which users mainly execute. If that is the case, the description would be helpful.

sensor_msgs::msg::Image::SharedPtr out_img_msg =
cv_bridge::CvImage(image_msg->header, "bgr8", rect_image).toImageMsg();

pub_rect_.publish(out_img_msg, info_msg);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pub_rect_.publish(out_img_msg, info_msg);
auto out_info_msg = sensor_msgs::build<sensor_msgs::msg::CameraInfo>()
.header(info_msg->header)
.height(model_.rectifiedRoi()height)
.width(model_.rectifiedRoi()width)
.distortion_model(model_.cameraInfo().distortion_model)
.d(sensor_msg::msg::CameraInfo::_d_type(model_.cameraInfo().d.size(), 0.)) // zero distortion
.k(model_.intrinsicMatrix())
.r(model_.rotationMatrix())
.p(model_.projectionMatrix())
.binning_x(model_.binningX())
.binning_y(model_.binningY())
.roi(model_.rectifiedRoi());
pub_rect_.publish(out_img_msg, out_info_msg);

I think publishing the input camera info here is not appropriate, otherwise there will be two publishers that publish the same topic.
Besides, strictly speaking, camera info for the undistorted image would be slightly different from the original one.
My suggestion reflects this point. Since I haven't tested if it can be built, I would appreciate it if you test it in case you adopt it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants