Help building opencv js (Emscripten) for dlib example

asked 2017-08-21 00:24:42 -0600

Akshay Hazari gravatar image

updated 2017-08-21 03:34:07 -0600

Have been trying to convert dlibs facial landmarks code to js using emscripten. It fails in parts where it has been using OpenCV where it uses the native c++ libraries instead of Emscripten libcxx libraries. There's an issue on Emscripten I have issued and have got some help from them - https://github.com/kripken/emscripten.... I had even tried building opencv from source using Emscripten option as defined in its CMakelists.txt.

Need to get some help about what could be the procedure I may go about to tackle this. Any help will be appreciated.

Update: Was able to build and install OpenCV from source for EMSCRIPTEN. Tried to compile the dlib code to js which resulted in an error like

/home/akshay/Downloads/emsdk-portable/emscripten/1.37.19/build.emscripten/DLIB.js:110
      throw ex;
      ^
Runtime error: The application has corrupted its heap memory area (address zero)!

While building the code it generated warnings like :

warning: emitted code will contain very large numbers of local variables, which is bad for performance (build to JS with -O2 or above to avoid this - make sure to do so both on source files, and during 'linking')
warning: unresolved symbol: _ZNK4dlib6base646decodeERNSt3__213basic_istreamIcNS1_11char_traitsIcEEEERNS1_13basic_ostreamIcS4_EE
warning: unresolved symbol: _ZNK4dlib11base_window9is_closedEv
warning: unresolved symbol: _ZNK4dlib13image_display22get_image_display_rectEv
warning: unresolved symbol: _ZN4dlib6base64C1Ev
warning: unresolved symbol: _ZN4dlib24entropy_decoder_kernel_210set_streamERNSt3__213basic_istreamIcNS1_11char_traitsIcEEEE
warning: unresolved symbol: _ZN4dlib17popup_menu_region7disableEv
warning: unresolved symbol: _ZN4dlib24entropy_decoder_kernel_26decodeEjj
warning: unresolved symbol: _ZN9_IplImageC1ERKN2cv3MatE
warning: unresolved symbol: _ZN2cv8fastFreeEPv
warning: unresolved symbol: _ZN4dlib12image_windowC1Ev
warning: unresolved symbol: _ZN4dlib21draw_sunken_rectangleERKNS_6canvasERKNS_9rectangleEh
warning: unresolved symbol: _ZN4dlib12image_window13clear_overlayEv
warning: unresolved symbol: _ZN4dlib24entropy_decoder_kernel_2D1Ev
warning: unresolved symbol: _ZN4dlib17scrollable_region19set_total_rect_sizeEmm
warning: unresolved symbol: _ZN2cv3Mat8copySizeERKS0_
edit retag flag offensive close merge delete

Comments

1

dlib says "No other packages are required to use the library. Only APIs that are provided by an out of the box OS are needed."

sturkmen gravatar imagesturkmen ( 2017-08-21 02:35:42 -0600 )edit

@sturkmen Was trying to convert one of DLIB's examples to js using EMSCRIPTEN. DLIB examples run fine on their own.

Akshay Hazari gravatar imageAkshay Hazari ( 2017-08-21 06:37:14 -0600 )edit

Hi, did you finally manage to compile dlib with emscripten?

navidzj gravatar imagenavidzj ( 2017-09-19 05:03:01 -0600 )edit

@navidzj , please do not post answers, if you have a question or comment. thank you.

berak gravatar imageberak ( 2017-09-19 05:19:14 -0600 )edit