uricamic / clandmark

Open Source Landmarking Library
http://cmp.felk.cvut.cz/~uricamic/clandmark
GNU General Public License v3.0
199 stars 111 forks source link

build error of flandmark #45

Open junsa opened 8 years ago

junsa commented 8 years ago

Hello. I'm a japanese univ student and I'd like to use clandmark as a comparative method. Since I usually use windows 7, I tried to build the clandmark using visual studio express 2015 for windows desktop after cmake. However, it could not build flandmark and says many "unresolved external symbol" although clandmark is ok. I describe some error messages below.

"public: thiscall clandmark::XmlNode::~XmlNode(void)" (??1XmlNode@clandmark@@QAE@XZ) が関数 "public: thiscall clandmark::Flandmark::Flandmark(char const ,bool)" (??0Flandmark@clandmark@@QAE@PBD_N@Z) で参照されました。 "public: class clandmark::XmlNode __thiscall clandmark::XmlNode::operator[](char const )" (??AXmlNode@clandmark@@QAE?AV01@PBD@Z) が関数 "public: __thiscall clandmark::Flandmark::Flandmark(char const ,bool)" (??0Flandmark@clandmark@@QAE@PBD_N@Z) で参照されました。 "public: class std::vector<class clandmark::XmlNode,class std::allocator > __thiscall clandmark::XmlNode::getSet(char const )" (?getSet@XmlNode@clandmark@@QAE?AV?$vector@VXmlNode@clandmark@@V?$allocator@VXmlNode@clandmark@@@std@@@std@@PBD@Z) が関数 "public: __thiscall clandmark::Flandmark::Flandmark(char const *,bool)" (??0Flandmark@clandmark@@QAE@PBD_N@Z) で参照されました。

Could you give me any advice?

uricamic commented 8 years ago

Hi @junsa,

unfortunately I do not have access to any windows computer now. I have never tried with MSVS 2015, however it compiled with 2013 without bigger problems. Just a quick check, do you have BUILD_SHARED_LIBS set to ON and have you tried to compile each target in the solution separately?

junsa commented 8 years ago

Hello @uricamic, Thank you for your quick reply! Since I installed based on installation for windows, BUILD_SHARED_LIBS was ON and I tried to compile each target in the solution separately. However, I couldn't.

Also, I tried to install for my ubuntu 14.04 LTS. The install succeeded and I wrote a small code using qtcreator as shown in below. However, the qtcreator says error: undefined reference to clandmark::Flandmark::getInstanceOf(char const*, bool)'. What should I do?

`#include <opencv2/objdetect/objdetect.hpp>

include <opencv2/highgui/highgui.hpp>

include <opencv2/imgproc/imgproc.hpp>

include

include

include

include "Flandmark.h"

include "CSparseLBPFeatures.h"

include "CTimer.h"

include "CFeaturePool.h"

include "CSparseLBPFeatures.h"

include "helpers.h"

define SHOW_WINDOWS

using namespace std; using namespace cv; using namespace clandmark;

char modelList[][1024] = { "JOINT_MV_AFLW_SPLIT1-profile.xml", "JOINT_MV_AFLW_SPLIT1-30deg.xml", "JOINT_MV_AFLW_SPLIT_1_frontal.xml", "JOINT_MV_AFLW_SPLIT_1_30deg.xml", "JOINT_MV_AFLW_SPLIT_1_profile.xml", };

char views[][20] = { "-profile", "-half-profile", "frontal", "half-profile", "profile", };

const int PHIS = 5;

int main(int argc, char *argv[]) {

string modelDir = argv[1];  // path to directory containing flandmark model XML files (assuming the path is given as a first argument)

Flandmark *flandmarkPool[PHIS]; // pool of Flandmark instances

// initialize flandmark instances
for (int i=0; i < PHIS; ++i)
{
   flandmarkPool[i] = Flandmark::getInstanceOf(string(modelDir+modelList[i]).c_str());

  if (!flandmarkPool[i])
  {
    cerr << "Couldn't create instance of flandmark with model " << modelList[i] << endl;
    return -1;
  }
}

return 0;

}`

Below code is my project file in the qtcreator. `INCLUDEPATH += /usr/local/include/opencv INCLUDEPATH += /home/user/clandmark/libclandmark INCLUDEPATH += /home/user/clandmark/3rd_party/CImg-1.5.6 INCLUDEPATH += /home/user/clandmark/3rd_party/rapidxml-1.13 INCLUDEPATH += /home/user/clandmark/3rd_party/CImg-1.5.6/plugins

LIBS += -L/usr/local/lib -lopencv_shape -lopencv_stitching -lopencv_objdetect -lopencv_superres -lopencv_videostab -lopencv_calib3d -lopencv_features2d -lopencv_highgui -lopencv_videoio -lopencv_imgcodecs -lopencv_video -lopencv_photo -lopencv_ml -lopencv_imgproc -lopencv_flann -lopencv_core -lopencv_hal`

Thank you and sorry I'm not good in English.

uricamic commented 8 years ago

Hi @junsa,

you forgot to add -lflandmark -lclandmark to LIBS, as well as the path to the directory where you have them (-L). Then it should work without problems.

The other way how to use the library in external project is to use CMake, see #44 for details.

The compilation on windows can be tricky sometimes, however on linux and mac it works without troubles.

junsa commented 8 years ago

Hello @uricamic,

I could build!! Thank you for your advice!!

However, an example code, which is clandmark/examples/static_input.cpp, outputs incorrect results as shown in attached images. I used a haarcascade_frontalface_alt.xml and flandmark_model.xml in clandmark/data. I don't change the code of the static_input.cpp. Is there anything I have to do?

Thank you and sorry for many questions.

result

result

uricamic commented 8 years ago

Hi @junsa,

the flandmark_model.xml is not compatible with this code example. You could use it, but it would require changes of the example (not to use CFeaturePool and detect_optimized).

However, you can use this example with different models, such as CDPM.xml and FDPM.xml or any of the INDEPENDENT_MV and JOINT_MV models. All models are available for download here .

junsa commented 8 years ago

Hello @uricamic,

I have confirmed CDPM.xml can correctly obtain facial landmarks!! Thank you very much!!

uricamic commented 8 years ago

Hi @junsa,

happy to hear that. If you are interested in landmark localization precision, please bear on mind, that it is intended to be used in combination with FDPM.xml forming the C2F-DPM detector as described in our paper and also that is has limitations regarding the yaw angle of the head - it works best for the near-frontal head poses, i.e. in the yaw range of roughly (-15, 15) degrees.

junsa commented 8 years ago

Hello @uricamic,

Thank you for your advice. I have understood your mention and I'm now reading your paper.

I'm looking forward to reading your new paper!!! Thank you, from Japan!!