NodeJS:node-opencv安装警告,节点应用程序崩溃

我看过Github和Stack上报告的类似于我的问题,但我无法解决。

我有一个node.js应用程序崩溃的im.save('test.jpg'); 线。 如果我评论这一行,它似乎运行良好。 相关代码:

var cv = require('opencv'); var camera = new cv.VideoCapture(0); camera.read(function(err, im) { im.save('test.jpg'); }); 

崩溃报告这个:

 dyld: lazy symbol binding failed: Symbol not found: __ZN2cv7imwriteERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERKNS_11_InputArrayERKNS0_6vectorIiNS4_IiEEEE Referenced from: /Users/wys3/node_modules/opencv/build/Release/opencv.node Expected in: dynamic lookup dyld: Symbol not found: __ZN2cv7imwriteERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERKNS_11_InputArrayERKNS0_6vectorIiNS4_IiEEEE Referenced from: /Users/wys3/node_modules/opencv/build/Release/opencv.node Expected in: dynamic lookup 

OpenCV 2.4.8.2似乎安装在我的Mac与OS X 10.8.5通过自制就好了。

我使用npm来安装node-opencv,并得到这个输出的警告:

 npm http GET https://registry.npmjs.org/opencv npm http GET https://registry.npmjs.org/opencv npm http GET https://registry.npmjs.org/opencv > opencv@0.5.0 preinstall /usr/local/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:119:13: warning: variable 'mat' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] } else if (args.Length() == 5) { ^~~~~~~~~~~~~~~~~~ ../src/Matrix.cc:128:2: note: uninitialized use occurs here mat->Wrap(args.Holder()); ^~~ ../src/Matrix.cc:119:9: note: remove the 'if' if its condition is always true } else if (args.Length() == 5) { ^~~~~~~~~~~~~~~~~~~~~~~~ ../src/Matrix.cc:113:13: note: initialize the variable 'mat' to silence this warning Matrix *mat; ^ = nullptr ../src/Matrix.cc:1147:22: warning: address of stack memory associated with local variable 'ret' returned [-Wreturn-stack-address] return (cv::Rect*) &ret; ^~~ 2 warnings 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 SOLINK_MODULE(target) Release/opencv.node SOLINK_MODULE(target) Release/opencv.node: Finished npm http GET https://registry.npmjs.org/buffers/0.1.1 npm http GET https://registry.npmjs.org/buffers/0.1.1 npm http GET https://registry.npmjs.org/buffers/0.1.1 opencv@0.5.0 node_modules/opencv └── buffers@0.1.1