forked from lagadic/visp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tutorial-install-raspberry.doc
369 lines (294 loc) · 12.8 KB
/
tutorial-install-raspberry.doc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
/**
\page tutorial-install-raspberry Tutorial: Installation from source on Raspberry Pi
\tableofcontents
In this tutorial you will learn how to install ViSP from source on <a href="http:https://www.raspberrypi.org/help/what-is-a-raspberry-pi">Raspberry Pi 1 or Pi 2</a> equipped with an optional HD camera module.
\image html img-raspberry-pi.jpg
In a first section we give some useful instructions to start with a Raspberry PI. Then in the second section, we focus on the installation of ViSP from source.
\note Concerning ViSP installation, we provide also other \ref tutorial.
\section install_raspberry Raspberry Pi installation
\subsection install_raspberry_setup Setting up Raspberry Pi
There are a lot of documentation and tutorial that explain different ways to setup a Raspberry Pi. A good reference is the official page <a href="http:https://www.raspberrypi.org/">http:https://www.raspberrypi.org</a>
We suggest to start with NOOBS (New Out Of the Box Software). Bellow we resume the different steps that are fully described in <a href="http:https://www.raspberrypi.org/help/noobs-setup/">http:https://www.raspberrypi.org/help/noobs-setup</a>:
- Format you SD card (at least 4Go are requested) on your computer. To this end you can use "GParted partition editor" under Ubuntu.
- Download Noobs "Offline and network install" zip file from <a href="http:https://www.raspberrypi.org/downloads/">http:https://www.raspberrypi.org/downloads</a>.
- Unzip all the files on the SD card.
- Insert your SD Card into your Raspberry Pi.
- Plug in your keyboard, mouse, monitor and Ethernet cables.
- Now plug in the USB power cable to your Pi.
- Your Raspberry Pi will boot, and a window will appear with a list of different operating systems that you can install. Select the "recommended Raspbian" checkbox and click on "Install" button.
- When the install process has completed, the Raspberry Pi configuration menu (raspi-config) will load. Here you are able to set the time and date for your region and enable a Raspberry Pi camera board, or even create users. You can exit this menu by using Tab on your keyboard to move to Finish.
\subsection install_raspberry_login Logging in
The default login for Raspbian is username \c pi with the password \c raspberry.
\subsection update Update your Raspbian distribution
If your Raspberry Pi is connected to Ethernet you can update your Raspbian distribution:
\code
sudo apt-get update
sudo apt-get upgrade
\endcode
\subsection install_raspberry_camera Setting up a Raspberry Pi camera
If you have a Raspberry Pi camera module see <a href="http:https://www.raspberrypi.org/help/camera-module-setup/">http:https://www.raspberrypi.org/help/camera-module-setup</a>. To resume, enable the camera using:
\code
sudo raspi-config
\endcode
Enter in menu 5/ to enable the camera.
Then load the camera module:
\code
sudo modprobe bcm2835-v4l2
\endcode
This will add the following modules:
\code
pi@raspberrypi ~ $ lsmod
Module Size Used by
bcm2835_v4l2 37611 0
videobuf2_core 30853 1 bcm2835_v4l2
v4l2_common 7792 1 bcm2835_v4l2
videodev 121362 3 bcm2835_v4l2,v4l2_common,videobuf2_core
\endcode
To check if the camera is recognized and connected, run:
\code
v4l2-ctl --list-formats
\endcode
After each Raspberry Pi reboot you need to relaunch the previous modprobe command. To load bcm2835-v4l2 module during reboot, you can edit \c /etc/modules file
\code
sudo nano /etc/modules
\endcode
and add a line with the name of the module:
\code
bcm2835-v4l2
\endcode
\subsection install_raspberry_startx Start graphical user interface
To load the graphical user interface, type \c startx and press Enter on your keyboard. This will later allow to use ViSP vpDisplayX or vpDisplayOpenCV classes useful to display images in a X11 window.
\section install_raspberry_visp ViSP installation
\subsection install_raspberry_visp_prerequisities Install prerequisities
First you need to install the following packagages (g++, CMake, Git) that are requested to get and build ViSP:
\code
sudo apt-get install build-essential cmake-curses-gui git
\endcode
\subsection install_raspberry_visp_3rd_party Install 3rd parties
ViSP is interfaced with several optional 3rd party libraries. The <a href="http:https://visp.inria.fr/software-architecture">complete list is provided here</a>.
\subsubsection install_raspberry_visp_3rd_party_recommended Recommended 3rd parties
We recommend to install the following:
- OpenCV
\code
sudo apt-get install libopencv-dev
\endcode
- libX11 to be able to open a window to display images
\code
sudo apt-get install libx11-dev
\endcode
- lapack to benefit from optimized mathematical capabilities
\code
sudo apt-get install liblapack-dev
\endcode
- libv4l to grab images from usb or analogic cameras
\code
sudo apt-get install libv4l-dev
\endcode
- libxml2 to be able to configure the model-based trackers from xml files
\code
sudo apt-get install libxml2-dev
\endcode
- QR code detection
\code
sudo apt-get install libzbar-dev
\endcode
\subsubsection install_raspberry_visp_3rd_party_other Other optional 3rd parties
We give also the way to install other 3rd party libraries to enable specific capabilities.
- libjpeg and libpng to support jpeg and png images respectively (only useful if OpenCV is not installed)
\code
sudo apt-get install libjpeg-dev libpng12-dev
\endcode
\subsection install_raspberry_visp_install Install ViSP from source code
\subsubsection install_raspberry_visp_get_source Getting ViSP source code
There are different ways to get ViSP source code on Raspberry Pi:
- You can download the <a href="http:https://visp.inria.fr/download">latest release</a> as a zip or a tarball. Once downloaded, uncompress the file using either
\code
mkdir /home/pi/soft; cd /home/pi/soft
tar xvzf visp-x.y.z.tar.gz
\endcode
or
\code
mkdir /home/pi/soft; cd /home/pi/soft
unzip visp-x.y.z.zip
\endcode
- You can also download a <a href="http:https://visp.inria.fr/download#snapshot">daily snapshot</a>. Once downloaded, uncompress the file using
\code
tar xvzf visp-snapshot-yyyy-mm-dd.tar.gz
\endcode
- Or you get the cutting-edge ViSP from <a href="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/lagadic/visp">GitHub repository</a> using the following command
\code
$ git clone https://github.com/lagadic/visp.git
\endcode
We suppose now that ViSP source is in a directory denoted \<source_dir\>, for example \c /home/pi/soft/visp
\subsubsection install_raspberry_visp_config Configuring ViSP from source
- Create first a directory denoted \<binary_dir\> where you want to build ViSP. This directory will contain generated Makefiles, object files, and output libraries and binaries.
\code
cd /home/pi/soft; mkdir visp-build
\endcode
- Enter \<binary_dir\> and configure the build:
\code
cd /home/pi/soft/visp-build
cmake ../visp
\endcode
A more versatile way to configure the build is to use \c ccmake, the CMake GUI:
\code
ccmake ../visp
\endcode
The following image shows that this command allows to configure (just by pressing [c] key) the build in a more advanced way where some options could be easily turned On/Off. It allows also to see which are the 3rd parties that will be used. Then to generate the makefiles, just press [g] key in the ccmake gui.
\image html img-ccmake-ubuntu-all.png Snapshot of the ccmake \c ../visp command used to configure ViSP.
\subsubsection install_raspberry_visp_build Building ViSP from source
- To build ViSP proceed with:
\code
make
\endcode
- To install ViSP proceed with:
\code
sudo make install
\endcode
- To build ViSP documentation, you have first to install Doxygen package:
\code
sudo apt-get install doxygen graphviz texlive-latex-base
\endcode
Then you can proceed with:
\code
make -j4 visp_doc
\endcode
\subsection install_raspberry_dataset Install ViSP dataset
Some ViSP examples and tests require data (images, video, models) that are not part of ViSP source code but available in a separate archive named \c ViSP-images-x.y.z.zip. This archive could be downloaded from http:https://visp.inria.fr/download page. We provide here after the way to install these data if you want to run ViSP examples.
\code
cd $HOME
unzip ViSP-images-x.y.z.zip
\endcode
We suppose now that the data are located in \c $HOME/ViSP-images.
\code
$ ls $HOME/ViSP-images
Klimt README.md circle ellipse iv mbt mire-2
LICENSE.txt calibration cube ellipse-1 line mire video
\endcode
Set \c VISP_INPUT_IMAGE_PATH environment variable to help ViSP examples and tests to find the location of the data set. It's convenient if the environment variables is automatically added to your bash session every time a new shell is launched:
\code
echo "export VISP_INPUT_IMAGE_PATH=$HOME" >> ~/.bashrc
source ~/.bashrc
\endcode
\note For historical reasons \c VISP_INPUT_IMAGE_PATH should not contain the folder \c ViSP-images, but the parent folder.
From now, you can try to run ViSP examples and tests. For example you can run \c displayX example that should open a windows with Klimt painting image and some overlay drawings:
\code
$ cd $HOME/visp-build
$ ./example/device/display/displayX
A click to close the windows...
A click to display a cross...
Cross position: 201, 441
A click to exit the program...
Bye
\endcode
\section install_raspberry_tips Tips and tricks
\subsection install_raspberry_tips_uninstall How to uninstall ViSP
After ViSP installation, you can remove installed material using:
\code
$ sudo make uninstall
\endcode
\subsection install_raspberry_tips_modules How to build only ViSP libraries
If you want to build only ViSP modules libraries, nor the examples, tutorials and tests:
\code
$ make -j4 visp_modules
\endcode
\subsection install_raspberry_tips_module_once How to build a ViSP specific module
If you want to build a given module and all the dependencies:
\code
$ make -j4 visp_<module_name>
\endcode
For example to build the model-based tracker module named mbt, run:
\code
$ make -j4 visp_mbt
\endcode
\subsection install_raspberry_tips_target Which are the targets that could be run with make ?
To know which are the target available with \c make:
\code
$ make help | grep visp
... visp_tests
... visp_demos
... visp_tutorials
... visp_examples
... visp_modules
... visp_doc
... visp_core
... visp_detection
... visp_gui
... visp_io
... visp_klt
... visp_me
... visp_robot
... visp_sensor
... visp_ar
... visp_blob
... visp_visual_features
... visp_vs
... visp_vision
... visp_mbt
... visp_tt
... visp_tt_mi
\endcode
\subsection install_raspberry_tips_3rd_party Which are the 3rd party libraries that are used in ViSP ?
To see which are the optional 3rd parties that are found during the configuration stage and that will be used by ViSP during the build you can have a look to the text file named \c ViSP-third-party.txt and located in \<binary_dir\>. We provide hereafter an example of a possible content of this file:
\code
ViSP third-party libraries
Below you will find the list of third party libraries used to
build ViSP on your computer.
Mathematics:
Gnu Scientific Library : no
Lapack/blas : yes
Simulator:
Ogre simulator : no
\- Ogre3D : no
\- OIS : no
Coin simulator : no
\- Coin3D : no
\- SoWin : no
\- SoXt : no
\- SoQt : no
\- Qt4 : no
\- Qt3 : no
Robots
Afma6 : no
Afma4 : no
Biclops : no
Ptu46 : no
Pioneer : no
Viper S650 : no
Viper S850 : no
Video devices (display)
X11 : yes
GTK : no
OpenCV : yes
GDI : no
Direct3D : no
Framegrabbers
Firewire libdc1394-2.x : no
Video For Linux Two : yes
DirectShow : no
CMU 1394 Digital Camera SDK : no
OpenCV : yes
Specific devices
Yarp : no
Kinect : no
\-libfreenect : no
\-libusb-1.0 : no
\-pthread : no
Video and image Read/Write:
FFMPEG : no
libjpeg : yes
libpng : yes
Misc:
XML2 : yes
pthread : yes
OpenMP : no
zbar : yes
dmtx : no
Documentation:
Doxygen : no
Graphviz dot : no
ViSP built with C++11 features: no
\endcode
\section install_raspberry_next Next tutorial
You are now ready to see the next \ref tutorial-getting-started that will show you how to use ViSP as a 3rd party to build your own project on Raspberry Pi or on any other system. Then if you have a Raspberry Pi camera module, you can also follow the \ref tutorial-tracking-blob especially subsection Tracking form v4l2 live cameras.
*/