Skip to content

videoio : DSHOW CAP_PROP_FOURCC/CAP_PROP_CONVERT_RGB set order doesn't work the same. #19367

@OlivierLDff

Description

@OlivierLDff
System information (version)
  • OpenCV => 4.x
  • Operating System / Platform => Windows 64 Bit
  • Compiler => Visual Studio 2017
Detailed description

I'm using Boson camera from FLIR. I'm interested in Y16 format video. I'm using DSHOW backend on windows.
I noticed that setting CAP_PROP_CONVERT_RGB then something like CAP_PROP_FOURCC will revert CAP_PROP_CONVERT_RGB to the default value.

Steps to reproduce
#include <opencv2/videoio.hpp>

// ...

cv::VideoCapture cap;
cap.open(0, cv::CAP_DSHOW);
f(!cap.isOpened())
    return;

// Print true, that is ok, default expected behavior.
std::cout << "CAP_PROP_CONVERT_RGB: " << cap.get(cv::CAP_PROP_CONVERT_RGB) << std::endl; 

cap.set(cv::CAP_PROP_CONVERT_RGB, false);
cap.set(cv::CAP_PROP_FOURCC, cv::VideoWriter::fourcc('Y', '1', '6', ' '));

// Print true, should print false.
std::cout << "CAP_PROP_CONVERT_RGB: " << cap.get(cv::CAP_PROP_CONVERT_RGB) << std::endl; 
Proposed solution

I fixed it into a fork.
I introduced a m_convertRGB boolean value inside VideoCapture_DShow that is updated when CAP_PROP_CONVERT_RGB is set.
Then i call g_VI.setConvertRGB when g_VI get reinitialized with the saved value.

Current workaround

I believe what everyone is doing right now is first set CAP_PROP_FOURCC then CAP_PROP_CONVERT_RGB.
Especially boson user, like it is shown on FLIR website

I believe it should work in both order. Or it should be documented somewhere.

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 solution
  • I updated to 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