博文

目前显示的是标签为“webcam”的博文

Ubuntu下使用OpenCV库保存摄相头数据为图片(arm)

在《移植OpenCV3.1到BBB-Debian》一文件中配置好的环境为前提(后期不特别说明,ARM版的例子均以该环境为基础),编写使用OpenCV库保存WEBCAM的数据为图片的代码,下面是相应的源码和编译配置文件(都保存在SaveCamPic目录下): 1.源码scp.cpp #include <stdio.h> #include <sys/stat.h> #include <sys/types.h> #include <time.h> #include <sys/timeb.h> #include <stdlib.h> #include <cv.h> #include <cxcore.h> //#include <highgui.h> int main( int argc,char ** argv ) { //声明IplImage指针 IplImage* pFrame=NULL; IplImage* pSaveFrame=NULL; CvCapture* pCapture=NULL; static char filename[40]; struct tm * tm_ptr; struct timeb tp; int p[3]; p[0] = CV_IMWRITE_JPEG_QUALITY; p[1] = 10; //质量值 p[2] = 0; //cvNamedWindow("video",1); if( !(pCapture=cvCaptureFromCAM(0 /*-1*/)) ) //此处值为-1表示自动搜索到的第一个摄象头,而0则表示第一个,1则表示第2个,以此类推。 { fprintf(stderr,"Can not open camera.\n"); return -1; } if(mkdir("./Alert",0755)==-1) { //创建时存在该目录会返回错误码,如不存在则创建...

Ubuntu下使用OpenCV库保存摄相头数据为图片(x86/x64)

在《在Ubuntu15.04上源码编译安装ffmpeg3.0和OpenCV3.1》一文件中配置好的环境为前提(后期不特别说明,x86/x64版的例子均以该环境为基础),编写使用OpenCV库保存WEBCAM的数据为图片的代码,下面是相应的源码和编译配置文件(都保存在SaveCamPic目录下): 1.源码scp.cpp #include <stdio.h> #include <sys/stat.h> #include <sys/types.h> #include <time.h> #include <sys/timeb.h> #include <stdlib.h> #include <cv.h> #include <cxcore.h> #include <highgui.h> int main( int argc,char ** argv ) { //声明IplImage指针 IplImage* pFrame=NULL; IplImage* pSaveFrame=NULL; CvCapture* pCapture=NULL; static char filename[40]; struct tm * tm_ptr; struct timeb tp; int p[3]; p[0] = CV_IMWRITE_JPEG_QUALITY; p[1] = 10; //质量值 p[2] = 0; cvNamedWindow("video",1); if( !(pCapture=cvCaptureFromCAM(0 /*-1*/)) ) //此处值为-1表示自动搜索到的第一个摄象头,而0则表示第一个,1则表示第2个,以此类推。 { fprintf(stderr,"Can not open camera.\n"); return -1; } if(mkdir("./Alert",0755)==-1) { //创建时存在该...