File tree 1 file changed +61
-1
lines changed
1 file changed +61
-1
lines changed Original file line number Diff line number Diff line change 12
12
###运行要求
13
13
1 . OpenCV 2.4.9 for Python
14
14
2 . Python 2.7
15
+ 3 . v4l2
16
+ 4 . PyQt4
15
17
16
18
###安装要求
17
- ...
19
+
20
+ ``` bash
21
+ sudo apt-get install build-essential cmake pkg-config python-dev libgtk2.0-dev libgtk2.0 zlib1g-dev libpng-dev libjpeg-dev libtiff-dev libjasper-dev libavcodec-dev swig unzip
22
+ ```
23
+
24
+ 1. 启用v4l2
25
+ ``` bash
26
+ sudo nano /etc/modules
27
+ # 增加一行记录
28
+ bcm2835-v4l2
29
+ # 重启后可以找到/dev/video0
30
+
31
+ # 编译v4l2-util
32
+ apt-get install autoconf gettext libtool libjpeg8 libjpeg8-dev
33
+ git clone git://git.linuxtv.org/v4l-utils.git
34
+ cd v4l-utils/
35
+ sudo ./bootstrap.sh
36
+ ./configure
37
+ make
38
+ sudo make install
39
+ ```
40
+
41
+ 2. 编译OpenCV 2.4.9
42
+
43
+ ``` bash
44
+ wget https://jaist.dl.sourceforge.net/project/opencvlibrary/opencv-unix/2.4.9/opencv-2.4.9.zip
45
+ unzip opencv-2.4.9.zip
46
+ cd opencv-2.4.9/
47
+ cmake -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=/usr/local -DBUILD_PERF_TESTS=OFF -DBUILD_opencv_gpu=OFF -DBUILD_opencv_ocl=OFF
48
+
49
+ # 要使OpenCV开启对v4l2的支持 cmake之后要有以下输出
50
+ # V4L/V4L2: Using libv4l (ver 1.13.0)
51
+
52
+ make
53
+ sudo make install
54
+ ```
55
+
56
+ 3 . 安装PyQt4
57
+ ``` bash
58
+ sudo apt-get install python-qt4
59
+ ```
60
+
61
+ 4 . 运行
62
+ ``` bash
63
+ python main.py
64
+ ```
65
+
66
+ ###注意
67
+
68
+ 该示例运行的屏幕分辨率为竖屏480 x 800,可以修改 /boot/config.txt 的以下配置
69
+
70
+ [ config.txt配置说明] ( https://www.raspberrypi.org/documentation/configuration/config-txt.md )
71
+ ``` bash
72
+ hdmi_cvt=800 480 60 6
73
+ hdmi_group=2
74
+ hdmi_mode=87
75
+ # 设置屏幕旋转角度
76
+ display_rotate=3
77
+ ```
You can’t perform that action at this time.
0 commit comments