Skip to content

Added warning if projected axes are out of camera frame in drawAxes#27311

Merged
asmorkalov merged 1 commit intoopencv:4.xfrom
asmorkalov:as/draw_axes_warning
May 16, 2025
Merged

Added warning if projected axes are out of camera frame in drawAxes#27311
asmorkalov merged 1 commit intoopencv:4.xfrom
asmorkalov:as/draw_axes_warning

Conversation

@asmorkalov
Copy link
Copy Markdown
Contributor

Camera distortion model is not well defined outside of the frame. It may significantly distort axes.
Address #25967

Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
  • The PR is proposed to the proper branch
  • There is a reference to the original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake

@asmorkalov asmorkalov force-pushed the as/draw_axes_warning branch from 6cddb02 to e1a74e6 Compare May 14, 2025 12:34

if (!allIn)
{
CV_LOG_WARNING(NULL, "Some of projected axes endpoints are out of frame. The drawn axes may be not relaible.");
Copy link
Copy Markdown
Contributor

@s-trinh s-trinh May 14, 2025

Choose a reason for hiding this comment

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

relaible

Small typo. I am not a native english speaker, my proposition:

→ "Some of the projected axes endpoints are outside of the image bounds. The drawn axes may not be reliable with strong lens distortion ." (accurate / correct instead?)

off topic ---

I would add in the message something like this:

  • "You may want to pass a zero-distortion coefficient vector to avoid this issue." (or NULL?)

This should be the simplest workaround since most likely drawFrameAxes would be used for debugging / display purposes (no need for accurate display in my opinion).


Maybe another approach would be?

  • projectPoints without distortion
  • clip the coordinates inside the image rectangle
  • add distortion
  • draw the frame axes

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

"You may want to pass a zero-distortion coefficient vector to avoid this issue." (or NULL?)

It generates incorrect result for cameras with visible distortion. Axes will be shifted from expected location.

@opencv-alalek opencv-alalek removed their request for review May 15, 2025 07:54
@asmorkalov asmorkalov merged commit 2af8d03 into opencv:4.x May 16, 2025
27 of 28 checks passed
@asmorkalov asmorkalov self-assigned this May 16, 2025
@asmorkalov asmorkalov mentioned this pull request May 27, 2025
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