Web lists-archives.com

V4L2 capture example, gray color




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:video4linux-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list