我正试图通过终端在Ubuntu上为Python安装一个人脸跟踪器。我从这里安装:
https://pypi.python.org/pypi/pyFaceTracker/0.1.1
并从这里使用了setup.py的linux版本:http://reidmayo.com/2014/07/15/how-to-install-pyfacetracker-on-linux-fedora-19/
但是,当我试图在包的目录中键入"sudo python setup.py install"时,它最终给了我这个错误:
running install
running bdist_egg
running egg_info
writing pyFaceTracker.egg-info/PKG-INFO
writing top-level names to pyFaceTracker.egg-info/top_level.txt
writing dependency_links to pyFaceTracker.egg-info/dependency_links.txt
reading manifest file 'pyFaceTracker.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'pyFaceTracker.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
running build_ext
building 'facetracker._facetracker' extension
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Iexternal/FaceTracker/include -I/usr/include/opencv2/core -I/usr/include/opencv2/imgproc -I/usr/include/opencv2/video -I/usr/include/opencv2/features2d -I/usr/include/opencv2/flann -I/usr/include/opencv2/calib3d -I/usr/include/opencv2/objdetect -I/usr/include/opencv2/legacy -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/include/python2.7 -c external/FaceTracker/src/lib/PDM.cc -o build/temp.linux-x86_64-2.7/external/FaceTracker/src/lib/PDM.o
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
external/FaceTracker/src/lib/PDM.cc: In member function ‘void FACETRACKER::PDM::CalcRigidJacob(cv::Mat&, cv::Mat&, cv::Mat&)’:
external/FaceTracker/src/lib/PDM.cc:234:23: warning: unused variable ‘m’ [-Wunused-variable]
int i,n = _M.rows/3,m = _V.cols; double X,Y,Z;
^
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Iexternal/FaceTracker/include -I/usr/include/opencv2/core -I/usr/include/opencv2/imgproc -I/usr/include/opencv2/video -I/usr/include/opencv2/features2d -I/usr/include/opencv2/flann -I/usr/include/opencv2/calib3d -I/usr/include/opencv2/objdetect -I/usr/include/opencv2/legacy -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/include/python2.7 -c external/FaceTracker/src/lib/PAW.cc -o build/temp.linux-x86_64-2.7/external/FaceTracker/src/lib/PAW.o
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
external/FaceTracker/src/lib/PAW.cc: In member function ‘void FACETRACKER::PAW::Crop(cv::Mat&, cv::Mat&, cv::Mat&)’:
external/FaceTracker/src/lib/PAW.cc:167:3: error: ‘remap’ is not a member of ‘cv’
cv::remap(src,dst,_mapx,_mapy,CV_INTER_LINEAR); return;
^
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
如果有帮助的话,我会为C++使用OpenCV 3.0.0 alpha,为python使用OpenCV 3.0 beta。
我该怎么解决这样的问题?
要让它找到cv::remap,正如@berak所说,你必须让它包括opencv2/opencv.hpp,但不包括在_pyFaceTracker.cpp中,你必须把它包括在这里(IO.h)。IO.h在PAW.h中使用,并实现cv::remap函数。完成这些操作后,我消除了那个错误,并偶然发现了另一个关于helper函数的错误。有什么想法吗?
警告:前方有很长的路要走!`
In file included from src/_pyFaceTracker.cpp:20:0:
src/opencv_helpers.h:161:16: error: cannot declare variable ‘g_numpyAllocator’ to be of abstract type ‘NumpyAllocator’
NumpyAllocator g_numpyAllocator;
^
src/opencv_helpers.h:111:7: note: because the following virtual functions are pure within ‘NumpyAllocator’:
class NumpyAllocator : public MatAllocator
^
In file included from /usr/local/include/opencv2/core.hpp:59:0,
from /usr/local/include/opencv2/opencv.hpp:46,
from external/FaceTracker/include/FaceTracker/IO.h:43,
from external/FaceTracker/include/FaceTracker/PDM.h:42,
from external/FaceTracker/include/FaceTracker/CLM.h:42,
from external/FaceTracker/include/FaceTracker/Tracker.h:42,
from src/_pyFaceTracker.cpp:12:
/usr/local/include/opencv2/core/mat.hpp:417:23: note: virtual cv::UMatData* cv::MatAllocator::allocate(int, const int*, int, void*, size_t*, int, cv::UMatUsageFlags) const
virtual UMatData* allocate(int dims, const int* sizes, int type,
^
/usr/local/include/opencv2/core/mat.hpp:419:18: note: virtual bool cv::MatAllocator::allocate(cv::UMatData*, int, cv::UMatUsageFlags) const
virtual bool allocate(UMatData* data, int accessflags, UMatUsageFlags usage
^
/usr/local/include/opencv2/core/mat.hpp:420:18: note: virtual void cv::MatAllocator::deallocate(cv::UMatData*) const
virtual void deallocate(UMatData* data) const = 0;
^
In file included from src/_pyFaceTracker.cpp:20:0:
src/opencv_helpers.h: In function ‘int pyopencv_to(const PyObject*, cv::Mat&, const char*, bool)’:
src/opencv_helpers.h:241:11: error: ‘class cv::Mat’ has no member named ‘refcount’
m.refcount = refcountFromPyObject(o);
^
src/opencv_helpers.h: In function ‘PyObject* pyopencv_from(const cv::Mat&)’:
src/opencv_helpers.h:262:12: error: ‘class cv::Mat’ has no member named ‘refcount’
if(!p->refcount || p->allocator != &g_numpyAllocator)
^
src/opencv_helpers.h:269:36: error: ‘class cv::Mat’ has no member named ‘refcount’
return pyObjectFromRefcount(p->refcount);
^
src/opencv_helpers.h: At global scope:
src/opencv_helpers.h:349:35: error: ‘vector’ has not been declared
static bool to(PyObject* obj, vector<_Tp>& value, const char* name="<unknow
^
src/opencv_helpers.h:349:41: error: expected ‘,’ or ‘...’ before ‘<’ token
static bool to(PyObject* obj, vector<_Tp>& value, const char* name="<unknow
^
src/opencv_helpers.h:440:33: error: ‘vector’ does not name a type
static PyObject* from(const vector<_Tp>& value)
^
src/opencv_helpers.h:440:39: error: expected ‘,’ or ‘...’ before ‘<’ token
static PyObject* from(const vector<_Tp>& value)
^
src/opencv_helpers.h: In static member function ‘static bool pyopencvVecConverter<_Tp>::to(PyObject*, int)’:
src/opencv_helpers.h:357:33: error: ‘name’ was not declared in this scope
pyopencv_to(obj, m, name);
^
src/opencv_helpers.h:358:22: error: ‘value’ was not declared in this scope
m.copyTo(value);
^
src/opencv_helpers.h:362:46: error: ‘name’ was not declared in this scope
PyObject *seq = PySequence_Fast(obj, name);
^
src/opencv_helpers.h:366:9: error: ‘value’ was not declared in this scope
value.resize(n);
^
src/opencv_helpers.h: In static member function ‘static PyObject* pyopencvVecConverter<_Tp>::from(int)’:
src/opencv_helpers.h:442:12: error: ‘value’ was not declared in this scope
if(value.empty())
^
src/opencv_helpers.h:444:22: error: ‘value’ was not declared in this scope
Mat src((int)value.size(), DataType<_Tp>::channels, DataType<_Tp>::dept
^
src/opencv_helpers.h: At global scope:
src/opencv_helpers.h:450:70: error: ‘vector’ has not been declared
emplate<typename _Tp> static inline bool pyopencv_to(PyObject* obj, vector<_Tp>
^
src/opencv_helpers.h:450:76: error: expected ‘,’ or ‘...’ before ‘<’ token
e<typename _Tp> static inline bool pyopencv_to(PyObject* obj, vector<_Tp>& valu
^
src/opencv_helpers.h: In function ‘bool pyopencv_to(PyObject*, int)’:
src/opencv_helpers.h:452:47: error: ‘value’ was not declared in this scope
return pyopencvVecConverter<_Tp>::to(obj, value, name);
^
src/opencv_helpers.h:452:54: error: ‘name’ was not declared in this scope
return pyopencvVecConverter<_Tp>::to(obj, value, name);
^
src/opencv_helpers.h: At global scope:
src/opencv_helpers.h:455:68: error: ‘vector’ does not name a type
template<typename _Tp> static inline PyObject* pyopencv_from(const vector<_Tp>&
^
src/opencv_helpers.h:455:74: error: expected ‘,’ or ‘...’ before ‘<’ token
ate<typename _Tp> static inline PyObject* pyopencv_from(const vector<_Tp>& valu
^
src/opencv_helpers.h: In function ‘PyObject* pyopencv_from(int)’:
src/opencv_helpers.h:457:44: error: ‘value’ was not declared in this scope
return pyopencvVecConverter<_Tp>::from(value);
^
src/_pyFaceTracker.cpp: In function ‘int FaceTracker_init(FaceTracker*, PyObject*, PyObject*)’:
src/_pyFaceTracker.cpp:91:43: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
static char *kwlist[] = {"fname", NULL};
^
src/_pyFaceTracker.cpp: At global scope:
src/_pyFaceTracker.cpp:129:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
};
^
src/_pyFaceTracker.cpp:129:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
src/_pyFaceTracker.cpp:129:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
src/_pyFaceTracker.cpp:129:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
src/_pyFaceTracker.cpp:129:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
src/_pyFaceTracker.cpp:129:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
src/_pyFaceTracker.cpp:129:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
src/_pyFaceTracker.cpp:129:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
src/_pyFaceTracker.cpp:129:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
src/_pyFaceTracker.cpp:129:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
src/_pyFaceTracker.cpp:129:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
src/_pyFaceTracker.cpp:129:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
src/_pyFaceTracker.cpp: In function ‘PyObject* FaceTracker_setWindowSizes(FaceTracker*, PyObject*)’:
src/_pyFaceTracker.cpp:157:58: error: no matching function for call to ‘pyopencv_to(PyObject*&, std::vector<int>&)’
if (!pyopencv_to<int>(sizes_array, self->window_sizes))
^
In file included from src/_pyFaceTracker.cpp:20:0:
src/opencv_helpers.h:450:43: note: candidate: template<class _Tp> bool pyopencv_to(PyObject*, int)
template<typename _Tp> static inline bool pyopencv_to(PyObject* obj, vector<_Tp
^
src/opencv_helpers.h:450:43: note: template argument deduction/substitution failed:
src/_pyFaceTracker.cpp:157:46: note: cannot convert ‘self->FaceTracker::window_sizes’ (type ‘std::vector<int>’) to type ‘int’
if (!pyopencv_to<int>(sizes_array, self->window_sizes))
^
In file included from src/_pyFaceTracker.cpp:20:0:
src/opencv_helpers.h: At global scope:
src/opencv_helpers.h:59:18: warning: ‘opencv_error’ defined but not used [-Wunused-variable]
static PyObject* opencv_error = 0;
^
src/opencv_helpers.h:272:13: warning: ‘bool pyopencv_to(PyObject*, cv::Scalar&, const char*)’ defined but not used [-Wunused-function]
static bool pyopencv_to(PyObject *o, Scalar& s, const char *name = "<unknown>")
^
src/opencv_helpers.h:311:18: warning: ‘PyObject* pyopencv_from(bool)’ defined but not used [-Wunused-function]
static PyObject* pyopencv_from(bool value)
^
src/opencv_helpers.h:316:13: warning: ‘bool pyopencv_to(PyObject*, bool&, const char*)’ defined but not used [-Wunused-function]
static bool pyopencv_to(PyObject* obj, bool& value, const char* name = "<unknow
^
src/opencv_helpers.h:328:18: warning: ‘PyObject* pyopencv_from(size_t)’ defined but not used [-Wunused-function]
static PyObject* pyopencv_from(size_t value)
^
src/opencv_helpers.h:333:13: warning: ‘bool pyopencv_to(PyObject*, size_t&, const char*)’ defined but not used [-Wunused-function]
static bool pyopencv_to(PyObject* obj, size_t& value, const char* name = "<unkn
^
src/opencv_helpers.h:342:18: warning: ‘PyObject* pyopencv_from(int)’ defined but not used [-Wunused-function]
static PyObject* pyopencv_from(int value)
^
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
`