简体   繁体   English

使用OpenCV和Node.js进行分段错误

[英]Segmentation fault using OpenCV with Node.js

I am trying to detect faces on a series of images in a node script and I am getting a segmentation fault. 我正在尝试在节点脚本中检测一系列图像上的人脸,并且遇到了分割错误。

This is the output of the console when the error occurs: 发生错误时,这是​​控制台的输出:

enter code here

OpenCV Error: Bad flag (parameter or structure field) (Unrecognized or unsupported array type) in cvGetMat, file /tmp/opencv-20160626-26273-1a7s2xo/opencv-2.4.13/modules/core/src/array.cpp, line 2482
OpenCV Error: Bad flag (parameter or structure field) (Unrecognized or unsupported array type) in cvGetMat, file /tmp/opencv-20160626-26273-1a7s2xo/opencv-2.4.13/modules/core/src/array.cpp, line 2482
OpenCV Error: Bad flag (parameter or structure field) (Unrecognized or unsupported array type) in cvGetMat, file /tmp/opencv-20160626-26273-1a7s2xo/opencv-2.4.13/modules/core/src/array.cpp, line 2482
OpenCV Error: Bad flag (parameter or structure field) (Unrecognized or unsupported array type) in cvGetMat, file /tmp/opencv-20160626-26273-1a7s2xo/opencv-2.4.13/modules/core/src/array.cpp, line 2482
OpenCV Error: Bad flag (parameter or structure field) (Unrecognized or unsupported array type) in cvGetMat, file /tmp/opencv-20160626-26273-1a7s2xo/opencv-2.4.13/modules/core/src/array.cpp, line 2482
Segmentation fault: 11

Here is the code that produces the error when trying to run over a folder of images: 这是试图在图像文件夹上运行时产生错误的代码:

glob.sync('*.jpg' ).forEach( function( file,index,array ) {

cv.readImage(file, function(err, im){
im.detectObject(cv.FACE_CASCADE, {}, function(err, faces){
    if(faces.length>0){

        //do something

    }
    else{

        //do another thing
    }

  });
})

});

I sometimes get "can't read property length of udnefined" at faces.length but what I really want to solve is the segmentation fault. 有时我在faces.length上收到“无法读取udnefined的属性长度”的信息,但是我真正想解决的是分段错误。 I already did some research and tried using different xml files for the opencv face detection and still no luck 我已经进行了一些研究,并尝试使用不同的xml文件进行opencv人脸检测,但还是没有运气

I Had the same problem, and I solved handling the concurrent request to " .detectObject() .detectObject()了同样的问题,并且解决了对“ .detectObject()的并发请求的处理

I mean, wait until the previous call to detectObject() finish. 我的意思是,等到对detectObject()的上一次调用完成。

In some cases, with better processors I don't have this problem, but in ARM I've solve that by doing that control. 在某些情况下,使用更好的处理器,我不会遇到这个问题,但是在ARM中,我已经通过执行该控件解决了这一问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM