Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ 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(ES6_BUILD_SM " -s EXPORT_ES6=1 -s USE_ES6_IMPORT_META=0 -sEXPORT_NAME=TrackerSingleMarker -s MODULARIZE=1 ")
set(MEMORY_OPTION " -s TOTAL_MEMORY=268435456 -s ALLOW_MEMORY_GROWTH=1 ")
set(FLAGS " -sFORCE_FILESYSTEM -s EXPORTED_RUNTIME_METHODS=['FS'] ")
set(FLAGS " -sFORCE_FILESYSTEM -s EXPORTED_RUNTIME_METHODS=['FS'] -DARTK_USE_BOOST=true -s USE_BOOST_HEADERS=1")
set(INCLUDES " -I../emscripten/artoolkitplus ")
set(LINK_LIBS " ./emscripten/artoolkitplus/lib/libARToolKitPlus.a ")
set(SINGLE_FILE " -s SINGLE_FILE=1")
Expand All @@ -17,6 +17,7 @@ if(LINK_LIBS)
message("libARToolKitPlus already commpiled!")
else()
message("compiling libARToolKitPlus!")
add_definitions(" -DARTK_USE_BOOST=TRUE -DBOOST_NO_CXX98_FUNCTION_BASE -s USE_BOOST_HEADERS=1 ")
add_subdirectory(emscripten/artoolkitplus)
endif()

Expand Down
4 changes: 2 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
cd build
echo "Preparing Release libs.........."
echo "Configuring with cmake"
emcmake cmake .. -DCMAKE_BUILD_TYPE="Release"
emcmake cmake .. -DARTK_USE_BOOST=true -DCMAKE_BUILD_TYPE="Release"
echo "Building the libs"
emmake make
echo "Preparing Debug libs..........."
echo "Configuring with cmake"
emcmake cmake .. -DCMAKE_BUILD_TYPE="Debug"
emcmake cmake .. -DARTK_USE_BOOST=true -DCMAKE_BUILD_TYPE="Debug"
echo "Building the libs"
emmake make
2 changes: 1 addition & 1 deletion build/trackerSM_ES6.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/trackerSM_ES6_debug.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/ARToolKitPlus.js

Large diffs are not rendered by default.

25 changes: 25 additions & 0 deletions example/data/data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0"?>
<opencv_storage>
<image_width>
640
</image_width>
<image_height>
480
</image_height>
<distortion_coefficients>
<rows>5</rows>
<cols>1</cols>
<dt>d</dt>
<data>
5.1011535316695424e-02 2.9740831958923337e+00 0. 0.
-4.9154706776004986e+01</data>
</distortion_coefficients>
<camera_matrix type_id="opencv-matrix">
<rows>3</rows>
<cols>3</cols>
<dt>d</dt>
<data>
1.1998640834468974e+03 0. 3.1950000000000000e+02 0.
1.1998640834468974e+03 2.3950000000000000e+02 0. 0. 1.</data>
</camera_matrix>
</opencv_storage>
48 changes: 48 additions & 0 deletions example/example-ts-xml.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>A simple example with artoolkitplus_em and new dist lib</title>
</head>

<body>
<script src="../dist/ARToolKitPlus.js"></script>

<script>
ARToolKitPlus.ARToolKitPlus.initAR().then((ar) => {
console.log(ar);
ARToolKitPlus.TrackerSingleMarker.initTrackerSingleMarker(false, "data/data.xml", 'xml', 320, 240, 80).then(
tracker => {
console.log(tracker);
fetch("data/image_320_240_8_marker_id_simple_nr031.raw")
.then(response => {
if (!response.ok) {
throw new Error('Network response was not OK');
}
return response.arrayBuffer();
})
.then(buff => {
let buffer = new Uint8Array(buff)
// Display the Pixel Format in use, just to test the static variables...
console.log("PIXEL_FORMAT: ", ARToolKitPlus.ARToolKitPlus.PIXEL_FORMAT.PIXEL_FORMAT_LUM)
vec = tracker.update(buffer);
console.log("Marker found is: ", vec.get(0));
var conf = tracker.getConfidence();
console.log("Marker confidence is: ", conf * 100, "%");
var matrix = tracker.getModelViewMatrix();
console.log("Marker pose matrix is:", matrix);
var projMatrix = tracker.getProjectionMatrix();
console.log("Camera proj matrix is:", projMatrix);
})

})
})

// })
</script>
</body>

</html>
11 changes: 9 additions & 2 deletions example/loader_ES6.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,15 @@ const trk = await TrackerSingleMarker();
const artoolkitplus = await ARtoolKitPlus();

let t;
export function loadCalib(url, callback, errorCallback) {
var filename = "/load_calib_" + file_count++ + ".cal";
export function loadCalib(url, cameraFileType, callback, errorCallback) {
var cmt;
if (cameraFileType == 'cal') {
cmt = '.cal';
}
else if (cameraFileType == 'xml') {
cmt = '.xml';
} else throw new Error("Unknown camera file type: " + cameraFileType);
var filename = "/load_calib_" + file_count++ + cmt;
var writeCallback = function () {
t = new trk.TrackerSingleMarker(false, 320, 240, 80);
if (!t.setup) {
Expand Down
Loading