承接实训第四天:zigbee无线传感网实训---在LCD屏上显示JPG图片、 触摸屏、相册(The fourth day)
摄像头:
常见的摄像头:针孔摄像头(有线和无线)、红外摄像头(有线),usb摄像头;
摄像头采集图像的格式:yuyv 、jpeg(v4l2)
文件准备:libapi_v4l2_arm.so
api_v4l2.h
/*************************************************
File name : api_v4l2.h
Create date : 2014-07-01 19:42
Modified date : 2014-07-01 19:42
Author : heqingde
Email : hqd173@163.com
***********************************************/
#ifndef API_V4L2_H_
#define API_V4L2_H_
#define VIDEO_WIDTH 640
#define VIDEO_HEIGHT 480
#define MAX_CAM_RES 32 //camres res
#define BUFFER_COUNT 4 //buffer zone
#define FPS 30
#define MAX_CAM_RES 32
//#define CAMERA_DEVICE "/dev/video1"
#define exit_error(s)\
do{\
printf("%s is error\n",s);\
return (-1);\
}while(0)
/*********************************
* NAME:VideoBuffer struct
* Function: Describe buffer V4L2 driver assigns and maps
* Member: start: point of buffer
* length: total length of buffer
**********************************/
typedef struct Video_Buffer
{
void *start;
int length;
}VideoBuffer;
/*******************************
* name :fream_buffer
* Function: save fream
* member: buf :point of buf
* length:total length op buf
********************************/
typedef struct Frame_Buffer
{
char buf[1843200];
int length;
}FrameBuffer;
/************************************
*name:CamRes
*Function:Camera format
*Member: width : format width
*height: format height
*/
typedef struct CamRes
{
int width;
int height;
}CamRes;
/*************************************
*name:CamResList struct
*Function:CamRes format list
*Member: cam_res :struct CamRes
*res_num:Camera format number
*/
typedef struct CamResList
{
struct CamRes *cam_res;
int res_num;
}CamResList;
/*************************************
*Name:open_device Function
*Function:open the device
*/
void linux_v4l2_open_device();
/*************************************
*name:device_init
*Function:Initial Camera v4l2
*/
int linux_v4l2_device_init(const char *dev);
/*****