|
用ov511的摄像头采集图片,主要步骤如下执行,把映射区的数据写入文件,但是在程序执行结束后生成的1.bmp无法打开看,不知道什么地方出现了问题,请诸位老师帮看一下,谢谢。
ioctl(vd.fd, VIDIOCGCAP, &(vd.videocap));
ioctl(vd.fd, VIDIOCGPICT, &(vd.videopict));
ioctl(vd.fd, VIDIOCSPICT, &(vd.picture));
vd.vmmap.width = 320;
vd.vmmap.height = 240;
vd.vmmap.format = VIDEO_PALETTE_RGB24;
ioctl(vd.fd, VIDIOCGMBUF, &(vd.videombuf));
vd.pFramebuffer=(unsigned char*)mmap(0,vd.videombuf.size,PROT_READ|PROT_WRITE,MAP_SHARED,vd.fd,0);
vd.vmmap.frame = 0;
ioctl(vd.fd,VIDIOCMCAPTURE,&(vd.vmmap));
fp = fopen("1.bmp","wb");
fwrite(pFramebuffer,IMAGESIZE,1,fp); |
|