Thanks for your advice, but i would like to show my code so that u get my problem:
here is the code which captures image from the webcam:
static struct video_mmap vm;
mmap_test(int i)
{
vm.format = VIDEO_PALETTE_RGB32;
vm.frame = 0;
vm.width = 176;
vm.height = 144;
ioctl(device_fd, VIDIOCMCAPTURE, &vm);
ioctl(device_fd, VIDIOCSYNC, &numframe);
return buffer;
}
static struct video_mmap vm;
mmap_test(int i)
{
vm.format = VIDEO_PALETTE_RGB32;
vm.frame = 0;
vm.width = 176;
vm.height = 144;
ioctl(device_fd, VIDIOCMCAPTURE, &vm);
ioctl(device_fd, VIDIOCSYNC, &numframe);
return buffer;
}
To copy to clipboard, switch view to plain text mode
when video format is VIDEO_PALETTE_RGB32 the display code displays good quality image.
here is the display code:
display()
{
img
->create
(176,
144,
32,
0,
QImage::IgnoreEndian);
raw_buf = mmap_test(0); //this gets the Image buffer
memcpy(img->bits(), raw_buf, 101376); //101376 is width*height*32 bits is 4 chars 176*144*4
paint.drawImage(0, 0, *img, 0, 0, -1, -1);
}
display()
{
img = new QImage;
img->create(176, 144, 32, 0, QImage::IgnoreEndian);
raw_buf = mmap_test(0); //this gets the Image buffer
memcpy(img->bits(), raw_buf, 101376); //101376 is width*height*32 bits is 4 chars 176*144*4
paint.drawImage(0, 0, *img, 0, 0, -1, -1);
}
To copy to clipboard, switch view to plain text mode
but when i change format = VIDEO_PALETTE_RGB24 i get a carbon kind of image.I want to know is there a problem in the capture or the QImage does not support VIDEO_PALETTE_RGB24 format.If it doesnt is there any other alternate way to do this.
Bookmarks