Linux下采集攝像頭的圖像再保存爲JPG圖片存放到本地(YUYV轉JPG)

一、環境介紹

操作系統:ubuntu18.04 X64位   和   嵌入式Linux操作(ARM)

二、功能介紹

通過Linux下標準V4L2框架採集攝像頭的數據,通過jpeglib庫連續編碼爲JPG格式圖片存放到本地。

三、安裝jpeglib庫

jpeglib下載地址:http://www.ijg.org/

下載之後解壓到linux指定目錄下,進行接解壓、編譯。

wbyq@wbyq:~/work_pc$ tar xvf /mnt/hgfs/linux-share-dir/jpegsrc.v9d.tar.gz
wbyq@wbyq:~/work_pc$ cd jpeg-9d/
wbyq@wbyq:~/work_pc/jpeg-9d$ ./configure 
wbyq@wbyq:~/work_pc/jpeg-9d$ make
wbyq@wbyq:~/work_pc/jpeg-9d$ sudo make install
[sudo] wbyq 的密碼: 
make[1]: 進入目錄“/home/wbyq/work_pc/jpeg-9d”
 /bin/mkdir -p '/usr/local/lib'
 /bin/bash ./libtool   --mode=install /usr/bin/install -c   libjpeg.la '/usr/local/lib'
libtool: install: /usr/bin/install -c .libs/libjpeg.so.9.4.0 /usr/local/lib/libjpeg.so.9.4.0
libtool: install: (cd /usr/local/lib && { ln -s -f libjpeg.so.9.4.0 libjpeg.so.9 || { rm -f libjpeg.so.9 && ln -s libjpeg.so.9.4.0 libjpeg.so.9; }; })
libtool: install: (cd /usr/local/lib && { ln -s -f libjpeg.so.9.4.0 libjpeg.so || { rm -f libjpeg.so && ln -s libjpeg.so.9.4.0 libjpeg.so; }; })
libtool: install: /usr/bin/install -c .libs/libjpeg.lai /usr/local/lib/libjpeg.la
libtool: install: /usr/bin/install -c .libs/libjpeg.a /usr/local/lib/libjpeg.a
libtool: install: chmod 644 /usr/local/lib/libjpeg.a
libtool: install: ranlib /usr/local/lib/libjpeg.a
libtool: finish: PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/sbin" ldconfig -n /usr/local/lib
----------------------------------------------------------------------
Libraries have been installed in:
   /usr/local/lib

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the '-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the 'LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the 'LD_RUN_PATH' environment variable
     during linking
   - use the '-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to '/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
 /bin/mkdir -p '/usr/local/bin'
  /bin/bash ./libtool   --mode=install /usr/bin/install -c cjpeg djpeg jpegtran rdjpgcom wrjpgcom '/usr/local/bin'
libtool: install: /usr/bin/install -c .libs/cjpeg /usr/local/bin/cjpeg
libtool: install: /usr/bin/install -c .libs/djpeg /usr/local/bin/djpeg
libtool: install: /usr/bin/install -c .libs/jpegtran /usr/local/bin/jpegtran
libtool: install: /usr/bin/install -c rdjpgcom /usr/local/bin/rdjpgcom
libtool: install: /usr/bin/install -c wrjpgcom /usr/local/bin/wrjpgcom
/bin/bash /home/wbyq/work_pc/jpeg-9d/install-sh -d /usr/local/include
/usr/bin/install -c -m 644 jconfig.h /usr/local/include/jconfig.h
 /bin/mkdir -p '/usr/local/include'
 /usr/bin/install -c -m 644 jerror.h jmorecfg.h jpeglib.h '/usr/local/include'
 /bin/mkdir -p '/usr/local/share/man/man1'
 /usr/bin/install -c -m 644 cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 wrjpgcom.1 '/usr/local/share/man/man1'
 /bin/mkdir -p '/usr/local/lib/pkgconfig'
 /usr/bin/install -c -m 644 libjpeg.pc '/usr/local/lib/pkgconfig'
make[1]: 離開目錄“/home/wbyq/work_pc/jpeg-9d”

默認的安裝路徑在/usr/local/lib/ 目錄下。

如果是編譯給嵌入式Linux平臺使用可以按照下面方法配置:

./configure --prefix=/usr/local/lib CC=arm-linux-gcc --host=arm-linux --enable-shared --enable-static

四、核心代碼

video_app.c :  攝像頭採集的主要代碼

#include <stdio.h>
#include <sys/ioctl.h>
#include <linux/videodev2.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <poll.h>
#include <stdlib.h>
#include "yuv_to_jpeg.h"

int image_height;
int image_width;
unsigned char *image_buffer[4];
int uvc_video_fd;

/*
函數功能: 攝像頭設備初始化
*/
int VideoDeviceInit(char *DEVICE_NAME)
{
	/*1. 打開攝像頭設備*/
	uvc_video_fd=open(DEVICE_NAME,O_RDWR);
	if(uvc_video_fd<0)
	{
		printf("%s 攝像頭設備打開失敗!\n",DEVICE_NAME);
		return -1;
	}
	else
	{
		printf("攝像頭打開成功.\n");
	}
	
	/*2 設置攝像頭的屬性*/
	struct v4l2_format format;
	/*2.1 查詢當前攝像頭支持的格式*/
	//當前視頻設備支持的視頻圖像格式
	struct v4l2_fmtdesc fmt;
	memset(&fmt,0,sizeof(fmt));
	fmt.index = 0;
	fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
	printf("當前攝像頭支持輸出的圖像格式如下:\n");
	while(ioctl(uvc_video_fd,VIDIOC_ENUM_FMT,&fmt) == 0)
	{
		fmt.index ++ ;
		printf("<'%c%c%c%c'--'%s'>\n",
				fmt.pixelformat & 0xff,(fmt.pixelformat >> 8)&0xff,
				(fmt.pixelformat >> 16) & 0xff,(fmt.pixelformat >> 24)&0xff,
				fmt.description);
	}

	/*2.2 設置攝像頭輸出的寬度高度與顏色格式(V4L2_PIX_FMT_YUYV)*/
	memset(&format,0,sizeof(struct v4l2_format));
	format.type=V4L2_BUF_TYPE_VIDEO_CAPTURE; /*表示視頻捕獲設備*/
	format.fmt.pix.width=2000;  /*預設的寬度*/
	format.fmt.pix.height=2000; /*預設的高度*/
	format.fmt.pix.pixelformat=V4L2_PIX_FMT_YUYV; /*預設的格式*/
	format.fmt.pix.field=V4L2_FIELD_ANY; /*系統自動設置: 幀屬性*/
	if(ioctl(uvc_video_fd,VIDIOC_S_FMT,&format)) /*設置攝像頭的屬性*/
	{
		printf("攝像頭格式設置失敗!\n");
		return -2;
	}
	image_width=format.fmt.pix.width;
	image_height=format.fmt.pix.height;
	printf("攝像頭實際輸出的圖像尺寸:x=%d,y=%d\n",format.fmt.pix.width,format.fmt.pix.height);
	if(format.fmt.pix.pixelformat==V4L2_PIX_FMT_YUYV)
	{
		printf("當前攝像頭支持YUV格式圖像輸出!\n");
	}
	else
	{
		printf("當前攝像頭不支持YUV格式圖像輸出!\n");
		return -3;
	}
	
	/*2.3 設置攝像頭採集的幀率*/
	struct v4l2_streamparm streamparm;
	streamparm.type=V4L2_BUF_TYPE_VIDEO_CAPTURE; /*表示視頻捕獲設備*/
	streamparm.parm.capture.timeperframe.numerator=1;
	streamparm.parm.capture.timeperframe.denominator=30;
	printf("設置當前攝像頭採集幀率: %d秒%d幀\n",streamparm.parm.capture.timeperframe.numerator,streamparm.parm.capture.timeperframe.denominator);
	if(ioctl(uvc_video_fd,VIDIOC_S_PARM,&streamparm)) /*設置攝像頭的幀率*/
	{
		printf("設置攝像頭採集的幀率失敗!\n");
		return -3;
	}
	if(ioctl(uvc_video_fd,VIDIOC_S_PARM,&streamparm)) /*獲取攝像頭的幀率*/
	{
		printf("獲取攝像頭採集的幀率失敗!\n");
		return -3;
	}
	printf("當前攝像頭實際採集幀率: %d秒%d幀\n",streamparm.parm.capture.timeperframe.numerator,streamparm.parm.capture.timeperframe.denominator);
	
	/*3. 請求緩衝區: 申請攝像頭數據採集的緩衝區*/
	struct v4l2_requestbuffers req_buff;
	memset(&req_buff,0,sizeof(struct v4l2_requestbuffers));
	req_buff.count=4; /*預設要申請4個緩衝區*/
	req_buff.type=V4L2_BUF_TYPE_VIDEO_CAPTURE; /*視頻捕獲設備*/
	req_buff.memory=V4L2_MEMORY_MMAP; /*支持mmap內存映射*/
	if(ioctl(uvc_video_fd,VIDIOC_REQBUFS,&req_buff)) /*申請緩衝區*/
	{
		printf("申請攝像頭數據採集的緩衝區失敗!\n");
		return -4;
	}
	printf("攝像頭緩衝區申請的數量: %d\n",req_buff.count);

	/*4. 獲取緩衝區的詳細信息: 地址,編號*/
	struct v4l2_buffer buff_info;
	memset(&buff_info,0,sizeof(struct v4l2_buffer));
	int i;
	for(i=0;i<req_buff.count;i++)
	{
		buff_info.type=V4L2_BUF_TYPE_VIDEO_CAPTURE; /*視頻捕獲設備*/
		buff_info.memory=V4L2_MEMORY_MMAP; /*支持mmap內存映射*/
		if(ioctl(uvc_video_fd,VIDIOC_QUERYBUF,&buff_info)) /*獲取緩衝區的詳細信息*/
		{
			printf("獲取緩衝區的詳細信息失敗!\n");
			return -5;
		}
		/*根據攝像頭申請緩衝區信息: 使用mmap函數將內核的地址映射到進程空間*/
		image_buffer[i]=mmap(NULL,buff_info.length,PROT_READ|PROT_WRITE,MAP_SHARED,uvc_video_fd,buff_info.m.offset); 
		if(image_buffer[i]==NULL)
		{
			printf("緩衝區映射失敗!\n");
			return -6;
		}
	}

	/*5. 將緩衝區放入採集隊列*/
	memset(&buff_info,0,sizeof(struct v4l2_buffer));
	for(i=0;i<req_buff.count;i++)
	{
		buff_info.type=V4L2_BUF_TYPE_VIDEO_CAPTURE; /*視頻捕獲設備*/
		buff_info.index=i; /*緩衝區的節點編號*/
		buff_info.memory=V4L2_MEMORY_MMAP; /*支持mmap內存映射*/
		if(ioctl(uvc_video_fd,VIDIOC_QBUF,&buff_info)) /*根據節點編號將緩衝區放入隊列*/
		{
			printf("根據節點編號將緩衝區放入隊列失敗!\n");
			return -7;
		}
	}

	/*6. 啓動攝像頭數據採集*/
	int Type=V4L2_BUF_TYPE_VIDEO_CAPTURE;
	if(ioctl(uvc_video_fd,VIDIOC_STREAMON,&Type))
	{
		printf("啓動攝像頭數據採集失敗!\n");
		return -8;
	}
	return 0;
}

int main(int argc,char **argv)
{
	if(argc!=2)
	{
		printf("./app </dev/videoX>\n");
		return 0;
	}
	int err;
	char jpg_file_name[100]; /*存放JPG圖片名稱*/
	int jpg_cnt=0;
	FILE *jpg_file;
	int jpg_size;
	
	/*1. 初始化攝像頭設備*/
	err=VideoDeviceInit(argv[1]);
	printf("VideoDeviceInit=%d\n",err);

	/*2. 循環讀取攝像頭採集的數據*/
	struct pollfd fds;
	fds.fd=uvc_video_fd;
	fds.events=POLLIN;

	/*3. 申請存放JPG的數據空間*/
	unsigned char *jpg_p=malloc(image_height*image_width*3);
	
	struct v4l2_buffer video_buffer;
	while(1)
	{
		 /*(1)等待攝像頭採集數據*/
		 poll(&fds,1,-1);
		 /*(2)取出隊列裏採集完畢的緩衝區*/
		 video_buffer.type=V4L2_BUF_TYPE_VIDEO_CAPTURE; /*視頻捕獲設備*/
		 video_buffer.memory=V4L2_MEMORY_MMAP;
		 ioctl(uvc_video_fd,VIDIOC_DQBUF,&video_buffer);
         /*(3)處理圖像數據*/
	     printf("image_buffer[%d]=%X\n",video_buffer.index,image_buffer[video_buffer.index]);
    
		 /*YUV數據轉JPEG格式*/
		 jpg_size=yuv_to_jpeg(image_width,image_height,image_height*image_width*3,image_buffer[video_buffer.index],jpg_p,80);
		 sprintf(jpg_file_name,"%d.jpg",jpg_cnt++);
		 printf("圖片名稱:%s,字節大小:%d\n",jpg_file_name,jpg_size);
		 
		 jpg_file=fopen(jpg_file_name,"wb");
		 fwrite(jpg_p,1,jpg_size,jpg_file);
		 fclose(jpg_file);
		 
		 /*(4)將緩衝區再放入隊列*/
		 ioctl(uvc_video_fd,VIDIOC_QBUF,&video_buffer);
	}
	return 0;
}

yuv_to_jpg.c :  YUV格式圖片轉JPG格式圖片核心代碼

#include "yuv_to_jpeg.h"

#define OUTPUT_BUF_SIZE  4096
typedef struct 
{
  struct jpeg_destination_mgr pub; /* public fields */
  JOCTET * buffer;    /* start of buffer */
  unsigned char *outbuffer;
  int outbuffer_size;
  unsigned char *outbuffer_cursor;
  int *written;

} mjpg_destination_mgr;
typedef mjpg_destination_mgr *mjpg_dest_ptr;

/******************************************************************************
函數功能: 初始化輸出的目的地
******************************************************************************/
METHODDEF(void) init_destination(j_compress_ptr cinfo) 
{
  mjpg_dest_ptr dest = (mjpg_dest_ptr) cinfo->dest;

  /* Allocate the output buffer --- it will be released when done with image */
  dest->buffer = (JOCTET *)(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, OUTPUT_BUF_SIZE * sizeof(JOCTET));

  *(dest->written) = 0;

  dest->pub.next_output_byte = dest->buffer;
  dest->pub.free_in_buffer = OUTPUT_BUF_SIZE;
}

/******************************************************************************
函數功能: 當jpeg緩衝區填滿時調用
******************************************************************************/
METHODDEF(boolean) empty_output_buffer(j_compress_ptr cinfo) 
{
  mjpg_dest_ptr dest = (mjpg_dest_ptr) cinfo->dest;

  memcpy(dest->outbuffer_cursor, dest->buffer, OUTPUT_BUF_SIZE);
  dest->outbuffer_cursor += OUTPUT_BUF_SIZE;
  *(dest->written) += OUTPUT_BUF_SIZE;

  dest->pub.next_output_byte = dest->buffer;
  dest->pub.free_in_buffer = OUTPUT_BUF_SIZE;

  return TRUE;
}

/******************************************************************************
函數功能:在寫入所有數據之後,由jpeg_finish_compress調用。通常需要刷新緩衝區。
******************************************************************************/
METHODDEF(void) term_destination(j_compress_ptr cinfo) 
{
  mjpg_dest_ptr dest = (mjpg_dest_ptr) cinfo->dest;
  size_t datacount = OUTPUT_BUF_SIZE - dest->pub.free_in_buffer;

  /* Write any data remaining in the buffer */
  memcpy(dest->outbuffer_cursor, dest->buffer, datacount);
  dest->outbuffer_cursor += datacount;
  *(dest->written) += datacount;
}

/******************************************************************************
功能描述:初始化輸出流
函數參數:
		j_compress_ptr cinfo  :保存JPG圖像壓縮信息的結構體地址
		unsigned char *buffer :存放壓縮之後的JPG圖片的緩衝區首地址
		int size              :源圖像字節總大小
		int *written          :存放壓縮之後的JPG圖像字節大小
******************************************************************************/
GLOBAL(void) dest_buffer(j_compress_ptr cinfo, unsigned char *buffer, int size, int *written)
{
  mjpg_dest_ptr dest;

  if (cinfo->dest == NULL) {
    cinfo->dest = (struct jpeg_destination_mgr *)(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, sizeof(mjpg_destination_mgr));
  }

  dest = (mjpg_dest_ptr) cinfo->dest;
  dest->pub.init_destination = init_destination;
  dest->pub.empty_output_buffer = empty_output_buffer;
  dest->pub.term_destination = term_destination;
  dest->outbuffer = buffer;
  dest->outbuffer_size = size;
  dest->outbuffer_cursor = buffer;
  dest->written = written;
}

/************************************************
功能描述:將YUV格式的數據轉爲JPG格式。
函數參數:
	int Width    源圖像寬度
	int Height   源圖像高度
	int size   	 源圖像字節總大小
	unsigned char *yuv_buffer :存放YUV源圖像數據緩衝區的首地址
	unsigned char *jpg_buffer :存放轉換之後的JPG格式數據緩衝區首地址
	int quality               :jpg圖像的壓縮質量(值越大質量越好,圖片就越清晰,佔用的內存也就越大)
							一般取值範圍是: 10 ~ 100 。 填10圖片就有些模糊了,一般的JPG圖片都是質量都是80。
返回值:壓縮之後的JPG圖像大小
**************************************************************/
int yuv_to_jpeg(int Width,int Height,int size,unsigned char *yuv_buffer, unsigned char *jpg_buffer, int quality) 
{
  struct jpeg_compress_struct cinfo;
  struct jpeg_error_mgr jerr;
  JSAMPROW row_pointer[1];
  unsigned char *line_buffer, *yuyv;
  int z;
  static int written;
	
  /*1. 解壓之前的初始化*/
  line_buffer =(unsigned char *)calloc(Width*3,1);
  yuyv=yuv_buffer; //得到圖像源數據

  cinfo.err = jpeg_std_error (&jerr);
  jpeg_create_compress (&cinfo);
  
  /* 原版jpeglib庫的標準輸出初始化函數,只能填文件指針: jpeg_stdio_dest (&cinfo, file); */
  /* 修改之後的標準輸出初始化函數,將輸出指向內存空間*/
  dest_buffer(&cinfo, jpg_buffer, size, &written);
	
  cinfo.image_width = Width;
  cinfo.image_height =Height;
  cinfo.input_components = 3;
  cinfo.in_color_space = JCS_RGB;

  jpeg_set_defaults (&cinfo);
  jpeg_set_quality (&cinfo, quality, TRUE);

  jpeg_start_compress (&cinfo, TRUE);

  /*2. YUV轉RGB格式*/
  z = 0;
  while (cinfo.next_scanline < Height) 
  {
    int x;
    unsigned char *ptr = line_buffer;

    for (x = 0; x < Width; x++) {
      int r, g, b;
      int y, u, v;

      if (!z)
        y = yuyv[0] << 8;
      else
        y = yuyv[2] << 8;
      u = yuyv[1] - 128;
      v = yuyv[3] - 128;

      r = (y + (359 * v)) >> 8;
      g = (y - (88 * u) - (183 * v)) >> 8;
      b = (y + (454 * u)) >> 8;

      *(ptr++) = (r > 255) ? 255 : ((r < 0) ? 0 : r);
      *(ptr++) = (g > 255) ? 255 : ((g < 0) ? 0 : g);
      *(ptr++) = (b > 255) ? 255 : ((b < 0) ? 0 : b);

      if (z++) {
        z = 0;
        yuyv += 4;
      }
    }
	/*3.進行JPG圖像壓縮(一行一行壓縮)*/
    row_pointer[0] = line_buffer;
    jpeg_write_scanlines(&cinfo, row_pointer, 1);
  }
   
   /*4. 釋放壓縮時佔用的內存空間*/
  jpeg_finish_compress(&cinfo);
  jpeg_destroy_compress(&cinfo);
  free (line_buffer);
  
   /*5. 返回壓縮之後JPG圖片大小*/
  return (written);
}

yuv_to_jpg.h :  YUV轉JPG代碼的頭文件

#ifndef YUC_TO_JPEG_H
#define YUC_TO_JPEG_H
#include <stdio.h>
#include <jpeglib.h>
#include <stdlib.h>
#include <string.h>

int yuv_to_jpeg(int Width,int Height,int size,unsigned char *yuv_buffer, unsigned char *jpg_buffer, int quality);
#endif


Makefile 文件代碼:

all:
	gcc video_app.c yuv_to_jpeg.c -o app -ljpeg

五、編譯運行-測試效果

如果運行時提示找不到庫,可以先搜索庫的路徑,將庫的路徑加入到環境變量裏即可:

error while loading shared libraries: libjpeg.so.9: cannot open shared object file: No such file or directory
 

wbyq@wbyq:/mnt/hgfs/linux-share-dir/linux_c/yuv_save_jpg$ ./app 
./app: error while loading shared libraries: libjpeg.so.9: cannot open shared object file: No such file or directory
wbyq@wbyq:/mnt/hgfs/linux-share-dir/linux_c/yuv_save_jpg$ sudo find / -name libjpeg.so.9
find: ‘/run/user/1000/gvfs’: 權限不夠
/home/wbyq/work_pc/jpeg-9d/.libs/libjpeg.so.9
/usr/local/lib/libjpeg.so.9
wbyq@wbyq:/mnt/hgfs/linux-share-dir/linux_c/yuv_save_jpg$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/

編譯程序運行步驟如下:

wbyq@wbyq:/mnt/hgfs/linux-share-dir/linux_c/yuv_save_jpg$ make
gcc video_app.c yuv_to_jpeg.c -o app -ljpeg
video_app.c: In function ‘main’:
video_app.c:190:33: warning: format ‘%X’ expects argument of type ‘unsigned int’, but argument 3 has type ‘unsigned char *’ [-Wformat=]
       printf("image_buffer[%d]=%X\n",video_buffer.index,image_buffer[video_buffer.index]);
                                ~^                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                %hhn
wbyq@wbyq:/mnt/hgfs/linux-share-dir/linux_c/yuv_save_jpg$ ./app 
./app: error while loading shared libraries: libjpeg.so.9: cannot open shared object file: No such file or directory
wbyq@wbyq:/mnt/hgfs/linux-share-dir/linux_c/yuv_save_jpg$ sudo find / -name libjpeg.so.9
find: ‘/run/user/1000/gvfs’: 權限不夠
/home/wbyq/work_pc/jpeg-9d/.libs/libjpeg.so.9
/usr/local/lib/libjpeg.so.9
wbyq@wbyq:/mnt/hgfs/linux-share-dir/linux_c/yuv_save_jpg$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/
wbyq@wbyq:/mnt/hgfs/linux-share-dir/linux_c/yuv_save_jpg$ ./app 
./app </dev/videoX>
wbyq@wbyq:/mnt/hgfs/linux-share-dir/linux_c/yuv_save_jpg$ ./app /dev/video0 
攝像頭打開成功.
當前攝像頭支持輸出的圖像格式如下:
<'YUYV'--'YUYV 4:2:2'>
<'MJPG'--'Motion-JPEG'>
攝像頭實際輸出的圖像尺寸:x=1280,y=960
當前攝像頭支持YUV格式圖像輸出!
設置當前攝像頭採集幀率: 1秒30幀
當前攝像頭實際採集幀率: 2秒15幀
攝像頭緩衝區申請的數量: 4
VideoDeviceInit=0
image_buffer[0]=4C129000
圖片名稱:0.jpg,字節大小:135722
image_buffer[1]=4BED1000
圖片名稱:1.jpg,字節大小:135722
image_buffer[2]=4BC79000
圖片名稱:2.jpg,字節大小:135722
image_buffer[3]=4BA21000
圖片名稱:3.jpg,字節大小:135722
image_buffer[0]=4C129000
圖片名稱:4.jpg,字節大小:132494
image_buffer[1]=4BED1000
圖片名稱:5.jpg,字節大小:132494
image_buffer[2]=4BC79000
圖片名稱:6.jpg,字節大小:132494
image_buffer[3]=4BA21000
圖片名稱:7.jpg,字節大小:132494
image_buffer[0]=4C129000
圖片名稱:8.jpg,字節大小:126119
image_buffer[1]=4BED1000
圖片名稱:9.jpg,字節大小:126119
image_buffer[2]=4BC79000
圖片名稱:10.jpg,字節大小:126119
image_buffer[3]=4BA21000
圖片名稱:11.jpg,字節大小:126119

程序停止,可以按下Ctrl+C。

 

下面圖片是採集的效果。

 

 

下面公衆號有全套的單片機、QT、C++、C基礎教程:歡迎關注

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章