我正在尝试安装 node opencv ,我在 Mac 上运行小牛。我运行“npm install opencv”并尝试了很多方法来解决这个问题,但无法弄清楚。这是我的错误:还有一堆警告,但这是失败之前的错误:
当我运行 node-gyp configure 或 node-gyp rebuild 时发生类似的错误我试图在这里获得帮助:https ://github.com/joyent/node/issues/3113 但它没有帮助,我仍然得到 gyp 错误
运行 npm install opencv 时:这是整个输出
npm WARN package.json make@0.0.0 No repository field.
npm http GET https://registry.npmjs.org/opencv
npm http 304 https://registry.npmjs.org/opencv
> opencv@0.4.0 preinstall /Users/gabriellalevine/ardrone-webflight/node_modules/opencv
> node-gyp clean rebuild
CXX(target) Release/obj.target/opencv/src/init.o
CXX(target) Release/obj.target/opencv/src/Matrix.o
../src/Matrix.cc:110:13: warning: variable 'mat' is used uninitialized whenever
'if' condition is false [-Wsometimes-uninitialized]
} else if (args.Length() == 5) {
^~~~~~~~~~~~~~~~~~
../src/Matrix.cc:119:2: note: uninitialized use occurs here
mat->Wrap(args.Holder());
^~~
../src/Matrix.cc:110:9: note: remove the 'if' if its condition is always true
} else if (args.Length() == 5) {
^~~~~~~~~~~~~~~~~~~~~~~~
../src/Matrix.cc:104:13: note: initialize the variable 'mat' to silence this
warning
Matrix *mat;
^
= nullptr
1 warning generated.
CXX(target) Release/obj.target/opencv/src/OpenCV.o
CXX(target) Release/obj.target/opencv/src/CascadeClassifierWrap.o
CXX(target) Release/obj.target/opencv/src/Contours.o
CXX(target) Release/obj.target/opencv/src/Point.o
CXX(target) Release/obj.target/opencv/src/VideoCaptureWrap.o
CXX(target) Release/obj.target/opencv/src/CamShift.o
CXX(target) Release/obj.target/opencv/src/HighGUI.o
../src/HighGUI.cc:38:13: warning: variable 'win' is used uninitialized whenever
'if' condition is false [-Wsometimes-uninitialized]
} else if (args.Length() == 2){
^~~~~~~~~~~~~~~~~~
../src/HighGUI.cc:42:2: note: uninitialized use occurs here
win->Wrap(args.Holder());
^~~
../src/HighGUI.cc:38:9: note: remove the 'if' if its condition is always true
} else if (args.Length() == 2){
^~~~~~~~~~~~~~~~~~~~~~~
../src/HighGUI.cc:35:19: note: initialize the variable 'win' to silence this
warning
NamedWindow* win;
^
= nullptr
1 warning generated.
CXX(target) Release/obj.target/opencv/src/FaceRecognizer.o
../src/FaceRecognizer.cc:64:76: error: too many arguments to function call,
expected at most 4, have 5
...f = cv::createLBPHFaceRecognizer(1, 8, 8, 8, 80.0);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^~~~
/usr/local/Cellar/opencv/2.4.0/include/opencv2/contrib/contrib.hpp:951:16: note:
'createLBPHFaceRecognizer' declared here
CV_EXPORTS Ptr<FaceRecognizer> createLBPHFaceRecognizer(int radius=1...
^
../src/FaceRecognizer.cc:90:42: error: too many arguments to function call,
expected at most 4, have 5
radius, neighbors, grid_x, grid_y, threshold
^~~~~~~~~
/usr/local/Cellar/opencv/2.4.0/include/opencv2/contrib/contrib.hpp:951:16: note:
'createLBPHFaceRecognizer' declared here
CV_EXPORTS Ptr<FaceRecognizer> createLBPHFaceRecognizer(int radius=1...
^
../src/FaceRecognizer.cc:111:19: error: too many arguments to function call,
expected at most single argument 'num_components', have 2 arguments
components, threshold
^~~~~~~~~
/usr/local/Cellar/opencv/2.4.0/include/opencv2/contrib/contrib.hpp:949:16: note:
'createEigenFaceRecognizer' declared here
CV_EXPORTS Ptr<FaceRecognizer> createEigenFaceRecognizer(int num_com...
^
../src/FaceRecognizer.cc:132:19: error: too many arguments to function call,
expected at most single argument 'num_components', have 2 arguments
components, threshold
^~~~~~~~~
/usr/local/Cellar/opencv/2.4.0/include/opencv2/contrib/contrib.hpp:950:16: note:
'createFisherFaceRecognizer' declared here
CV_EXPORTS Ptr<FaceRecognizer> createFisherFaceRecognizer(int num_co...
^
../src/FaceRecognizer.cc:218:14: error: no member named 'update' in
'cv::FaceRecognizer'
self->rec->update(images, labels);
~~~~~~~~~ ^
../src/FaceRecognizer.cc:234:26: error: too many arguments to function call,
expected single argument 'src', have 3 arguments
self->rec->predict(im, predictedLabel, confidence);
~~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/Cellar/opencv/2.4.0/include/opencv2/contrib/contrib.hpp:931:9: note:
'predict' declared here
virtual int predict(InputArray src) const = 0;
^
../src/FaceRecognizer.cc:273:26: error: no member named 'getMat' in
'cv::FaceRecognizer'
cv::Mat m = self->rec->getMat(key);
~~~~~~~~~ ^
7 errors generated.
make: *** [Release/obj.target/opencv/src/FaceRecognizer.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:789:12)
gyp ERR! System Darwin 13.0.0
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "clean" "rebuild"
gyp ERR! cwd /Users/gabriellalevine/ardrone-webflight/node_modules/opencv
gyp ERR! node -v v0.10.20
gyp ERR! node-gyp -v v0.10.10
gyp ERR! not ok
npm ERR! weird error 1
npm ERR! not ok code 0