What is possible image format of Y800 which is available in OpenCV? is it always referred to GRAY? Any other options?
Thanks in advance.
What is possible image format of Y800 which is available in OpenCV? is it always referred to GRAY? Any other options?
Thanks in advance.
Eight years later, I stumbled upon this question. I want to add an answer with regard to OpenCV 4.2.0.
For videos, this version features an ffmpeg backend which natively understands the FOURCC identifier "Y800". Confusingly, it does not take one-channel grayscale (CV_8UC1
) frames, but the usual OpenCV three-channel BGR (CV_8UC3
):
cv::VideoWriter vw("y8.avi", cv::VideoWriter::fourcc('Y', '8', '0', '0'), 60, frame.size());
vw.write(frame); // note: frame must be 8UC3!
OpenCV supports the grayscale mode in number of image file formats, including, but not limited to PGM, PNG and JPEG.
cv::imwrite("gray.pgm", image);