Image load error after add ofxFaceTracker2 to addons.make

Hi,

when I add ofxFaceTracker2 to my addons.make, ofImage.load(“image.png”) just stop to work.
I tried to add “ofxFaceTracker2” to …/of_v0.9.8_linux64_release/examples/graphics/imageLoaderExample/addons.make and the output log is:

[ error ] ofImage: loadImage(): couldn't load image from "images/bikers.jpg"
[ error ] ofImage: loadImage(): couldn't load image from "images/tdf_1972_poster.jpg"
[ error ] ofImage: loadImage(): couldn't load image from "images/tdf_1972_poster.jpg"
[ error ] ofImage: getBmpFromPixels(): unable to get FIBITMAP from ofPixels
[ error ] ofImage: putBmpIntoPixels(): unable to set ofPixels from FIBITMAP
[ error ] ofImage: loadImage(): couldn't load image from "images/transparency.png"
[ error ] ofImage: loadImage(): couldn't load image from "images/bike_icon.png"
[ error ] ofImage: getBmpFromPixels(): unable to get FIBITMAP from ofPixels
[ error ] ofImage: putBmpIntoPixels(): unable to set ofPixels from FIBITMAP
[warning] ofGLProgrammableRenderer: draw(): texture is not allocated

Removing “ofxFaceTracker2” from addons.make, the example works fine.
This is my ofxFaceTracker2’s addon_config.mk:

meta:
	ADDON_NAME = ofxFaceTracker2
	ADDON_DESCRIPTION =
	ADDON_AUTHOR = Jonas Jongejan
	ADDON_TAGS = "computer vision"
	ADDON_URL = http://github.com/halfdanj/ofxFaceTracker2

common:
# dependencies with other addons, a list of them separated by spaces
# or use += in several lines
ADDON_DEPENDENCIES = ofxCv

# include search paths, this will be usually parsed from the file system
# but if the addon or addon libraries need special search paths they can be
# specified here separated by spaces or one per line using +=
ADDON_INCLUDES =
ADDON_INCLUDES += libs/dlib/include
ADDON_INCLUDES += src

#linux/x86:
ADDON_LIBS = libs/dlib/include/lib/linux/x86_64/libdlib.a

I don’t know what could be the problem.
Help, please.

hi,
do the ofxFaceTracker2 examples work?

I don’t know but I guess that ofxFaceTracker2 is somehow changing the data directory path.
so, before loading the images check the data path with cout << ofToDataPath("", true) << endl;
Use ofSetDataPathRoot() to set it to the correct path so you can load the images

best

Hi @roymacdonald, thank you for your reply!

Yes, the example works fine.
Apparently the problem is not in data directory, because I can load the “shape_predictor_68_face_landmarks.dat” file without problem and the face tracker works fine. The output of “cout << ofToDataPath(”", true) << endl;" is correct too.

In the second case, only the gears.gif image was load correctly.
Apparently ofxFaceTracker2 is messing with ofImage or opencv configurations.

Does anyone knows how can I debug it?

That´s really odd.
Which OS are you using?
Can you paste the code that you of your app please.

My Operating System:
Distributor ID: Ubuntu
Description: Linux Lite 2.6
Kernel: 3.13.0-117-generic
Release: 14.04

Openframeworks version:
of_v0.9.8_linux64_release

It’s the same code in examples/graphics/imageLoaderExample:

void ofApp::setup(){
 	cout << "OF_DATA_PATH " << ofToDataPath("", true) << endl;
	bikers.loadImage("images/bikers.jpg");
   	bikers.update();

	gears.load("images/gears.gif");
	tdf.load("images/tdf_1972_poster.jpg");

	tdfSmall.load("images/tdf_1972_poster.jpg");
	tdfSmall.resize(tdfSmall.getWidth() / 4, tdfSmall.getHeight() / 4);
	tdfSmall.setImageType(OF_IMAGE_GRAYSCALE);

	transparency.load("images/transparency.png");
	bikeIcon.load("images/bike_icon.png");
	bikeIcon.setImageType(OF_IMAGE_GRAYSCALE);
}

void ofApp::draw(){	
	ofSetColor(255);

	bikers.draw(0, 0);
	gears.draw(600, 0);
	tdf.draw(600, 300);
	
	ofSetColor(220, 50, 50);
	tdfSmall.draw(200, 300);
	
	ofSetColor(255);
	ofEnableAlphaBlending();
	float wave = sin(ofGetElapsedTimef());
	transparency.draw(500 + (wave * 100), 20);
	ofDisableAlphaBlending();
	
	// getting the ofColors from an image,
	// using the brightness to draw circles
	int w = bikeIcon.getWidth();
	int h = bikeIcon.getHeight();
	float diameter = 10;
	ofSetColor(255, 0, 0);
	for(int y = 0; y < h; y++) {
		for(int x = 0; x < w; x++) {
			ofColor cur = bikeIcon.getColor(x, y);
			float size = 1 - (cur.getBrightness() / 255);
			ofDrawCircle(x * diameter, 500 + y * diameter, 1 + size * diameter / 2);
		}
	}
	
	// same as above, but this time
	// use the raw data directly with getPixels()
	ofPixels & pixels = bikeIcon.getPixels();
	ofSetColor(0, 0, 255);
	for(int y = 0; y < h; y++) {
		for(int x = 0; x < w; x++) {
			int index = y * w + x;
			unsigned char cur = pixels[index];
			float size = 1 - ((float) cur / 255);
			ofDrawCircle(200 + x * diameter, 500 + y * diameter, 1 + size * diameter / 2);
		}
	}
	
	ofSetColor(255);
	bikeIcon.draw(190, 490, 20, 20);
}

I have a code with ofxFaceTracker2 and ofImage together that works on android but using the equivalent code on linux the image load is not working. So I tried this basic example just adding ofFaceTracker2 to addons.make to see what’s happen. This is my addons.make:

ofxOpenCv
ofxFaceTracker2
ofxCv

Finally it is working.
I just remove “external” folder from …/of_v0.9.8_linux64_release/addons/ofxFaceTracker2/libs/dlib/include/dlib/ and now image load is working fine.

Best