ros-visualization / rqt_image_view

http://wiki.ros.org/rqt_image_view
26 stars 59 forks source link

Allow image rotation in 90° steps #10

Closed xqms closed 6 years ago

xqms commented 6 years ago

This is useful for webcams mounted in non-upright orientations. Rather than rotating in the camera driver, it is often better to rotate at the display side, e.g. for cameras mounted on robotic arms that change orientation all the time.

lucasw commented 6 years ago

Can you unrotate the clicked location that is optionally published?

xqms commented 6 years ago

Thanks, good catch. I implemented unrotation for the clicked points and tested on sample images.

dirk-thomas commented 6 years ago

A push button seems like a rather intuitive choice for this feature. Why not use a combo box to select the desired rotation directly?

xqms commented 6 years ago

@dirk-thomas In my usecase (teleoperation) it is easier to click until the image is upright, rather than think about what the current mismatch is, how much you have already rotated and what the resulting absolute rotation is.

Maybe two push buttons for rotating 90° clockwise and counterclockwise?

dirk-thomas commented 6 years ago

Maybe two push buttons for rotating 90° clockwise and counterclockwise?

Since space is always "costly" I am not sure if two buttons is better. On the other hand the label could probably be reduced to "0°" / "90°" / "180°" / "270°" (without the "Rotate: " prefix) if it is accompanied with a button on the left and right for (counter-)clockwise rotation. Those could then also have a nice icon instead of text. So maybe that is space wise still fine with two buttons...

xqms commented 6 years ago

Sounds good to me. I'll update the PR soon. Thanks for the feedback :-)

dirk-thomas commented 6 years ago

I just tried the patch and it works great.

But there is one more thing I think should be changed. If you check e.g. the Qt transformation example I would expect that a 90° rotation clockwise should be label "90°". In the current patch it seems to be the opposite. Does that make sense?

xqms commented 6 years ago

Sorry for the long silence, I actually forgot about this.

@dirk-thomas That depends on the definition of the rotation angle as "clockwise" or "anti-clockwise", but I agree that "clockwise" seems to be used more often for image rotations. Also corresponds to a rotation in 3D around the Z axis of the optical coordinate system, which points into the image.

I updated the PR to use clockwise rotations.

dirk-thomas commented 6 years ago

Thank you for the patch and for iterating on it.