diff --git a/emscripten/bindings.cpp b/emscripten/bindings.cpp index 4ef1ae5..6ea78e3 100644 --- a/emscripten/bindings.cpp +++ b/emscripten/bindings.cpp @@ -134,5 +134,6 @@ EMSCRIPTEN_BINDINGS(webarkit) { // Extern jsfeat functions function("load_jpeg_data", &load_jpeg_data); + function("yape06_detect", &yape06_detect); }; \ No newline at end of file diff --git a/emscripten/webarkitJsfeat.cpp b/emscripten/webarkitJsfeat.cpp index 42b0f9e..69426c5 100644 --- a/emscripten/webarkitJsfeat.cpp +++ b/emscripten/webarkitJsfeat.cpp @@ -85,7 +85,22 @@ emscripten::val load_jpeg(const char* filename) { emscripten::val load_jpeg_data(std::string filename) { auto out = load_jpeg(filename.c_str()); return out; -} +}; + +int yape06_detect(emscripten::val inputSrc, int w, int h) { + auto src = emscripten::convertJSArrayToNumberVector(inputSrc); + Imgproc imgproc; + Yape06 yape; + KeyPoints keypoints(w * h); + std::unique_ptr lev0_img = std::make_unique(w, h, ComboTypes::U8C1_t); + + imgproc.grayscale_internal(src.data(), w, h, lev0_img.get(), ColorSpace::COLOR_RGBA2GRAY); + imgproc.gaussian_blur_internal(lev0_img.get(), lev0_img.get(), 5, 2); + auto kpc = yape.detect_internal(lev0_img.get(), keypoints&, 17); + + return kpc.count; +}; + } #include "bindings.cpp" \ No newline at end of file diff --git a/examples/yape06_detector_video_example.html b/examples/yape06_detector_video_example.html new file mode 100644 index 0000000..ae558cf --- /dev/null +++ b/examples/yape06_detector_video_example.html @@ -0,0 +1,129 @@ + + + + + + + + JsfeatCpp video grayscale example + + + + + + + + + + + + \ No newline at end of file