Skip to content

VideoCapture auto-rotation disabled in 4.11 (enabled by default <= 4.10) #26795

@Breakthrough

Description

@Breakthrough

System Information

N/A, issue affects all platforms and distributions of 4.11.

Detailed description

It appears that commit 305b57e (backporting changes from 5.x) changed the default value of CAP_PROP_ORIENTATION_AUTO. I noticed the issue since I have some open source projects that relied on this being turned on by default.

The value now seems to be disabled by default:

public:
VideoCaptureBase() : autorotate(false) {}

Previously, it was enabled by default:

public:
LegacyCapture(CvCapture * cap_) : cap(cap_), autorotate(true) {}

For users of my project, this means if they update to the latest version of OpenCV, frames extracted from the video are no longer rotated correctly. Was this change intentional? I could not find any references to these changes in the changelog.

I noticed this change due to tests in one of my projects which verifies that videos are autorotated based on metadata. Although a workaround could be to set CAP_PROP_ORIENTATION_AUTO explicitly, I have several projects which relied on this being enabled by default. Performing auto rotation by default also seems like a reasonable choice for an API, since there already was an explicit opt-out mechanism. I suspect changing this may break other existing applications as well.

Steps to reproduce

There appears to be a rotated video present for the test cases in modules/videoio/test/test_orientation.cpp. However, none of the existing test cases demonstrate/validate the expected default of CAP_PROP_ORIENTATION_AUTO. It's probably worth adding a test for this to prevent any regressions (it should be possible to determine if a backend supports it at runtime), and also to update the documentation accordingly.

Issue submission checklist

  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
  • I updated to the latest OpenCV version and the issue is still there
  • There is reproducer code and related data files (videos, images, onnx, etc)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions