kalwalt / webarkit-jsfeat-cpp

c++ jsfeat version
GNU Lesser General Public License v2.1
6 stars 3 forks source link
computer-vision emscripten image-processing imgproc imgprocessing jsfeat jsfeat-next wasm webar webarkit webarkitlib webassembly

webarkit-jsfeat-cpp

c++ jsfeat version to build a WASM version thanks to Emscripten. The project is a Work in Progress, not all the features are released to make a comparison with the original jsfeat code. At the moment only some classes are implemented and a bunch of functions are under testing. Anyway the main idea is to provide c++ code to build a WASM version, it's not intended to be used as a c++ library. Maybe this will become the future of webarkit

Classes

Matrix_t

This class is responsible to hold different types of data, to be used by all classes.

Matrix_smart

Experimental class very similar to Matrix_t but use shared_ptr in the core

Imgproc

It is one of important classes to manipulate image data for image processing. For now we have these functions:

Orb

Oriented FAST and rotated BRIEF (ORB) is one most important class for feature tracking. Ths feature is under testing.

Keypoint_t

A class to store key points for image tracking algorithms.

Keypoints

A class to store a vector of keypoint_t for image tracking algorithms.

Yape06

Feature detector from Computer Vision Lab, Ecole Polytechnique Federale de Lausanne (EPFL), Switzerland.

Pyramid_t

A class to handle multiple pyramidal images.

This project is quite experimental so do not expect great results. More classes will be implemented in the future.

Useful functions

At the moment you can try load_jpeg_data function to load a jpeg file and get important jpeg data (width, height, dpi and raw data). See grayscale_example or grayscale_m_example to see the function in action. Try yape06_detect function as a compact version for the yape06 detect routine. See it in action in the yape06_detect_video_example.html

Libs

Libs are stored in build folder:

<script type="module">
    import jsfeatCpp from "./../build/jsfeatcpp.js"
</script>

There isn't a npm package yet, so this is the only way.

or the non ES6 version :

 <script src="https://github.com/kalwalt/webarkit-jsfeat-cpp/raw/main/./build/jsfeatcpp.js"></script>

but the Module object will be available only when it is full loaded, so wrap your code into the listener:

window.addEventListener('jsfeatCpp-loaded', function (e) {
    //your code here...
    })

Examples

Take a look at our examples in the examples folder:

Both examples use the debug version of the lib but, of course you can use the non-debug version as well.

NPM

npm is used to build the libar.bc and libar_debug.bc libs inside the build folder. You don't need to run npm install but it is required to have node and npm installed globally.

Building the library

If you make changes and/or if you make some enhancement to the C++ code ypu need to build the library. Run the shell script in the main folder: For the first time run: ./build.sh emscripten-all this will build all the libs. After that if you need to compile and build only jsfeat libs: ./build.sh emscripten and the two libs will be compiled in the build directory.

If you run under Windows use the ./build.Unix.sh script instead.

We used emsdk 3.1.20.