⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 server.c

📁 linux下用c语言写的一个图像抓拍程序。
💻 C
字号:
/****************************************************************************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!*************************************************************************static int GetVideoPict (struct vdIn *vd);//获取图片属性信息。static int SetVideoPict (struct vdIn *vd);//设置图片属性。static int isSpcaChip (const char *BridgeName);//测试芯片类型static int GetStreamId (const char *BridgeName); //测试输出数据的格式static int GetDepth (int format);//获取颜色深度。void exit_fatal(char *messages);//错误显示。int init_videoIn(struct vdIn *vd,char *device,int width,int height,int format,intgrabmethod);//初始化设备。int convertframe(unsigned char *dst,unsigned char *src, int width,int height, intformatIn, int size);//把共享缓冲区中的数据放到一个变量中,通知系统已获得一帧。int v4lGrab (struct vdIn *vd,char *filename );//从摄像头采集图片。int close_v4l (struct vdIn *vd);//关闭摄像头。int get_jpegsize (unsigned char *buf, int insize);//获取jpeg图片大小****************************************************************************/#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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -