資源簡介
不錯的攝像,測試程序,能成功捕捉bmp圖片、]
不錯的攝像,測試程序,能成功捕捉bmp圖片

代碼片段和文件信息
/*
*???TQ2440?camera?test?program
*
*???preview?:?320x240?overlay?on?320x240?16bpp?LCD
*
*???TFT?LCD?size?:?320x240
*/
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?“videodev.h“
#include?“videodev2.h“
#include?
#define?PIXFMT_NUM????????????????????????5
#define?INPUT_NUM?????????????????????????5
#define?CTRL_NUM?????????????????????????100
#define?V4L2_DEV_NODE????????????????????????“/dev/camera“
#define?FB_DEV_NODE????????????????????????“/dev/fb/0“
#define?DATA????????????????????????????????“/home/sky/photo“
#define?WIDTH???????????????320
#define?HEIGHT????????????????????????????????240
//typedef?struct?v4l2_input????V_INPUT;
//typedef?struct?v4l2_format???V_FORMAT;
//typedef?struct?v4l2_fmtdesc??V_FMTDESC;
//typedef?struct?v4l2_queryctrl?V_QRYCTRL;
typedef?struct?fb_var_screeninfo?F_VINFO;
//文件頭
struct?tagBITMAPFILEHEADER{
????unsigned?long?bfSize;
????unsigned?long?bfLeft;
????unsigned?long?bfOffBits;
};
/*bmp圖像的位圖信息頭*/
struct?tagBITMAPINFOHEADER{
????unsigned?long?biSize;
????unsigned?long?bmpWidth;
????unsigned?long?bmpHeight;
????unsigned?short?biPlanes;
????unsigned?short?bicolors;
????unsigned?long?isCompressed;
????unsigned?long?biMapSize;
????unsigned?long?biHorizontal;
????unsigned?long?biVertical;
????unsigned?long?biusedcolors;
????unsigned?long?biimportcolors;?
};
unsigned?int?x_lcd_size?y_lcd_size;
unsigned?char?preview_buf[WIDTH*HEIGHT*2];
static?void?writebmp(int?data_fd){
????????int?ijsize;
????????int?ret;
????????unsigned?short?buf[WIDTH*HEIGHT];
????????memcpy(buf?&preview_buf?240*320*2);
????????unsigned?short?bmp[WIDTH*HEIGHT];
????????
????????struct?tagBITMAPFILEHEADER?bfhead;
????????struct?tagBITMAPINFOHEADER?binfohead;
????????size=HEIGHT*WIDTH;
????????
????????bfhead.bfSize=0x36+size*2;
????????bfhead.bfLeft=0;
????????bfhead.bfOffBits=0x36;
????????
????????binfohead.biSize=0x28;
????????binfohead.bmpWidth=WIDTH;
????????binfohead.bmpHeight=HEIGHT;
????????binfohead.biPlanes=1;
????????binfohead.bicolors=0x10;
????????binfohead.isCompressed=0;
????????binfohead.biMapSize=size*2;
????????binfohead.biHorizontal=0x0b13;
????????binfohead.biVertical=0x0b13;
????????binfohead.biusedcolors=0;
????????binfohead.biimportcolors=0;
????????for(i=0;i ?????????????????for(j=0;j ????????????????????????{
????????
????????????????????????*(bmp+i*WIDTH+j)=((buf[i*WIDTH+j]&0xf800)>>1)|((buf[i*WIDTH+j]&0x07c0)>>1)|((buf[i*WIDTH+j]&0x1f));
????????????????????????
????????????????????????//printf(“%x\t“*(bmp+i*WIDTH+j));
????????????????????????}
????????write(data_fd“BM“2);
????????
????????i=write(d
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????6851??2011-05-07?13:20??能捕獲bmp圖片的程序\camera_test.c
?????文件???????6854??2011-05-07?14:42??能捕獲bmp圖片的程序\ov9650圖片捕捉.txt
?????文件?????153654??2009-11-07?04:14??能捕獲bmp圖片的程序\photo.bmp
?????文件??????12952??2011-05-07?14:49??能捕獲bmp圖片的程序\camera\camera
?????文件???????6854??2011-05-07?14:49??能捕獲bmp圖片的程序\camera\camera_test.c
?????文件????????272??2016-10-01?09:37??能捕獲bmp圖片的程序\camera\Makefile
?????文件??????30607??2009-07-31?18:06??能捕獲bmp圖片的程序\camera\videodev2.h
?????文件??????14549??2009-07-31?18:07??能捕獲bmp圖片的程序\camera\videodev.h
?????目錄??????????0??2011-05-07?14:56??能捕獲bmp圖片的程序\camera
?????目錄??????????0??2011-05-07?14:55??能捕獲bmp圖片的程序
-----------?---------??----------?-----??----
???????????????232593????????????????????10
評論
共有 條評論