Skip to content

Face recognition segmentation fault #415

Closed
@pirakleous

Description

@pirakleous

Hello i use this code to run the face recognition with nodejs and display img in a window and i get a segmentation fault. If i remove the line with m.detectObject (no detection) and show the img then is ok.

var cv = require('opencv');

// camera properties
var camWidth = 320;
var camHeight = 240;
var camFps = 30;
var camInterval = 100 / camFps;

var window = new cv.NamedWindow('Video', 0)

// face detection properties
var rectColor = [0, 255, 0];
var rectThickness = 2;

// initialize camera
var camera = new cv.VideoCapture(0);
camera.setWidth(camWidth);
camera.setHeight(camHeight);
setInterval(function() {
camera.read(function(err, im) {

  if (err) console.log(err);

  im.detectObject('./node_modules/opencv/data/haarcascade_frontalface_alt2.xml', {}, function(err, faces) {

if (err) console.log(err);


    if (im.size()[0] > 0 && im.size()[1] > 0){
        window.show(im);
    }
    window.blockingWaitKey(0, 50);
  });
});

}, camInterval);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions