V4L2 - Capturing uncompressed data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I'm a French student and I'm doing an intern ship in a 
French image processing software company, 
and I've got some questions about V4L2 and more precisely, 
the video formats.

In the application, I just need to capture frames 
of webcams and display the result. 
After research, I found the capture example on the
http://v4l2spec.bytesex.org/ website. 
So now, I capture correctly the frames.

During the initialisation of the device,
 I'm doing a VIDIOC_G_FMT in order to
get the format description of the webcam. 
Then, I tried to change the pixelformat.
Indeed, I wanted the YUYV FORMAT because I need to get the raw data
in order to get the best quality possible.

My problem is, after the VIDIOC_S_FMT, the pixelformat field 
is set back to JPEG FORMAT (and the colorspace too) and so,
I don't get raw data, but compressed jpeg data.

I know that the VIDIOC_S_FMT try to change these fields 
but if the driver don't authorise them, 
it will put the originals back. 

But, I really need to get the
uncompressed data of the captured picture,
so is there by any chance, another solution to 'force' 
and capture the images in an Uncompressed format ? 
Or is it really set by the driver and so, 
no chance to have the raw ?

So, in my InitDevice I'm doing that :

     //Get FMT
    Clear( &mFmt, sizeof( mFmt ) );
    mFmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;

    if ( -1 == Xioctl ( mFd, VIDIOC_G_FMT, &mFmt ) )
        return false;

    //Set FMT A LA RESOLUTION CHOISIE
    :Clear( &mFmt, sizeof( mFmt ) );
    mFmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
    mFmt.fmt.pix.width = iInfo.Width;
    mFmt.fmt.pix.height = iInfo.Height;

//I want to capture raw data
in YUYV, no JPEG compressed stuff
    mFmt.fmt.pix.pixelformat = V4L2_PIX_FMT_YUYV;  

    mFmt.fmt.pix.field = V4L2_FIELD_INTERLACED;

    if ( -1 == Xioctl ( mFd, VIDIOC_S_FMT, &mFmt ) )
        return false;

       //JPEG - set yuyv failed
printf("%d\n",mFmt.fmt.pix.pixelformat);

 //JPEG - always jpeg, but i don't
want this
    printf("%d\n",mFmt.fmt.pix.colorspace);  


To be clear, I want the uncompressed pixels of the capture. 
I already succeeded in converting from JPEG to BGR, 
but the data are compressed.

So now, I don't want to do that conversion. 
Actually, I want to save the
uncompressed data for quality directly!

But I don't know if that is possible because 
the driver of the webcam (VF0420 Live! Cam Vista IM - ov519)
 specified only JPEG format when I'm doing a 'V4l-info'.

I really looked for answers everywhere on the web,
so I'm losing hope and that's why I'm asking you that today. 
I'm sorry if my comment is misplaced or if the
answer has already been posted.

Thank you all,
Regards.
Guillaume. 

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux