Using ofxFaceTrackerThreaded cause segmentation fault

Hello

I’ve tried to set up a very basic program using threaded tracker.

Here’s my testApp.h:

#pragma once

#include "ofMain.h"
#include "ofxCv.h"

using namespace ofxCv;
using namespace cv;
#include "ofxFaceTrackerThreaded.h"

class testApp : public ofBaseApp {
     public:
          void setup();
          void update();
          void draw();
          void keyPressed(int key);

          ofVideoGrabber cam;
          //ofxFaceTracker tracker;

          ofxFaceTrackerThreaded tracker;

          ofVec2f pos;
};

and here’s my testApp.cpp:

#include "testApp.h"

using namespace ofxCv;

void testApp::setup() 
{
     ofSetVerticalSync(false);
     ofSetFrameRate(25);
     ofSetDrawBitmapMode(OF_BITMAPMODE_MODEL_BILLBOARD);

     cam.initGrabber(640, 480);
     tracker.setup();
}

void testApp::update() 
{
     cam.update();
     if(cam.isFrameNew()) 
     {
          tracker.update(toCv(cam));
          pos = tracker.getPosition();
     }
}

void testApp::draw() 
{
     cam.draw(0, 0);
     ofSetLineWidth(2);

     tracker.draw(true);

     ofCircle(pos.x, pos.y, 10);

     ofDrawBitmapString(ofToString((int) ofGetFrameRate()), 10, 20);
}

void testApp::keyPressed(int key) 
{
     if(key == 'r') 
     {
          tracker.reset();
     }
}

By using these code, I’ve unfortunately received a “program received signal sigsegv segmentation fault” error and cannot run the program. The error log is pointing to “ofxFaceTrackerThreaded.h”, with error pinpointed at “ofxFaceTrackerThreaded::getImagePoint(this=0x51216e0, i=0)”.

Any idea in how to fix this problem?

Any help would be greatly appreciated.

I really need some help on this, would anyone able to provide some idea on this matter?
I have absolutely no idea how to fix this (as I afraid modifying the ofxFaceTrackerThreaded file will cause other problem, since I’m not familiar with C++)

push

Have you had a look at the example [https://github.com/kylemcdonald/ofxFaceTracker/blob/master/example-threaded/src/testApp.cpp][1] ?
As a random suggestion, try adding the following in your draw function before drawing the tracker:

if(tracker.getFound()) {

Does it help?
[1]: https://github.com/kylemcdonald/ofxFaceTracker/blob/master/example-threaded/src/testApp.cpp

Hello, first of all, I’m sorry for this late reply, as I was in vacation and cannot reach Internet.

As for your question and suggestion, I’ve look through the example, but I was trying to “scale down” all the things in there, I’m just using “tracker.draw()”

The following is my code:

void testApp::setup()
{
    ofSetFrameRate(30);

    grabber.setDesiredFrameRate(15);
    grabber.initGrabber(640, 480);

    tracker.setup();
}

void testApp::update()
{
    grabber.update();
    if(grabber.isFrameNew())
    {
        tracker.update( toCv(grabber) );
    }
}

void testApp::draw()
{
    ofBackground(200, 200, 200);

    grabber.draw(0,0);

    if(tracker.getFound())
    {

        tracker.draw();
    }

    ofSetColor(255);
    ofDrawBitmapString( ofToString( ofGetFrameRate() ) + " FPS", 10, 20);
}

So now at least it’s not giving out any segmentation fault, but I’ve got anything problem.

The end result for compiling the code is that console window brings up, and indicate that the webcam has been successfully set up and ready to capture. However, the executable window( the usual OpenFrameWorks one) brings up and hanged and Windows is giving the message “faceTrackerThreaded_DEBUG.exe has stopped working”. So there must be something wrong.

Is it that when using ofxFaceTrackerThreaded, you must include all those stuff in the example(like position, scale, orientation and etc)?