1.使用opkg安装 cmake
- <span style="line-height: 19.0909px;">root@edison:~#</span>vim /etc/opkg/base-feeds
复制代码
替换的内容如下
- src/gz all http://repo.opkg.net/edison/repo/all
- src/gz edison http://repo.opkg.net/edison/repo/edison
- src/gz core2-32 http://repo.opkg.net/edison/repo/core2-32
复制代码
- root@edison:~# opkg update
- root@edison:~# opkg install cmake-dev
复制代码
2.使用opkg安装 opencv- root@edison:~#opkg install opencv-dev//安装时间大约半小时
- usb口插入uvc摄像头
- root@edison:~#modprobe uvcvideo
- root@edison:~#lsmod
- root@edison:~#vim /home/root/opencv/test
复制代码
- <div class="blockcode"><blockquote><div class="blockcode"><blockquote>#include <stdio.h>
- #include <iostream>
- #include "opencv2/opencv.hpp"
- #include "opencv2/core/core.hpp"
- #include "opencv2/video/background_segm.hpp"
- #include "opencv2/imgproc/imgproc_c.h"
- #include "opencv2/imgproc/imgproc.hpp"
- #include "opencv2/highgui/highgui.hpp"
- #include "opencv2/legacy/legacy.hpp"
- #include "opencv2/video/tracking.hpp"
- #include "opencv2/photo/photo.hpp"
-
- using namespace std;
-
- int main()
- {
- IplImage *frame = NULL;
- int num = 0;
- int key;
- CvCapture *input_camera = cvCaptureFromCAM(-1);
- frame = cvQueryFrame(input_camera);
- while(frame != NULL)
- {
- num++;
- cout<<"i see u "<<endl;
-
- frame = cvQueryFrame(input_camera);
-
- if(num ==10)
- {
- cvSaveImage("lanfeng.png",frame);
- }
- }
- cvReleaseCapture(&input_camera);
- return 0;
- }
复制代码
- root@edison:~#g++ test.cpp -o test-lopencv_core -lopencv_highgui -lopencv_video
- root@edison:~#./test
复制代码
运行成功之后可以看到在 /home/root/opencv 中新 ”test.png“ |