# VideoCapture.read(frame) for grayscale video reads CV\_8UC3 type frame

**URL:** https://forum.opencv.org/t/videocapture-read-frame-for-grayscale-video-reads-cv-8uc3-type-frame/11519
**Category:** C++
**Tags:** videoio
**Created:** [January 6, 2023, 12:48pm UTC](https://forum.opencv.org/t/videocapture-read-frame-for-grayscale-video-reads-cv-8uc3-type-frame/11519 "2023-01-06T12:48:31Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![ptww](https://avatars.discourse-cdn.com/v4/letter/p/bbe5ce/32.png) [@ptww](https://forum.opencv.org/u/ptww)
#### Post date: [January 6, 2023, 12:48pm UTC](https://forum.opencv.org/t/videocapture-read-frame-for-grayscale-video-reads-cv-8uc3-type-frame/11519/1 "2023-01-06T12:48:31Z")

</div>

Hello there,  
I’m having an issue when reading a frame from the greyscale VideoCapture.  
Both CAP\_PROP\_CONVERT\_RGB and CAP\_PROP\_FORMAT are 0.

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?

---

<div class="post-metadata">

### Author: ![matti.vuori](https://avatars.discourse-cdn.com/v4/letter/m/e79b87/32.png) [@matti.vuori](https://forum.opencv.org/u/matti.vuori)
#### Post date: [January 6, 2023, 9:55pm UTC](https://forum.opencv.org/t/videocapture-read-frame-for-grayscale-video-reads-cv-8uc3-type-frame/11519/2 "2023-01-06T21:55:36Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![ptww](https://avatars.discourse-cdn.com/v4/letter/p/bbe5ce/32.png) [@ptww](https://forum.opencv.org/u/ptww)
#### Post date: [January 7, 2023, 1:31pm UTC](https://forum.opencv.org/t/videocapture-read-frame-for-grayscale-video-reads-cv-8uc3-type-frame/11519/3 "2023-01-07T13:31:37Z")

</div>

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:

```cpp
cv::VideoCapture InputVid("filelocation.mkv");
// cv::CAP_PROP_FORMAT is 0
// cv::CAP_PROP_CONVERT_RGB is 0
...
cv::Mat frame;
while (InputVid.read(frame)) {
    // frame.type() here is CV_8UC3
    OutputVid.write(frame);
}

```

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.
