图像处理OpenCV库移植
图像处理库:OpenCV-2.0.0
交叉编译器:arm-linux-gcc-3.4.1
./configure --host=arm-linux --prefix=/usr/local/opencv/ --without-gtk --without-carbon --without-quicktime --without-1394libs --without-ffmpeg --without-python --without-swig --disable-apps
make
make install
错误1:
../include/opencv/cxoperations.hpp: In member function `void cv::Ptr<_Tp>::addref()':
../include/opencv/cxoperations.hpp:1442: error: there are no arguments to `__exchange_and_add' that depend on a template parameter, so a declaration of `__exchange_and_add' must be available
../include/opencv/cxoperations.hpp:1442: error: (if you use `-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
解决:
添加如下代码
......
template<typename _Tp> static inline _Tp CV_XADD(_Tp* addr, _Tp delta)
{ int tmp = *addr; *addr += delta; return tmp; }
#endif//#ifdef __GNUC__
template<typename _Tp> static inline _Tp CV_XADD(_Tp* addr, _Tp delta)
{ int tmp = *addr; *addr += delta; return tmp; }
namespace cv
错误2:
cxcore/cxsystem.cpp: In function `int64 cv::getTickCount()':
cxcore/cxsystem.cpp:82: error: `CLOCK_MONOTONIC' undeclared (first use this function)
cxcore/cxsystem.cpp:82: error: (Each undeclared identifier is reported only once for each function it appears in
解决:
修改src/cxcore/cxsystem.cpp添加代码
#define CLOCK_MONOTONIC 1
拷贝:
libcvaux.so libcv.so libcxcore.so libhighgui.so libml.so pkgconfig
libcvaux.so.4 libcv.so.4 libcxcore.so.4 libhighgui.so.4 libml.so.4
libcvaux.so.4.0.0 libcv.so.4.0.0 libcxcore.so.4.0.0 libhighgui.so.4.0.0 libml.so.4.0.0
到usr/local/opencv/lib目录下。
# tree opencv
opencv
`-- lib
|-- libcvaux.so -> libcvaux.so.4.0.0
|-- libcvaux.so.4 -> libcvaux.so.4.0.0
|-- libcvaux.so.4.0.0
|-- libcv.so -> libcv.so.4.0.0
|-- libcv.so.4 -> libcv.so.4.0.0
|-- libcv.so.4.0.0
|-- libcxcore.so -> libcxcore.so.4.0.0
|-- libcxcore.so.4 -> libcxcore.so.4.0.0
|-- libcxcore.so.4.0.0
|-- libhighgui.so -> libhighgui.so.4.0.0
|-- libhighgui.so.4 -> libhighgui.so.4.0.0
|-- libhighgui.so.4.0.0
|-- libml.so -> libml.so.4.0.0
|-- libml.so.4 -> libml.so.4.0.0
|-- libml.so.4.0.0
`-- pkgconfig
`-- opencv.pc
修改etc/profile添加共享库路径:
vi /etc/profile
export LD_LIBRARY_PATH=/lib:$TSDIRb:$QTDIRb:/usr/local/opencv/lib