This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker exec emscripten-wam-ar emcmake cmake -B /src/build -S /src | |
docker exec emscripten-wam-ar emmake make -C /build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | |
<meta name="description" content="A JavaScript Computer Vision Library"> | |
<meta name="author" content="Eugene Zatepyakin"> | |
<title>JSFeat - JavaScript Computer Vision Library.</title> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake_minimum_required(VERSION 3.1) | |
project(ARTOOLKITPLUS_EM) | |
set(CMAKE_CXX_STANDARD 17) | |
set(COMPRESSION_DEBUG_FLAG " -O0 ") | |
set(COMPRESSION_RELEASE_FLAG " -Oz ") | |
set(DEBUG_FLAGS " -g -sASSERTIONS=1 --profiling -s DEMANGLE_SUPPORT=1 ") | |
set(ES6_BUILD " -s EXPORT_ES6=1 -s USE_ES6_IMPORT_META=0 -sEXPORT_NAME=ARtoolKitPlus -s MODULARIZE=1 ") | |
set(MEMORY_OPTION " -s TOTAL_MEMORY=268435456 -s ALLOW_MEMORY_GROWTH=1 ") | |
set(FLAGS " -sFORCE_FILESYSTEM -s EXPORTED_RUNTIME_METHODS=['FS'] ") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var browser = (function () { | |
var test = function (regexp) { | |
return regexp.test(navigator.userAgent); | |
}; | |
switch (true) { | |
case test(/edg/i): | |
return "Microsoft Edge"; | |
case test(/trident/i): | |
return "Microsoft Internet Explorer"; | |
case test(/firefox|fxios/i): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef IMGPROC_TEMPLATES_H | |
#define IMGPROC_TEMPLATES_H | |
#include <algorithm> | |
#include <cache/Cache.h> | |
#include <cmath> | |
#include <matrix_t/matrix_t.h> | |
namespace jsfeat { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MEMORY_OPTION= -s TOTAL_MEMORY=268435456 -s ALLOW_MEMORY_GROWTH=1 | |
ES6_BUILD= -s EXPORT_ES6=1 -s USE_ES6_IMPORT_META=0 -sEXPORT_NAME=jsfeatCpp -s MODULARIZE=1 | |
SINGLE_FILE= -s SINGLE_FILE=1 | |
CXX=emcc | |
all: debug_em em | |
debug_em: libjsfeat_debug | |
$(CXX) -Isrc build/libjsfeat.bc emscripten/webarkitJsfeat.cpp -sEXPORTED_FUNCTIONS=_Grayscale,_Grayscale_m -sEXPORTED_RUNTIME_METHODS=cwrap $(MEMORY_OPTION) --post-js js/post_bindings.api.js --bind $(ES6_BUILD) $(SINGLE_FILE) -o build/jsfeatcpp_debug.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* articles reference https://www.weiy.city/2022/08/wasm-pass-array-between-c-and-js/ | |
and stackoverflow article https://stackoverflow.com/questions/20355880/emscripten-how-can-i-solve-unboundtypeerror | |
*/ | |
// add this to matrix_t class | |
void test(uintptr_t input) { | |
auto ptr = reinterpret_cast<int*>(input); | |
JSLOGi("ptr[0]: %i", ptr[0]); | |
} | |
// inside bindings.cpp add to the matrix_t class |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <emscripten/val.h> | |
#include <cstddef> | |
// This is only a snippet not a complete example, insert it in your project. | |
// check if the emscripten value is whatever type | |
bool isType(emscripten::val value, const std::string &type) { | |
return (value.typeOf().as<std::string>() == type); | |
} | |
// check if it's an object or not (Uint8Array, Int8Array, Int32Array...) | |
void test(emscripten::val value) { | |
if (isType(value, "object")) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# artoolkitX Examples CMake configuration file. | |
# 2d tracking example | |
# | |
# To invoke CMake on this file, from the chosen build directory, invoke: | |
# cmake <path to directory containing this file>. | |
# | |
# Author(s): Philip Lamb <phil@artoolkitx.org> | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isMobile() { | |
//return /Android|mobile|iPad|iPhone/i.test(navigator.userAgent) | |
if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) { | |
// true for mobile device | |
return true; | |
} | |
return false; | |
} | |
const scene = new THREE.Scene(); |