berak / uniform-lbp

trying out new things in FaceRecognition
54 stars 32 forks source link

Compile error #4

Open atv2016 opened 7 years ago

atv2016 commented 7 years ago

Hi Berak, I wanted to use frontalizer for alignment of my image set. I put dlib in the directory, but after cmake, it seems to break on compiling extractor.cpp with the hal namespace not being defined.

Any idea?

Zeus:uniform-lbp-master alefveld$ make Scanning dependencies of target challenge [ 3%] Building CXX object CMakeFiles/challenge.dir/extractor.cpp.o /Users/alefveld/Downloads/uniform-lbp-master/extractor.cpp:52:9: error: use of undeclared identifier 'hal' hal::fastAtan2(s1.ptr(0), s2.ptr(0), s3.ptr(0), I.total(), true); ^ /Users/alefveld/Downloads/uniform-lbp-master/extractor.cpp:645:9: error: use of undeclared identifier 'hal' hal::fastAtan2(s1.ptr(0), s2.ptr(0), s3.ptr(0), I.total(), true); ^ /Users/alefveld/Downloads/uniform-lbp-master/extractor.cpp:652:9: error: use of undeclared identifier 'hal' hal::magnitude(s1.ptr(0), s2.ptr(0), s4.ptr(0), I.total()); ^ /Users/alefveld/Downloads/uniform-lbp-master/extractor.cpp:677:9: error: use of undeclared identifier 'hal' hal::fastAtan2(s1.ptr(0), s2.ptr(0), s3.ptr(0), I.total(), true); ^ /Users/alefveld/Downloads/uniform-lbp-master/extractor.cpp:680:9: error: use of undeclared identifier 'hal' hal::magnitude(s1.ptr(0), s2.ptr(0), s4.ptr(0), I.total()); ^ 5 errors generated. make[2]: * [CMakeFiles/challenge.dir/extractor.cpp.o] Error 1 make[1]: * [CMakeFiles/challenge.dir/all] Error 2 make: *\ [all] Error 2

berak commented 7 years ago

the frontalize.cpp does only depend on dlib (and opencv), not on other files (like extractor.cpp). (you will need to compile frontalize.cpp and dlib/all/source.cpp) you'll also need some resources from the data folder, like reference_320_320.png, and the mdl.yml.gz, also the shape_predictor_68_face_landmarks.dat from dlib site)

but otherwise, you're right, opencv's hal module came and went, and i've got to push an update.

thanks for looking at it !

berak commented 7 years ago

ohh, that's you ;)

extractor.cpp updated

atv2016 commented 7 years ago

Haha yes that's me. Well I'd love to test it when you do push it out. In the meantime, would you know if there is another good c++ way to align faces?

Sent from my iPhone

On 21 Sep 2016, at 05:43, berak notifications@github.com<mailto:notifications@github.com> wrote:

the frontalize.cpp does only depend on dlib (and opencv), not on other files (like extractor.cpp)

but otherwise, you're right, opencv's hal module came and went, and i've got to push an update.

thanks for looking at it !

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/berak/uniform-lbp/issues/4#issuecomment-248510190, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AQIi03LZJejYOH-KY-_8yOA-6jfthGNNks5qsLXvgaJpZM4KCHfC.

berak commented 7 years ago

the 3d frontalization paper : https://arxiv.org/abs/1411.7964 read it , it's enlightening ;)

http://answers.opencv.org/question/24670/how-can-i-align-face-images/#24845 (that's what it all started with)

atv2016 commented 7 years ago

I'm up to my ears reading whitepapers lately :-). I'lll try that pastebin link code - hopefully that will do the trick. Was there any modification needed, i noticed you had some problems initially. Did you notice a big improvement?

atv2016 commented 7 years ago

Just as an update, i compiled it under clang up to : Scanning dependencies of target frontalize [ 65%] Building CXX object CMakeFiles/frontalize.dir/util/frontalize/frontalize.cpp.o In file included from /Users/alefveld/Downloads/uniform-lbp-master-2/util/frontalize/frontalize.cpp:15: /Users/alefveld/Downloads/uniform-lbp-master-2/util/frontalize/frontalizer.h:13:7: error: forward declaration of class cannot have a nested name specifier class dlib::shape_predictor; ^~ 1 error generated. make[2]: * [CMakeFiles/frontalize.dir/util/frontalize/frontalize.cpp.o] Error 1 make[1]: * [CMakeFiles/frontalize.dir/all] Error 2 make: *\ [all] Error 2 Zeus:uniform-lbp-master-2 alefveld$

If i use gcc it becomes a real mess. I think the above is just a one liner fix and just needs to be put in a namespace but i can't quite figure out how.

berak commented 7 years ago

not your fault, but a design problem on my side. (and indeed, g++ showed the same thing as a warning lately.) - that reference was probably a bad idea in the 1st place.

latest commit should fix it.

atv2016 commented 7 years ago

Thanks berak. I did coincidentally get this to compile now: https://github.com/albertofernandezvillan/face-alignment

Few things: I put dlib in the root dir of this project. And i put in a symlink from dlib to dlib-18-8/dlib.

I had to change <dlib/image_processing.h> in frontalize.cpp to below:

include "../../dlib/image_processing.h"

include "../../dlib/opencv/cv_image.h"

And do the same in landmarks.cpp

include "dlib/image_processing.h"

include "dlib/opencv/cv_image.h"

But once i do i get: [ 68%] Linking CXX executable frontalize Undefined symbols for architecture x86_64: "_USER_ERROR__missing_dlib_all_source_cpp_fileORinconsistent_use_of_DEBUG_or_ENABLE_ASSERTS_preprocessordirectives", referenced from: _dlib_check_consistent_assert_usage in frontalize.cpp.o

Am i missing something (i noticed you mentioned compiling dlib/all/source.cpp but i don't see it anywhere included in the source files, do i need to link against it ?

berak commented 7 years ago

when using dlib, you have to add dlib/all/source.cpp to your project / cmdline

atv2016 commented 7 years ago

But that's already taken care of in the CmakeLists.txt file right ?

I've already added dlib-18.8 directory to the root and a symlink to dlib-18.8/dlib so it can access all the include files.

Sorry i don't mean to be annoying. Please don't feel obliged to answer, i'll figure it out :-). I really like the approach though, where regular alignment just aligns the eyes, this really turns people's faces around it seems (and i think your implementation does alignment anyway).

yxchng commented 7 years ago

@atv2016 @berak any updates? Must we really include the source.cpp? It seems to me that we are just compiling 2 times unnecessarily if we include that, one when we build the library and another when we build the code and the second time will be done all the time when we build the code.

berak commented 7 years ago

@yxchng ,

Must we really include the source.cpp?

yes, at least once, for the frontalizer code. that is, if you use dlib, e.g. this has awesome landmarks, too !

one when we build the library

uh ? what do you mean ? which library ?