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
13 changes: 13 additions & 0 deletions build.Unix.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash

if [ ! -f "opencv/build_wasm/em-flags.txt" ] ; then
curl --location "https://github.com/webarkit/opencv-em/releases/download/0.0.4/opencv-em-4.5.0-emcc-3.1.7.zip" -o opencv-em.zip
unzip -o opencv-em.zip -d opencv
cp -avr opencv/build_wasm/opencv ./
rm opencv-em.zip
fi

cd emscripten/WebARKitLib/ARX
cmake .
make
echo "Created config.h file!"
82 changes: 77 additions & 5 deletions build/webarkit_ES6_wasm.js

Large diffs are not rendered by default.

579 changes: 367 additions & 212 deletions dist/WebARKit.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/WebARKit.js.LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
2 changes: 1 addition & 1 deletion emscripten/WebARKitLib
Submodule WebARKitLib updated 41 files
+0 −1 ARX/AR/arRefineCorners.cpp
+0 −3 ARX/AR/arRefineCorners.h
+123 −0 ARX/AR/matrixCode.c
+62 −0 ARX/AR/matrixCode.h
+4 −1 ARX/OCVT/HarrisDetector.cpp
+15 −1 ARX/OCVT/OCVFeatureDetector.cpp
+4 −0 ARX/OCVT/OCVFeatureDetector.h
+1 −1 ARX/OCVT/OCVUtils.h
+2 −2 ARX/OCVT/PlanarOrbTracker.cpp
+244 −244 ARX/OCVT/PlanarTracker.cpp
+3 −1 ARX/OCVT/TrackableInfo.h
+12 −10 ARX/OCVT/TrackingPointSelector.cpp
+11 −10 ARX/OCVT/TrackingPointSelector.h
+1 −0 ARX/OCVT/include/ARX/OCVT/PlanarOrbTracker.h
+14 −5 ARX/OCVT/include/ARX/OCVT/PlanarTracker.h
+3 −0 WebARKit/WebARKitPattern.cpp
+6 −5 WebARKit/WebARKitTrackable.cpp
+58 −11 WebARKit/WebARKitTrackable2d.cpp
+105 −4 WebARKit/WebARKitTrackableMultiSquare.cpp
+72 −0 WebARKit/WebARKitTrackableMultiSquareAuto.cpp
+102 −44 WebARKit/WebARKitTrackableNFT.cpp
+51 −5 WebARKit/WebARKitTrackableOrb2d.cpp
+93 −7 WebARKit/WebARKitTrackableSquare.cpp
+34 −26 WebARKit/WebARKitTracker2d.cpp
+210 −71 WebARKit/WebARKitTrackerNFT.cpp
+105 −16 WebARKit/WebARKit_c.cpp
+0 −4 WebARKit/include/WebARKit/Platform.h
+0 −1 WebARKit/include/WebARKit/WebARKitController.h
+24 −7 WebARKit/include/WebARKit/WebARKitTrackable.h
+27 −5 WebARKit/include/WebARKit/WebARKitTrackable2d.h
+7 −0 WebARKit/include/WebARKit/WebARKitTrackableMultiSquare.h
+7 −0 WebARKit/include/WebARKit/WebARKitTrackableMultiSquareAuto.h
+8 −3 WebARKit/include/WebARKit/WebARKitTrackableNFT.h
+8 −1 WebARKit/include/WebARKit/WebARKitTrackableOrb2d.h
+6 −0 WebARKit/include/WebARKit/WebARKitTrackableSquare.h
+10 −5 WebARKit/include/WebARKit/WebARKitTracker2d.h
+7 −1 WebARKit/include/WebARKit/WebARKitTrackerNFT.h
+69 −1 WebARKit/include/WebARKit/WebARKit_c.h
+13 −44 WebARKit/trackingSubMod.cpp
+392 −376 WebARKitTrackers/PlanarOrbTracker.cpp
+4 −3 lib/SRC/OCVT/PlanarTracker.cpp
1 change: 1 addition & 0 deletions examples/orb_2d_example.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<video loop autoplay muted playsinline id="video">
</video>
<canvas id="canvas"></canvas>
<canvas id="overlayCanvas"></canvas>
</div>
<script src="./Data/js/third_party/three.js/three.min.js"></script>
<script src="./Data/js/third_party/three.js/stats.min.js"></script>
Expand Down
39 changes: 39 additions & 0 deletions examples/threejs_orb_2d_worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ function start(markerUrl, video, input_width, input_height, render_update, track
var context_process = canvas_process.getContext('2d');
var targetCanvas = document.querySelector("#canvas");

var overlayCanvas = document.querySelector("#overlayCanvas");

var renderer = new THREE.WebGLRenderer({ canvas: targetCanvas, alpha: true, antialias: true });
renderer.setPixelRatio(window.devicePixelRatio);

Expand Down Expand Up @@ -121,7 +123,11 @@ function start(markerUrl, video, input_width, input_height, render_update, track
found(null);
break;
}
case 'warped': {
warped(msg);
break;
}
}
track_update();
process();
};
Expand All @@ -137,6 +143,39 @@ function start(markerUrl, video, input_width, input_height, render_update, track
}
};

function clearOverlayCtx() {
const overlayCtx = overlayCanvas.getContext("2d");
overlayCtx.clearRect(0, 0, vw, vh);
}

function drawCorners(corners) {
const overlayCtx = overlayCanvas.getContext("2d");
clearOverlayCtx();

overlayCtx.beginPath();
overlayCtx.strokeStyle = "blue";
overlayCtx.lineWidth = 3;

// [x1,y1,x2,y2,x3,y3,x4,y4]
overlayCtx.moveTo(corners[0], corners[1]);
overlayCtx.lineTo(corners[2], corners[3]);
overlayCtx.lineTo(corners[4], corners[5]);
overlayCtx.lineTo(corners[6], corners[7]);
overlayCtx.lineTo(corners[0], corners[1]);

overlayCtx.stroke();
}

var warped = function(msg) {
if (!msg) {
console.log("no warped");
} else {
console.log("warped", msg.data);
clearOverlayCtx();
drawCorners(msg.data);
}
};

var lasttime = Date.now();
var time = 0;

Expand Down
Loading