2.servfox的移植采集摄像头数据
1修改Makefile
解压,修改Makefile,第二行的 -I跟的是内核源码的头文件目录
CC=gcc
SERVFLAGS= -O2 -DLINUX $(WARNINGS) -I /home/test/temp6410/linux-2.6.28.6/include
2再修改spcav4l.c
再修改spcav4l.c,将蓝色字部分都注释掉,否则移植到板上会出现"Not a JPEG webcam sorry Abort "或者“could't set video palette Abort"的错误
/* Only jpeg webcam allowed */
/*if(vd->cameratype != JPEG) {
exit_fatal ("Not a JPEG webcam sorry Abort !");
}*/if(debug) printf ("StreamId: %d Camera\n", vd->cameratype);/* probe all available palette and size Not need on the FOX always jpeg
if (probePalette(vd ) < 0) {
exit_fatal ("could't probe video palette Abort !");
}
if (probeSize(vd ) < 0) {
exit_fatal ("could't probe video size Abort !");
}
err = check_palettesize(vd);
if(debug) printf (" Format asked %d check %d\n",vd->formatIn, err);
*/vd->videopict.palette = vd->formatIn;
vd->videopict.depth = GetDepth (vd->formatIn);
vd->bppIn = GetDepth (vd->formatIn);
//vd->framesizeIn = (vd->hdrwidth * vd->hdrheight * vd->bppIn) >> 3; // here alloc the output ringbuffer
vd->framesizeIn = (vd->hdrwidth * vd->hdrheight >> 2 ); // here alloc the output ringbuffer jpeg only
erreur = SetVideoPict (vd);
erreur = GetVideoPict (vd);/* if (vd->formatIn != vd->videopict.palette ||
vd->bppIn != vd->videopict.depth)
exit_fatal ("could't set video palette Abort !");
if (erreur < 0)
exit_fatal ("could't set video palette Abort !");*/
之后make一下,会生成servfox文件。
说明:成功编译。正确。
将servfox文件放到mini6410上,输入命令./servfox -d /dev/video2 -g -s 640x480 -w 7070,注意:/dev/video2是我的摄像头设备名,有的是/dev/video0,最好用cat /dev/video2 > /usr/a.jpg测试一下能不能拍摄到图片到/usr/a.jpg文件上,以便确定摄像头名称。
运行./servfox -d /dev/video2 -g -s 640x480 -w 7070后,正常是应该如下显示
./servfox -d /dev/video2 -g -s 640x480 -w 7070
servfox version: 1.1.2 date: 07:10:2005 (C)
Waiting .... for connection. CTrl_c to stop !!!!
3.spcaview部分
解压spcaview-20061208.tar.gz,这里主要用到里面的http-java-applet文件夹,将该文件夹里的所有文件复制到mini6410上的/var/www/目录中(我这里新建一个webcam目录来存放)。
之后就搞掂了``测试一下
接上摄像头,终端分别输入./boa和./servfox -d /dev/video2 -g -s 640x480 -w 7070
然后在windows或者linux的浏览器中打开网址这时候就能看到摄像头的内容了(IE上显示java可能需安装jre环境,直接安装jre-6u10-windows-i586-p-s.exe就可以了)。 这里的jre包可以安装最近的开发包,今天最新的这个。