You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adding NFT ( Natural Feature Tracking ) to the master branch
Many thanks to @kalwalt@nicolocarpignoli@Carnaux and many more who I simply can't find their GitHub names. If someone has them please tag them inside a comment.
We are finally there. jsartoolkit5 with NFT support. It runs smoothly on phones! This is so awesome and exciting and I feel so honored to merge that into the main branch.
Exciting times ahead.
Emscripten port of [ARToolKit](https://github.com/artoolkit/artoolkit5) to JavaScript.
3
+
Emscripten port of [ARToolKit](https://github.com/artoolkitx/artoolkit5) to JavaScript.
4
+
5
+
## MArkers Types
6
+
7
+
JSARToolKit5 support these types of markers:
8
+
- Square pictorial markers
9
+
- Square barcode markers
10
+
- Multi square markers set
11
+
- NFT (natural feature tracking) markers
4
12
5
13
---
6
14
**NOTE:**
@@ -19,18 +27,19 @@ When writing JavaScript and making changes be aware that the emscripten uglifier
19
27
-`tools/` (build scripts for building ARToolKit.js)
20
28
21
29
## WebAssembly
22
-
JSARToolKit5 supports WebAssembly. The libary builds two WebAssembly artefacts during the build process. These are ```build/artoolkit_wasm.js``` and ```build/artoolkit_wasm.wasm```. To use those include the artoolkit_wasm.js into your html page and define ```var artoolkit_wasm_url = '<<PATH TO>>/artoolkit_wasm.wasm';``` prior to loading the artoolkit_wasm.js file, like so:
30
+
31
+
JSARToolKit5 supports WebAssembly. The libary builds two WebAssembly artifacts during the build process. These are ```build/artoolkit_wasm.js``` and ```build/artoolkit_wasm.wasm```. To use those, include the artoolkit_wasm.js into your html page and define ```var artoolkit_wasm_url = '<<PATH TO>>/artoolkit_wasm.wasm';``` before loading the artoolkit_wasm.js file, like this:
23
32
24
33
```js
25
34
<script type='text/javascript'>
26
35
var artoolkit_wasm_url ='../build/artoolkit_wasm.wasm';
@@ -42,65 +51,77 @@ See examples/simple_image_wasm.html for details.
42
51
2. Clone ARToolKit5 project to get the latest source files. From within jsartoolkit5 directory do `git submodule update --init`. If you already cloned ARToolKit5 to a different directory you can:
43
52
- create a link in the `jsartoolkit5/emscripten/` directory that points to ARToolKit5 (`jsartoolkit5/emscripten/artoolkit5`) (Linux and macOS only)
44
53
- or, set the `ARTOOLKIT5_ROOT` environment variable to point to your ARToolKit5 clone
45
-
- or, change the `tools/makem.js` file to point to your artoolkit5 clone (line 62, 83, 107, 140)
54
+
- or, change the `tools/makem.js` file to point to your artoolkit5 clone (line 20)
46
55
47
-
## Build Instructions
56
+
## Build the project
48
57
49
-
### Build using Docker
50
-
1. Install Docker (if you havn't already) [Docker](https://www.docker.com/) -> Get Docker
51
-
3. From inside jsartoolkit5 directory run `docker run -dit --name emscripten -v $(pwd):/src trzeci/emscripten-slim:sdk-tag-1.37.34-64bit bash`
52
-
4.`docker exec emscripten npm run build`
58
+
### Recommended: Build using Docker
53
59
60
+
1. Install Docker (if you havn't already): [get Docker](https://www.docker.com/)
61
+
2. Clone artoolkit5 repository on your machine: `git submodule update --init`
62
+
3.`npm install`
63
+
4. From inside jsartoolkit5 directory run `docker run -dit --name emscripten -v $(pwd):/src trzeci/emscripten-slim:latest bash` to download and start the container, in preparation for the build
64
+
5.`docker exec emscripten npm run build-local` to build JS version of artoolkit5
65
+
6.`docker stop emscripten` to stop the container after the build, if needed
66
+
7.`docker rm emscripten` to remove the container
67
+
8.`docker rmi trzeci/emscripten-slim:latest` to remove the Docker image, if you don't need it anymore
68
+
9. The build artifacts will appear in `/build`. There's a build with debug symbols in `artoolkit.debug.js` file and the optimized build with bundled JS API in `artoolkit.min.js`; also, a WebAssembly build artoolkit_wasm.js and artoolkit_wasm.wasm
54
69
55
-
### Build with manual emscripten setup
70
+
### ⚠️ Not recommended ⚠️ : Build local with manual emscripten setup
71
+
72
+
To prevent issues with Emscripten setup and to not have to maintain several build environments (macOS, Windows, Linux) we only maintain the **Build using Docker**. Following are the instructions of the last know build on Linux which we verified are working. **Use at own risk.**
We used emscripten version **1.39.5-fastcomp**~~1.38.44-fastcomp~~
61
80
81
+
jsartoolkit5 aim is to create a Javascript version of artoolkit5. First, you need the artoolkit5 repository on your machine:
62
82
2. Clone ARToolKit5 project to get the latest source files. From within jsartoolkit5 directory do `git submodule update --init`. If you already cloned ARToolKit5 to a different directory you can:
63
83
- create a link in the `jsartoolkit5/emscripten/` directory that points to ARToolKit5 (`jsartoolkit5/emscripten/artoolkit5`)
64
84
- or, set the `ARTOOLKIT5_ROOT` environment variable to point to your ARToolKit5 clone
65
-
- or, change the `tools/makem.js` file to point to your artoolkit5 clone (line 62, 83, 107, 140)
85
+
- or, change the `tools/makem.js` file to point to your artoolkit5 clone (line 20)
66
86
67
87
3. Building
68
-
1. Make sure `EMSCRIPTEN` env variable is set (e.g. `EMSCRIPTEN=/usr/lib/emsdk_portable/emscripten/master/`)
69
-
3. Run `npm run build`
70
-
88
+
1. Make sure `EMSCRIPTEN` env variable is set (e.g. `EMSCRIPTEN=/usr/lib/emsdk_portable/emscripten/master/ node tools/makem.js`
89
+
3. Run `npm install`
90
+
4. Run `npm run build-local`
91
+
71
92
During development, you can run ```npm run watch```, it will rebuild the library everytime you change ```./js/``` directory.
72
93
73
94
4. The built ASM.js files are in `/build`. There's a build with debug symbols in `artoolkit.debug.js` and the optimized build with bundled JS API in `artoolkit.min.js`.
@@ -159,57 +182,47 @@ The basic operation goes like this:
159
182
</script>
160
183
```
161
184
162
-
##Public
185
+
### Basic example with a worker and a NFT marker
163
186
164
-
*the calls your JS apps needs*
187
+
**NFT** (**N**atural **F**eature **T**racking) is a markerless technology that let you track almost any images you want. To use this feature take a look at the **nft_improved_worker** example folder. If you want to create your custom NFT marker you can use the online tool [NFT-Marker-Creator](https://carnaux.github.io/NFT-Marker-Creator/). Before proceeding with the creation of your markers, carefully read the information on the [wiki](https://github.com/Carnaux/NFT-Marker-Creator/wiki/Creating-good-markers).
165
188
166
-
-`artoolkit.init(path, camera_param_path)` - load path for artoolkit emscripten files
167
-
-`artoolkit.onReady(callback)` - runs callback when artoolkit has completely downloaded, initalized and ready to run
168
-
-`artoolkit.setup(width, height);` - initalize a buffer size for a canvas of width & height
169
-
-`artoolkit.process(canvas);` - extracts a frame from a canvas and process it
170
-
-`artoolkit.debugSetup()` - enables debugging, adds a threshold image to the dom
171
-
-`artoolkit.getDetectedMarkers()` - returns an array of detected markers from last detection process
172
-
-`artoolkit.getCameraMatrix()` - returns the projection matrix computed from camera parameters
173
-
-`artoolkit.getTransformationMatrix()` - returns the 16-element WebGL transformation matrix
189
+
In the code below a summarized example:
174
190
175
-
## Internals
176
191
177
-
*calls called from emscripten runtime -> artoolkit.js*
178
-
179
-
-`artoolkit.onFrameMalloc(object)` - gets called when frame buffer gets allocated for canvas
180
-
-`artoolkit.onMarkerNum(number)` - gets called with the numbers of markers detected
181
-
-`artoolkit.onGetMarker(object, index)` - gets called with the marker struct for the positioned marker
0 commit comments