server.c

来自「嵌入式linux下的摄像头jpg采集程序」· C语言 代码 · 共 44 行

C
44
字号
/****************************************************************************Mouse-capture Version 1:2006-6-29This program is used to get one picture from a jpeg webcam to test whether the webcam's drive is successfully installed.It is made for ARM9.Of course it can be used on PC if you modify the complier:)It is modified from servfox by daily3(戴丽-戴小鼠 in Hefei University of Technology and HHCN-BBS).Thanks to 我爱狗熊.If you have problems ,you can contact me.Email:daily3@126.comWish you some useful help!Best Wish to the orignal authors! Thank you very much!****************************************************************************/#include <stdlib.h>#include <stdio.h>#include <string.h>#include "spcav4l.h"struct vdIn videoIn;int main (int argc, char *argv[]){	char videodevice[] = "/dev/video0";	char jpegfile[] = "/tmp/1.jpg";	int grabmethod = 0;	int format = VIDEO_PALETTE_JPEG;	int width = 352;	int height = 288;  	memset(&videoIn, 0, sizeof (struct vdIn));	if(init_videoIn(&videoIn, videodevice, width, height, format,grabmethod)== 0)   {    	v4lGrab(&videoIn, jpegfile);        if(grabmethod==1)        printf("you use mmap method!\n");        else if(grabmethod==0)  	printf("you use read method!\n");	printf("you have get a picture in %s\n",jpegfile);	}	else	printf("can't open your camera!\n");	close_v4l (&videoIn);	return 0;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?