opencv2.3提供了superpack,包含 vc2008, vc2010, mingw x86/x64 各种版本
看这两个链接
1
2
OpenCV 编译非常简单,只要掌握 CMake 即可。
1. msvc
下载 binary,如果安装的 visual studio 版本和编译版本不同,还要下载 visual studio xxx redistributable.
如果还是有错(一般是读写视频可能出错),自己编译一下。
2. mingw
编译安装根据这个说明。最简单的,下载一个人家编译好的,在这儿。
gcc 版本不能选择 4.5,否则会出现神秘错误,折腾(针对opencv2.1)。
注意:
1). 选择 msys make,不要选择 mingw make (mingw-make 要求把 sh.exe 排除在系统 path 外,即 dos 中找不到 sh.exe。否则会出现问题,我也不知为什么要这样。安装的时候把 msys 下的 bin 目录排除在 path 外。)
采用 cmake gui,会自动找到make
2). 编译 libgui 是 libvideoInput.a 的问题
是因为 opencv 2.1 附带的这个库是用旧的 gcc 编译的,不兼容新的 gcc。因此从这个链接下载从新编译的库,替换老的,就可以了。
3. gcc
主要是 ffmpeg 的问题
It is hard! ffmpeg problem install ffmpeg ./configure --enable-shared --enable-swscale --enable-gpl 1. where to find header files? Make two copies. Make a dir named ffmpeg, put all *.h files under the dir. And put the original include dirs under the dir (It is another copy. You will get to know what I mean when you look into /usr/local/include) 2. INT64_C problem It is not defined. For linux, change the following line in avcodec.h Try to open the ffmpeg header avcodec.h and look for Code: #define AV_NOPTS_VALUE int64_t_C(0x8000000000000000) try if replacing this line with Code: #define AV_NOPTS_VALUE 0x8000000000000000LL You may have to change two avcodec.h in the two copies. It is stupid, but it works 3. opencv problem NOTE that with new version of opencv 1.1, you don't have to do this step. But you have to compile ffmpeg with swscale find line 784 of cvcap_ffmpeg.cpp, and change to url_fclose(mywriter->oc->pb); 4. configure and make refer to Leeds Guide to OpenCV Or just use ./configure --prefix=/home/bee33/lib/opencv --enable-apps --enable-shared --with-ffmpeg --with-gnu-ld -without-quicktime CFLAGS=-I/usr/local/include CPPFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib and edit .bashrc export PKG_CONFIG_PATH=/home/opencv/lib/pkgconfig 5. You have to add lib path of ffmpeg and opencv into ldconfig directory. Make two conf files in /etc/ld.so.conf.d/ 6. Enjoy!
0 comments:
Post a Comment