for grayscale video reads CV_8UC3 type frame

Hello there,
I’m having an issue when reading a frame from the greyscale VideoCapture.

But the type of the frame read using the .read(frame) function is 16 which suggest a CV_8UC3 format instead of the 0 (CV_8UC1) indicated by the CAP_PROP_FORMAT.

Am I doing something wrong or is this a bug? And if so, how would I go about reading a frame as CV_8UC1?

(I have a 4.6.0 opencv)
Thank you for your time!

EDIT: Just figured out that it is the same frame copied 3 times (to the channels) meaning that if there is pixel with value 111 and next with value 222 the data will look like: 111,111,111,222,222,222.

Is this expected behaviour? Did I just miss something in the documentation?

You missed this: When you wish help for a problem, you need to give information, including:

  • Operating system
  • OpenCV version
  • Language and other environment information
  • Camera information and how you interface it
  • Your program’s code

Your back end probably doesn’t support reading those parameters.

As you know what the data received actually is, you can just convert it to what you need, using the correct color conversion parameters.

Sorry, my bad.

I am using OpenCV 4.6.0 package on Linux (nix package).
C++, but it looks like the same thing happens in python.
I am reading ffv1 video from file in mkv container created using cvtColor() function. The function outputs the correct CV_8UC1 format. But after saving that to a file and reading that file the read() function exhibits the behavior said in the main post.

a snippet of the code:

cv::VideoCapture InputVid("filelocation.mkv");
// cv::CAP_PROP_FORMAT is 0
cv::Mat frame;
while ( {
    // frame.type() here is CV_8UC3

Do you mean using cvtColor with some parameters?

Anyways I know that I can fix that, it just seems weird to me, that the read() function does this.