Tag: opencv

OpenCV声明失败错误

我正在研究一个需要脸部识别和预测的项目。 当我上传一个图像时,它应该从数据库中识别出这个人。我试图用Nodejs和OpenCV来实现。 我的代码如下所示: var FaceRecognizer = new cv.FaceRecognizer(); var uploadDir = joinPath(__dirname, "/images"); var fileDir = joinPath(__dirname, "/uploads"); var cvImages = []; fs.readdir(uploadDir, function(err, files){ if(err){ throw new Error(err); } if(files.length > 0){ //There are some user related image folders files.forEach(function(subfolder, index, array){ if(subfolder != ".DS_Store" ){ //Issue with Mac, test on Linux-VM //We are […]

删除节点中的图像背景

我正在从事捕捉用户的面部并将其放在现有模型上的项目。 为了结合人脸和模型的图像,我使用节点的gm库; 和面部检测我使用的是opencv。 我能够做到既检测脸部,又把它放在模型上。 但问题是我的模型是透明的背景,但用户的脸不(因为脸从相机捕获)。 我想删除脸部的背景,使其透明。 有什么办法可以做到这一点吗? 这是我的集成代码: gm() .in('-page', '+0+0') .in("public/" + modelImagePath) .in('-page', '+130+45') .in(newDir + '/crp.png') .mosaic() .write(resultantImage, function (err) { if (err) console.log(err); }); 这里crp.png是人脸图像,modelimagepath是模型图像完整的opencv + gm代码: cv.readImage(newDir + "/zxcv.png", function(err, im){ im.detectObject(cv.FACE_CASCADE, {}, function(err, faces){ console.log("into detec:" + faces.length + "," + faces[0]); if ( faces.length > 0) { var […]

检测Image Nodejs OpenCV特定区域的颜色

我试图编写代码来检测图像特定区域的颜色。 到目前为止我遇到过使用OpenCV,我们可以做到这一点,但还没有find任何特定的教程来帮助这一点。 我想用JavaScript做到这一点,但我也可以使用python OpenCV来获得结果。 任何人都可以帮助我分享任何有用的链接,或者可以解释如何实现检测图像中特定区域的颜色。 例如。 红框表示不同的颜色。 我需要弄清楚它显示的是哪种颜色。 我曾经尝试过: 我已经尝试过OpenCV Canny图像,虽然我成功地将Canny图像与区域分离,但是如何检测特定Canny区域的颜色仍然是一个挑战。 另外,我用OpenCV中的inRange方法尝试了这个方法,这个方法非常完美 # find the colors within the specified boundaries and apply # the mask mask = cv2.inRange(image, lower, upper) output = cv2.bitwise_and(image, image, mask = mask) # show the images cv2.imshow("images", np.hstack([image, output])) 它运作良好,从图像中提取颜色区域但是有没有回应,如果图像具有特定的颜色,以便它可以自动完成回应?

不能用nw-gyp重buildnode-opencv

我正在尝试重buildnode-opencv以与node-webkit 。 要做到这一点,你需要使用nw-gyp,但我遇到了一些错误。 你能否告诉我为什么会这样? [~/nw_cv/node_modules/opencv] nw-gyp rebuild –target=0.9.2 gyp info it worked if it ends with ok gyp info using nw-gyp@0.12.2 gyp info using node@0.10.26 | darwin | x64 gyp info spawn python gyp info spawn args [ '/usr/local/lib/node_modules/nw-gyp/gyp/gyp_main.py', gyp info spawn args 'binding.gyp', gyp info spawn args '-f', gyp info spawn args 'make', gyp […]

OpenCV – 将图像保存在数据库nodejs中

我会很感激,如果有人可以帮我解决这个问题:我使用opencv与nodejs( https://github.com/TanaseButcaru/node-opencv ) 我有一组照片,我喜欢用opencv readImage函数读取这些照片,然后将其保存在数据库中。 photos.map(async(photo) => { cv.readImage(`${__dirname}/${photo}`, function (error, matrix) { //insert in DB} 你知道如何保存这个“matrix”在数据库中,然后用它来检索图像并比较它(图片相似性)?

opencv nodejs _handle错误,同时要求在js页面中

我已经使用npm安装了opencv,但是当我需要在我的js页面中这样的: var cv = require('opencv'); 我得到一个错误 Uncaught TypeError: cannot read property '_handle' of undefined

使用NPM在Windows 8上安装节点和opencv

我似乎在安装opencv与Windows 8上的npm问题,并想知道如果有人可以提供一些指针。 错误如下,我知道明显的是安装pkg-config,但我似乎无法find任何文件如何做到这一点? C:\Users\Marc>npm install opencv \ > opencv@0.5.0 preinstall C:\Users\Marc\node_modules\opencv > node-gyp clean rebuild C:\Users\Marc\node_modules\opencv>node "C:\Program Files\nodejs\node_modules\n pm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" clean rebuild 'pkg-config' is not recognized as an internal or external command, operable program or batch file. gyp: Call to 'pkg-config –libs opencv' returned exit status 1. while trying to load binding.gyp gyp ERR! configure error […]

检测GYP中的MSVC版本

我正在尝试在我的binding.gyp文件中的node-gyp configure期间检测msvc版本。 基本上,我想能够链接到特定的基于Visual C ++版本的第三方库: ['OS=="win"' and 'toolset="vc12"' , { 'libraries': [ "opencv/lib/vc12/opencv_world300.lib" ], }], ['OS=="win"' and 'toolset="vc11"' , { 'libraries': [ "opencv/lib/vc11/opencv_world300.lib" ], }], ['OS=="win"' and 'toolset="vc10"' , { 'libraries': [ "opencv/lib/vc10/opencv_world300.lib" ], }] 遗憾的是, _toolset没有定义toolset ,也没有_toolset甚至$(TOOLSET)variables。 在GYP文档中我找不到这样的variables。 有没有可能?

return process.dlopen(module,path._makeLong(filename));

从OpenCV节点运行示例时出现此错误 return process.dlopen(module,path._makeLong(filename)); ^ 错误:/home/sunny/face/build/opencv/v5.0.0/Release/node-v46-linux-x64/opencv.node:undefined symbol:_ZNK2cv9Algorithm5writeERNS_11FileStorageE 在错误(本机) 在Object.Module._extensions..node(module.js:460:18) 在Module.load(module.js:356:32) 在Function.Module._load(module.js:313:12) 在Module.require(module.js:366:17) 在require(module.js:385:17) 在对象。 (/home/sunny/face/lib/bindings.js:4:15) 在Module._compile(module.js:435:26) 在Object.Module._extensions..js(module.js:442:10) 在Module.load(module.js:356:32)

NodeJS,OpenCV和stream媒体图像使用networking套接字

我的最终目标是将video从笔记本电脑传输到服务器。 我试图通过在笔记本电脑和服务器上使用NodeJs来实现这一点。 我使用OpenCV库来捕获笔记本电脑上的video,并将其保存为jpg文件。 然后我读取文件并将其转换为base64,以便我可以使用Node中的Net.socket模块来传输它。 这是一个连续的过程:捕获,编码和发送。 这里是传输一个jpg文件的服务器代码: var cv = require('opencv'); var fs = require('fs'); var net = require('net'); var camera = new cv.VideoCapture(0); var server = net.createServer(); server.listen('50007', '127.0.0.1'); server.on('connection', function(socket){ camera.read(function(image){ image.save('original.jpg'); fs.readFile('original.jpg', 'base64', function(err, image){ socket.write(image, 'base64', function(){ socket.end(); }); }); }); }); 在客户端循环,直到从服务器接收到FIN。 这里是客户端代码: var net = require('net'); var fs = require('fs'); […]