Skip to content

Instantly share code, notes, and snippets.

View kalwalt's full-sized avatar
⛰️
Working on the mountains!

Walter Perdan kalwalt

⛰️
Working on the mountains!
View GitHub Profile
@kalwalt
kalwalt / script.txt
Created March 15, 2023 16:24
commands to build wasm-ar with docker
docker exec emscripten-wam-ar emcmake cmake -B /src/build -S /src
docker exec emscripten-wam-ar emmake make -C /build
@kalwalt
kalwalt / jsfeat_orb_pattern.html
Created March 1, 2023 22:37
jsferat with orb and the pinball image.
<!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>
@kalwalt
kalwalt / CMakeLists.txt
Created January 10, 2023 20:53
testing new cmake file for artoolkitplus-ts
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'] ")
@kalwalt
kalwalt / artoolkitNFT_ES6.worker.js
Last active December 13, 2022 22:52
testing another init for jsartoolkitNFT
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):
#ifndef IMGPROC_TEMPLATES_H
#define IMGPROC_TEMPLATES_H
#include <algorithm>
#include <cache/Cache.h>
#include <cmath>
#include <matrix_t/matrix_t.h>
namespace jsfeat {
@kalwalt
kalwalt / Makefile
Created September 9, 2022 22:31
Makefile test for webarkit-jsfeat-cpp
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
@kalwalt
kalwalt / matrix_t_test.h
Created September 8, 2022 14:45
Some note to accept pointer arguments in a function with Emscripten
/* 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
@kalwalt
kalwalt / typeOf.cpp
Created August 31, 2022 14:41
A simple snippet to check the typeof JS.
#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")) {
@kalwalt
kalwalt / CMakeLists.txt
Created April 24, 2022 19:21
artoolkitx nft example
#
# 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>
#
@kalwalt
kalwalt / index.js
Created March 7, 2022 18:11
ttesting example for threex location based only
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();