[Kde-imaging] how to convert the raw data to Qt image format
desertstar
desertstar at 163.com
Mon Aug 2 07:18:22 CEST 2004
Dear everyone:
i am facing with a problem in my program.
Now,i had used video4linux and ioctl operation to get a picture
data from the ov511
USB camera.Then i should display it on the screen with QT.
The first problem was i can't make sure the data i got was a
right image data from
camera,i do as follow:
*****************************************************
.........
grab_data =(unsigned char*)mmap(0, grab_size, PROT_READ | PROT_WRITE,
MAP_SHARED, grab_fd, 0);
if ((grab_data == NULL) || (MAP_FAILED == grab_data))
printf("couldn't mmap vidcam. your card doesn't support that?\n");
t=1;
for (int i=0;i<t;i++)
if (ioctl(grab_fd, VIDIOCMCAPTURE, &grab_buf) == -1)
printf("error when ioctl VIDIOCMCAPTURE");
int i=0;
if (ioctl(grab_fd, VIDIOCSYNC, &i) == -1) printf("error ioctl
VIDIOCSYNC");
...........
**********************************************************
does this right?And i still don't understand variable t's
function,does it need to capture
the picture many times?
The second problem was that if i got the right image data,then how can
i turn it
into the right Qimage format?And what the format the Qimage will be?
Many thanks.
More information about the Kde-imaging
mailing list