99d030037a737f2182cf3107e346ce29dfb1ddb3
[opencv] / INSTALL
1 Basic Installation
2 ==================
3
4 Windows
5 =======
6
7     Installation under Windows is pretty strightforward.
8     Download executable installation from SourceForge and run it.
9     It installs OpenCV, registers DirectShow filters and performs
10     other post-installation procedures.
11     After that you can start using OpenCV.
12
13     Building OpenCV from sources
14     ----------------------------
15
16     Also, it is possible to build the modified OpenCV from source, or
17     build the latest OpenCV snapshot,
18     obtained from SourceForge CVS (see http://sourceforge.net/cvs/?group_id=22870).
19
20     +++ These are instructions for MSVC 6.0, MSVC.NET 2003 and MSVC.NET 2005
21
22     * Specify the appropriate CVSROOT (see the link above) in WinCVS and
23       checkout the module "opencv".
24     * Open opencv\_make\opencv.dsw (in case of MSVC 6.0 or MSVC.NET 2003, in the latter
25       case they will be converted to MSVC.NET 2003 project files),
26       or opencv\_make\opencv.sln (in case of MSVC.NET 2005)
27     * Select the configuration of interest, for example, Win32 Release, and build it.
28     * Add opencv\bin to the system PATH.
29       The path can be modified at
30       MyComputer--[right button click]-->Properties->Advanced->Environment Variables.
31
32     +++ One may also build OpenCV with command-line tools from Microsoft Platform SDK
33         (Intel compiler can optionally be used instead of the one from Microsoft),
34         or with MinGW - native GNU C/C++ port to Win32.
35         The platforms supported are: Win32 on IA32, Win64 on EM64T/AMD64, Win64 on Itanium.
36
37     * Install platform SDK or MinGW (with GCC 3.x or 4.x),
38       Intel Compiler 9.0 or later (if needed)
39     * Edit opencv\_make\make_cfg.mak, correct the paths to the SDK and ICC.
40     * In the command-line prompt:
41       * Enter opencv\_make directory
42       * Run of the following:
43         nmake /f makefile.32 - build IA32 version with cl compiler
44         nmake /f makefile.icc - build IA32 version with icc (icl) compiler
45         nmake /f makefile.vs - build IA32 version with cl compiler,
46                                environment variables are used instead of the Platform SDK.
47                                (ideal as command-line alternative to MSVC 6.0)
48         nmake /f makefile.64 - build EM64T/AMD64 version using Platform SDK
49                                (the produced DLLs will have _64 suffix)
50         nmake /f makefile.i7 - build Itanium version using Platform SDK
51                                (the produced DLLs will have _i7 suffix).
52
53         mingw32-make -f make_all_gnu.mak - build IA32 version with gcc compiler
54                 (Make sure that <gcc_root>\bin is in the system path.
55                  To build VFW-enabled highgui, read instructions in
56                  opencv\otherlibs\_graphics\readme.txt)
57
58    How to test built OpenCV binaries
59    ---------------------------------
60
61    Build and run samples at opencv\samples\c.
62    (Note: some of the demos need an AVI file or a camera, e.g. motempl.c)
63    
64    or run algorithmic tests: opencv\bin\cxcoretest.exe, opencv\bin\cvtest.exe.
65    It will produce cxcoretest.sum and cvtest.sum, respectively, that should hopefully
66    contain all OK's.
67
68    How to add IPP support
69    ----------------------
70
71    + Obtain IPP from Intel site (http://www.intel.com/software/products/ipp/index.htm),
72      version 5.1 or later is preferrable, and install it.
73    + Make sure the appropriate binary folder
74      (e.g. c:\program files\intel\ipp\5.1\ia32\bin) is in the system path.
75    + That's it. IPP should be automatically detected by OpenCV and loaded at runtime.
76    + To smaller memory footprint and shorter application loading time,
77      it is possible to build custom IPP dll for OpenCV, ippopencv*.dll, see interfaces\ipp.
78    + It is possible to load/unload IPP at runtime, see cvUseOptimized() function.
79
80
81 Linux
82 =====
83
84    There are no prebuilt binaries for Linux versions (because of a large variety of
85    different versions of GCC and GLIBC in different distributions) from our side. So, if
86    your distributor (SuSE, Debian, Ubuntu) doesn't offer OpenCV, you'll have
87    to build it from sources.
88
89    That's what you need to build fully-functionaly libraries and demos:
90    ======
91
92    + GTK+ 2.x or higher including headers
93
94    + pkgconfig
95
96    + libpng, zlib, libjpeg, libtiff, libjasper with development files.
97
98    + Python 2.3, 2.4 or 2.5 with headers installed (developer package)
99
100    + libavcodec, etc. from ffmpeg 0.4.9-pre1 or later + headers.
101      Earlier versions do not work with OpenCV because of different API.
102      libavcodec is LGPL software, so to use it with non-GPL software (such as OpenCV)
103      you need to build and use a _shared_ library libavcodec.so.*:
104         get ffmpeg from ffmpeg.sourceforge.net
105         ./configure --enable-shared
106         make
107         make install
108         you will have got: /usr/local/lib/libavcodec.so.*
109                            /usr/local/lib/libavformat.so.*
110                           (/usr/local/lib/libavutil.so.* for newer versions)
111                            /usr/local/include/ffmpeg/*.h
112
113    Now build OpenCV:  
114    ======
115    
116    a) if your distribution uses RPM, you may build RPMs using:
117          rpmbuild -ta OpenCV-x.y.z.tar.gz (for RPM 4.x or later) or
118          rpm -ta OpenCV-x.y.z.tar.gz" (for eariler versions of RPM)
119       where OpenCV-x.y.z.tar.gz should be put to /usr/src/redhat/SOURCES/ or
120       similar directory  
121
122       it will build OpenCV-x.y.z.*.rpm
123       (there is no OpenCV-devel, everything is in one package)
124       
125       then install it by:
126         rpm -i OpenCV-x.y.z.*.rpm
127       
128    b) if your distribution does not support RPM, build and install it
129       in Unix/Linux traditional way:
130
131         ./configure
132         make
133         sudo make install
134         sudo ldconfig
135
136       You can influence which libraries are used and which features are
137       enabled by specifying the appropriate flags to ./configure. 
138
139       See './configure --help' for more information.
140
141
142    both a&b (post-install))
143       
144       default installation path is /usr/local/lib and /usr/local/include/opencv,
145       so you need to add /usr/local/lib to /etc/ld.so.conf (and run ldconfig after)
146       or add it to LD_LIBRARY_PATH environment variable
147
148    c) if you want to step in as an OpenCV developer, you will need some additional tools:
149
150       autoconf-2.59 (including autoheader-2.59)
151       automake-1.9* (including aclocal-1.9*)
152       libtool-1.5 (including libtoolize-1.5)
153       swig (version 1.3.30 or current CVS version respectively)
154
155       If the default versions of these tools installed on your machine differs, you
156       should specify the paths to the required versions via environment variables. For
157       example, if 'automake --version' gives you a version number 1.7.x but there is
158       /usr/bin/automake-1.9 installed on your machine, then call 
159
160       export AUTOMAKE=/usr/binautomake-1.9
161
162       whenever you want to work on OpenCV sources.
163
164       In addition, you should 'configure --enable-maintainer-mode', so that all
165       autotools are invoked automagically, if Makefile's or the configure-script
166       need to be regenerated. You can manually regenerate everything by starting
167       'autoreconf' from the top directory.
168
169
170    How to test OpenCV:
171    =======
172
173    + You can compile test programs using the traditional check target
174      of automake projects:
175
176         make check
177
178      This implicitly runs the folowing test programs:
179
180         tests/cv/src/cvtest
181         tests/cxcore/src/cxcoretest
182    
183    + or
184      compile and run simple c examples at
185      /usr/local/share/opencv/samples, e.g.:
186
187      g++ `pkg-config --cflags opencv` -o morphology morphology.c `pkg-config --libs opencv`
188      Plain gcc won't work because of unresolved c++-specific symbols (located in highgui?)
189    
190    
191    How to make OpenCV use IPP:
192    =======
193
194    + install IPP.
195      Let's assume, it installs to /opt/intel/ipp/5.1/ia32.
196    
197    + add <install_path>/bin and <install_path>/bin/linux32
198      (for example, /opt/intel/ipp/5.1/ia32/bin and /opt/intel/ipp/5.1/ia32/bin/linux32)
199      to LD_LIBRARY_PATH in your initialization script (.bashrc or similar):
200
201      LD_LIBRARY_PATH=/opt/intel/ipp/5.1/ia32/bin:/opt/intel/ipp/5.1/ia32/bin/linux32:$LD_LIBRARY_PATH
202      export LD_LIBRARY_PATH
203
204      or add these two directories, one per line, to /etc/ld.so.conf and run
205      ldconfig as root.
206
207    + that's it. Now OpenCV should be able to locate IPP shared libraries and make use of them.
208
209
210 MacOSX
211 ======
212
213    (TODO: add more detailed description)
214    (see also OpenCV Wiki)
215
216    + Basically, the requirements and building instructions are very similar to Linux case,
217      with the following exceptions:
218
219      * Carbon is used instead of GTK+ by default
220      * Quicktime is used instead of FFMPEG/xine by default
221      * pkg-config is optional (it is only used explicitly in samples\c\build_all.sh script)
222      * RPM and ldconfig are not supported by default,
223        use configure+make+sudo make install to build and install OpenCV,
224        update LD_LIBRARY_PATH (unless ./configure --prefix=/usr is used).
225
226      * for full functionality, you should install libpng, libtiff, libjpeg and libjasper
227        from darwinports and/or fink and make them available to ./configure (see ./configure --help)
228
229    + Known problems:
230
231      * Currently there is no way to write AVI files with QuickTime
232      * A plain OS X system doesn't have libpng, libtiff, libjasper installed, so
233        you won't be able to read or write these image formats
234      * The build system doesn't allow to build functional universal libraries at this time
235      * The build system doesn't allow to build with the intel compiler on OS X at this time
236
237    + If you'd like to step in as a developer, you will need to get the appropriate
238      versions of automake, etc. (see Linux section) from darwinports.