V4L2 capture example, gray color

Alex Ivasyuv <[email protected]> Wed, 27 Oct 2010 18:30:30 +0300
Newsgroups gmane.comp.video.video4linux
Message-ID <[email protected]>
Hi,

I've tried to use sample code example from 
http://v4l2spec.bytesex.org/spec/capture-example.html
and save frame data to image, and found, that images are *gray* instead 
of color.

#include <iostream>
#include <fstream>
#include <sstream>

using namespace std;

int i = 0;

.....

static void process_image(const void * p) {
     ++i;
     fputc('.', stdout);
     fflush(stdout);

     std::stringstream out;
     out << "capt-" << i << ".raw";

     ofstream outfile(out.str().c_str(), ofstream::binary);
     outfile.write((const char*) p, buffers[0].length);
     outfile.close();
}

....

Raw images I converted with "raw2tiff" application.

lspci: http://pastebin.com/raw.php?i=VVL8m2Gu
my code: http://pastebin.com/R3j3LL96

What' wrong with my code? Why I get in gray, instead of color?

Thanks,

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list