@webarkit/jsartoolkit-nft
Advanced tools
Comparing version 1.4.1 to 1.5.0
@@ -101,3 +101,3 @@ var browser = (function () { | ||
// we cannot pass the entire ARControllerNFT, so we re-create one inside the Worker, starting from camera_param | ||
ARToolkitNFT.ARControllerNFT.customInit( | ||
ARControllerNFT.customInit( | ||
msg.pw, | ||
@@ -104,0 +104,0 @@ msg.ph, |
@@ -98,5 +98,5 @@ var browser = (function () { | ||
if (oef == true) { | ||
mat = oefFilter(ev.data.matrixGL_RH) | ||
mat = oefFilter(ev.data.matrixGL_RH); | ||
} else { | ||
mat = ev.data.matrixGL_RH | ||
mat = ev.data.matrixGL_RH; | ||
} | ||
@@ -134,3 +134,3 @@ markerResult = { | ||
// we cannot pass the entire ARControllerNFT, so we re-create one inside the Worker, starting from camera_param | ||
ARToolkitNFT.ARControllerNFT.initWithDimensions( | ||
ARControllerNFT.initWithDimensions( | ||
width, | ||
@@ -137,0 +137,0 @@ height, |
@@ -61,3 +61,3 @@ var scope; | ||
this.version = '1.4.1'; | ||
this.version = '1.5.0'; | ||
console.info('JsartoolkitNFT ', this.version); | ||
@@ -64,0 +64,0 @@ |
@@ -63,3 +63,3 @@ var browser = (function () { | ||
minCutOff: filterMinCF, | ||
beta: filterBeta | ||
beta: filterBeta, | ||
}); | ||
@@ -88,5 +88,5 @@ | ||
if (oef == true) { | ||
mat = oefFilter(ev.data.matrixGL_RH) | ||
mat = oefFilter(ev.data.matrixGL_RH); | ||
} else { | ||
mat = ev.data.matrixGL_RH | ||
mat = ev.data.matrixGL_RH; | ||
} | ||
@@ -105,7 +105,7 @@ markerResult = { | ||
ar.trackNFTMarkerId(id); | ||
let marker = ar.getNFTData(ar.id, 0); | ||
let marker = ar.getNFTData(0); | ||
console.log("nftMarker data: ", marker); | ||
postMessage({ | ||
type: "markerInfos", | ||
marker: marker | ||
marker: marker, | ||
}); | ||
@@ -115,3 +115,3 @@ console.log("loadNFTMarker -> ", id); | ||
type: "endLoading", | ||
end: true | ||
end: true, | ||
}); | ||
@@ -124,3 +124,3 @@ }).catch(function (err) { | ||
type: "loaded", | ||
proj: JSON.stringify(cameraMatrix) | ||
proj: JSON.stringify(cameraMatrix), | ||
}); | ||
@@ -136,7 +136,3 @@ }; | ||
// we cannot pass the entire ARControllerNFT, so we re-create one inside the Worker, starting from camera_param | ||
ARToolkitNFT.ARControllerNFT.initWithDimensions( | ||
msg.pw, | ||
msg.ph, | ||
msg.camera_para | ||
) | ||
ARControllerNFT.initWithDimensions(msg.pw, msg.ph, msg.camera_para) | ||
.then(onLoad) | ||
@@ -157,3 +153,3 @@ .catch(onError); | ||
postMessage({ | ||
type: "not found" | ||
type: "not found", | ||
}); | ||
@@ -163,2 +159,2 @@ } | ||
next = null; | ||
} | ||
} |
@@ -60,3 +60,3 @@ var browser = (function () { | ||
let filterBeta = 0.01; | ||
const filter = new OneEuroFilter({minCutOff: filterMinCF, beta: filterBeta}); | ||
const filter = new OneEuroFilter({ minCutOff: filterMinCF, beta: filterBeta }); | ||
@@ -82,13 +82,22 @@ function load(msg) { | ||
ar.addEventListener("lostNFTMarker", function(ev) { | ||
ar.addEventListener("lostNFTMarker", function (ev) { | ||
filter.reset(); | ||
}); | ||
const nftMarkers = new ar.artoolkitNFT.nftMarkers(); | ||
ar.loadNFTMarkers(msg.marker, function (ids) { | ||
for (var i = 0; i < ids.length; i++) { | ||
ar.trackNFTMarkerId(i); | ||
nftMarkers.push_back(ar.getNFTData(i,i)); | ||
} | ||
marker1 = ar.getNFTData(ar.id, 0); | ||
marker2 = ar.getNFTData(ar.id, 1); | ||
marker3 = ar.getNFTData(ar.id, 2); | ||
marker1 = ar.getNFTData(ids[0], 0); | ||
marker2 = ar.getNFTData(ids[1], 1); | ||
marker3 = ar.getNFTData(ids[2], 2); | ||
nftMarkers.push_back(marker1); | ||
console.log("Array of nftData: ", [nftMarkers.get(0), nftMarkers.get(1), nftMarkers.get(2)]); | ||
postMessage({ | ||
@@ -116,3 +125,3 @@ type: "markerInfos", | ||
// we cannot pass the entire ARControllerNFT, so we re-create one inside the Worker, starting from camera_param | ||
ARToolkitNFT.ARControllerNFT.initWithDimensions( | ||
ARControllerNFT.initWithDimensions( | ||
msg.pw, | ||
@@ -119,0 +128,0 @@ msg.ph, |
@@ -64,3 +64,3 @@ ; (function () { | ||
this.version = '1.4.1'; | ||
this.version = '1.5.0'; | ||
console.info('JsartoolkitNFT ', this.version); | ||
@@ -67,0 +67,0 @@ console.warn("This library is deprecated, use the ES6 version instead!! It will be removed in a future release.") |
import ARToolkitNFT from "../build/artoolkitNFT_embed_ES6_wasm.js"; | ||
// Import OneEuroFilter class into the worker. | ||
import { OneEuroFilter } from "./one-euro-filter-ES6.js" | ||
import { OneEuroFilter } from "./one-euro-filter-ES6.js"; | ||
@@ -59,5 +59,5 @@ self.onmessage = function (e) { | ||
if (oef == true) { | ||
mat = oefFilter(ev.data.matrixGL_RH) | ||
mat = oefFilter(ev.data.matrixGL_RH); | ||
} else { | ||
mat = ev.data.matrixGL_RH | ||
mat = ev.data.matrixGL_RH; | ||
} | ||
@@ -64,0 +64,0 @@ markerResult = { |
@@ -61,3 +61,3 @@ var browser = (function () { | ||
let filterBeta = 0.01; | ||
const filter = new OneEuroFilter({minCutOff: filterMinCF, beta: filterBeta}); | ||
const filter = new OneEuroFilter({ minCutOff: filterMinCF, beta: filterBeta }); | ||
@@ -84,3 +84,3 @@ function load(msg) { | ||
ar.addEventListener("lostNFTMarker", function(ev) { | ||
ar.addEventListener("lostNFTMarker", function (ev) { | ||
filter.reset(); | ||
@@ -87,0 +87,0 @@ }); |
@@ -61,3 +61,3 @@ var browser = (function () { | ||
let filterBeta = 0.01; | ||
const filter = new OneEuroFilter({minCutOff: filterMinCF, beta: filterBeta}); | ||
const filter = new OneEuroFilter({ minCutOff: filterMinCF, beta: filterBeta }); | ||
@@ -83,3 +83,3 @@ function load(msg) { | ||
ar.addEventListener("lostNFTMarker", function(ev) { | ||
ar.addEventListener("lostNFTMarker", function (ev) { | ||
filter.reset(); | ||
@@ -86,0 +86,0 @@ }); |
@@ -5,11 +5,11 @@ // Ref: https://jaantollander.com/post/noise-filtering-using-one-euro-filter/#mjx-eqn%3A1 | ||
const r = 2 * Math.PI * cutoff * te; | ||
return r / (r+1); | ||
} | ||
return r / (r + 1); | ||
}; | ||
const exponentialSmoothing = (a, x, xPrev) => { | ||
return a * x + (1 - a) * xPrev; | ||
} | ||
}; | ||
export class OneEuroFilter { | ||
constructor({minCutOff, beta}) { | ||
constructor({ minCutOff, beta }) { | ||
this.minCutOff = minCutOff; | ||
@@ -38,3 +38,3 @@ this.beta = beta; | ||
const {xPrev, tPrev, dxPrev} = this; | ||
const { xPrev, tPrev, dxPrev } = this; | ||
@@ -62,3 +62,3 @@ //console.log("filter", x, xPrev, x.map((xx, i) => x[i] - xPrev[i])); | ||
// update prev | ||
this.xPrev = xHat; | ||
this.xPrev = xHat; | ||
this.dxPrev = dxHat; | ||
@@ -65,0 +65,0 @@ this.tPrev = t; |
@@ -5,11 +5,11 @@ // Ref: https://jaantollander.com/post/noise-filtering-using-one-euro-filter/#mjx-eqn%3A1 | ||
const r = 2 * Math.PI * cutoff * te; | ||
return r / (r+1); | ||
} | ||
return r / (r + 1); | ||
}; | ||
const exponentialSmoothing = (a, x, xPrev) => { | ||
return a * x + (1 - a) * xPrev; | ||
} | ||
}; | ||
class OneEuroFilter { | ||
constructor({minCutOff, beta}) { | ||
constructor({ minCutOff, beta }) { | ||
this.minCutOff = minCutOff; | ||
@@ -38,3 +38,3 @@ this.beta = beta; | ||
const {xPrev, tPrev, dxPrev} = this; | ||
const { xPrev, tPrev, dxPrev } = this; | ||
@@ -62,3 +62,3 @@ //console.log("filter", x, xPrev, x.map((xx, i) => x[i] - xPrev[i])); | ||
// update prev | ||
this.xPrev = xHat; | ||
this.xPrev = xHat; | ||
this.dxPrev = dxHat; | ||
@@ -65,0 +65,0 @@ this.tPrev = t; |
{ | ||
"name": "@webarkit/jsartoolkit-nft", | ||
"version": "1.4.1", | ||
"version": "1.5.0", | ||
"main": "dist/ARToolkitNFT.js", | ||
@@ -39,5 +39,5 @@ "types": "types/src/index.d.ts", | ||
"devDependencies": { | ||
"@babel/core": "^7.21.3", | ||
"@babel/plugin-transform-runtime": "^7.21.0", | ||
"@babel/preset-env": "^7.20.2", | ||
"@babel/core": "^7.21.4", | ||
"@babel/plugin-transform-runtime": "^7.21.4", | ||
"@babel/preset-env": "^7.21.4", | ||
"babel-loader": "^9.1.2", | ||
@@ -52,4 +52,4 @@ "karma": "^6.4.1", | ||
"typedoc": "^0.23.28", | ||
"typescript": "^5.0.2", | ||
"webpack": "^5.76.3", | ||
"typescript": "^5.0.3", | ||
"webpack": "^5.77.0", | ||
"webpack-cli": "^5.0.1" | ||
@@ -56,0 +56,0 @@ }, |
@@ -0,1 +1,36 @@ | ||
/* | ||
* AbstractARControllerNFT.ts | ||
* JSARToolKitNFT | ||
* | ||
* This file is part of JSARToolKitNFT - WebARKit. | ||
* | ||
* JSARToolKitNFT is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* JSARToolKitNFT is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with JSARToolKitNFT. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
* As a special exception, the copyright holders of this library give you | ||
* permission to link this library with independent modules to produce an | ||
* executable, regardless of the license terms of these independent modules, and to | ||
* copy and distribute the resulting executable under terms of your choice, | ||
* provided that you also meet, for each linked independent module, the terms and | ||
* conditions of the license of that module. An independent module is a module | ||
* which is neither derived from nor based on this library. If you modify this | ||
* library, you may extend this exception to your version of the library, but you | ||
* are not obligated to do so. If you do not wish to do so, delete this exception | ||
* statement from your version. | ||
* | ||
* Copyright 2020 WebARKit. | ||
* | ||
* Author(s): Walter Perdan @kalwalt https://github.com/kalwalt | ||
* | ||
*/ | ||
import { IImageObj } from "./CommonInterfaces"; | ||
@@ -2,0 +37,0 @@ export abstract class AbstractARControllerNFT { |
@@ -0,1 +1,37 @@ | ||
/* | ||
* CommonInterfaces.ts | ||
* JSARToolKitNFT | ||
* | ||
* This file is part of JSARToolKitNFT - WebARKit. | ||
* | ||
* JSARToolKitNFT is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* JSARToolKitNFT is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with JSARToolKitNFT. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
* As a special exception, the copyright holders of this library give you | ||
* permission to link this library with independent modules to produce an | ||
* executable, regardless of the license terms of these independent modules, and to | ||
* copy and distribute the resulting executable under terms of your choice, | ||
* provided that you also meet, for each linked independent module, the terms and | ||
* conditions of the license of that module. An independent module is a module | ||
* which is neither derived from nor based on this library. If you modify this | ||
* library, you may extend this exception to your version of the library, but you | ||
* are not obligated to do so. If you do not wish to do so, delete this exception | ||
* statement from your version. | ||
* | ||
* Copyright 2020 WebARKit. | ||
* | ||
* Author(s): Walter Perdan @kalwalt https://github.com/kalwalt | ||
* | ||
*/ | ||
export interface IImageObj extends HTMLCanvasElement { | ||
@@ -2,0 +38,0 @@ videoWidth: number; |
@@ -0,44 +1,72 @@ | ||
/* | ||
* IARToolkitNFT.ts | ||
* JSARToolKitNFT | ||
* | ||
* This file is part of JSARToolKitNFT - WebARKit. | ||
* | ||
* JSARToolKitNFT is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* JSARToolKitNFT is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with JSARToolKitNFT. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
* As a special exception, the copyright holders of this library give you | ||
* permission to link this library with independent modules to produce an | ||
* executable, regardless of the license terms of these independent modules, and to | ||
* copy and distribute the resulting executable under terms of your choice, | ||
* provided that you also meet, for each linked independent module, the terms and | ||
* conditions of the license of that module. An independent module is a module | ||
* which is neither derived from nor based on this library. If you modify this | ||
* library, you may extend this exception to your version of the library, but you | ||
* are not obligated to do so. If you do not wish to do so, delete this exception | ||
* statement from your version. | ||
* | ||
* Copyright 2020 WebARKit. | ||
* | ||
* Author(s): Walter Perdan @kalwalt https://github.com/kalwalt | ||
* | ||
*/ | ||
import { INFTMarkerInfo } from "./CommonInterfaces"; | ||
export interface IARToolkitNFT { | ||
getCameraLens: (cameraId: number) => any; | ||
passVideoData: ( | ||
id: number, | ||
videoFrame: Uint8ClampedArray, | ||
videoLuma: Uint8Array | ||
) => void; | ||
setup: { | ||
(width: number, height: number, cameraId: number): number; | ||
}; | ||
setupAR2: { | ||
(id: number): void; | ||
}; | ||
setDebugMode: (id: number, mode: boolean) => number; | ||
getDebugMode: (id: number) => boolean; | ||
getProcessingImage: (id: number) => number; | ||
setLogLevel: (mode: boolean) => number; | ||
getLogLevel: () => number; | ||
getCameraLens(): any; | ||
passVideoData(videoFrame: Uint8ClampedArray, videoLuma: Uint8Array): void; | ||
setup(width: number, height: number, cameraId: number): number; | ||
setupAR2(): void; | ||
setDebugMode(mode: boolean): number; | ||
getDebugMode(): boolean; | ||
getProcessingImage(): number; | ||
setLogLevel(mode: boolean): number; | ||
getLogLevel(): number; | ||
NFTMarkerInfo: INFTMarkerInfo; | ||
loadCamera: (cameraParam: string) => Promise<number>; | ||
setProjectionNearPlane: { | ||
(id: number, value: number): void; | ||
}; | ||
getProjectionNearPlane: (id: number) => number; | ||
setProjectionFarPlane: (id: number, value: number) => void; | ||
getProjectionFarPlane: (id: number) => number; | ||
setThresholdMode: (id: number, mode: number) => number; | ||
getThresholdMode: (id: number) => number; | ||
setThreshold: (id: number, threshold: number) => number; | ||
getThreshold: (id: number) => number; | ||
addNFTMarkers: ( | ||
arId: number, | ||
loadCamera(cameraParam: string): Promise<number>; | ||
setProjectionNearPlane(value: number): void; | ||
getProjectionNearPlane(): number; | ||
setProjectionFarPlane(value: number): void; | ||
getProjectionFarPlane(): number; | ||
setThresholdMode(mode: number): number; | ||
getThresholdMode(): number; | ||
setThreshold(threshold: number): number; | ||
getThreshold(): number; | ||
addNFTMarkers( | ||
urls: Array<string>, | ||
callback: (ids: number[]) => void, | ||
onError2: (errorNumber: number) => void | ||
) => Array<number>; | ||
detectMarker: (id: number) => number; | ||
detectNFTMarker: (arId: number) => void; | ||
getNFTMarker: (id: number, markerIndex: number) => INFTMarkerInfo; | ||
getNFTData: (id: number, index: number) => object; | ||
setImageProcMode: (id: number, mode: number) => number; | ||
getImageProcMode: (id: number) => number; | ||
): Array<number>; | ||
detectMarker(): number; | ||
detectNFTMarker(): number; | ||
getNFTMarker(markerIndex: number): INFTMarkerInfo; | ||
getNFTData(index: number): object; | ||
setImageProcMode(mode: number): number; | ||
getImageProcMode(): number; | ||
FS: any; | ||
StringList: any; | ||
nftMarkers: any; | ||
} |
/* | ||
* ARControllerNFT.ts | ||
* ARControllerNFT_simd.ts | ||
* JSARToolKitNFT | ||
@@ -36,3 +36,2 @@ * | ||
*/ | ||
import ARToolkitNFT from "./ARToolkitNFT_simd"; | ||
import { | ||
@@ -44,5 +43,6 @@ INFTMarkerInfo, | ||
import { IARToolkitNFT } from "./abstractions/IARToolkitNFT"; | ||
import { ARToolkitNFT } from "./ARToolkitNFT_simd"; | ||
import { AbstractARControllerNFT } from "./abstractions/AbstractARControllerNFT"; | ||
export default class ARControllerNFT implements AbstractARControllerNFT { | ||
export class ARControllerNFT implements AbstractARControllerNFT { | ||
// private declarations | ||
@@ -54,8 +54,14 @@ private id: number; | ||
private cameraId: number; | ||
private cameraLoaded: boolean; | ||
private artoolkitNFT: IARToolkitNFT; | ||
private FS: any; | ||
private StringList: any; | ||
private listeners: object; | ||
private nftMarkers: INFTMarker[]; | ||
private transform_mat: Float64Array; | ||
private transformGL_RH: Float64Array; | ||
private camera_mat: Float64Array; | ||
private videoWidth: number; | ||
@@ -68,3 +74,3 @@ private videoHeight: number; | ||
private grayscaleSource: Uint8Array; | ||
private camera_mat: Float64Array; | ||
private nftMarkerFound: boolean; // = false | ||
@@ -83,3 +89,3 @@ private nftMarkerFoundTime: number; | ||
* transformGL_RH, videoWidth, videoHeight, videoSize, | ||
* framesize, videoLuma, camera_mat. | ||
* videoLuma, framesize, camera_mat. | ||
*/ | ||
@@ -93,3 +99,3 @@ constructor(); | ||
* transformGL_RH, videoWidth, videoHeight, videoSize, | ||
* framesize, videoLuma, camera_mat. | ||
* videoLuma, framesize, camera_mat. | ||
* @param {number} width | ||
@@ -105,3 +111,3 @@ * @param {number} height | ||
* transformGL_RH, videoWidth, videoHeight, videoSize, | ||
* framesize, videoLuma, camera_mat. | ||
* framesize, camera_mat. | ||
* @param {number} width | ||
@@ -123,3 +129,2 @@ * @param {number} height | ||
this.cameraId = -1; | ||
this.cameraLoaded = false; | ||
@@ -352,6 +357,6 @@ // toolkit instance | ||
* with the given tracked id. | ||
* @return {void} | ||
* @return {number} | ||
*/ | ||
detectNFTMarker(): void { | ||
this.artoolkitNFT.detectNFTMarker(this.id); | ||
detectNFTMarker(): number { | ||
return this.artoolkitNFT.detectNFTMarker(); | ||
} | ||
@@ -404,3 +409,3 @@ | ||
if (this._copyImageToHeap(image)) { | ||
return this.artoolkitNFT.detectMarker(this.id); | ||
return this.artoolkitNFT.detectMarker(); | ||
} | ||
@@ -420,3 +425,3 @@ return -99; | ||
getNFTMarker(markerIndex: number): INFTMarkerInfo { | ||
return this.artoolkitNFT.getNFTMarker(this.id, markerIndex); | ||
return this.artoolkitNFT.getNFTMarker(markerIndex); | ||
} | ||
@@ -430,4 +435,4 @@ | ||
*/ | ||
getNFTData(id: number, index: number) { | ||
return this.artoolkitNFT.getNFTData(id, index); | ||
getNFTData(index: number) { | ||
return this.artoolkitNFT.getNFTData(index); | ||
} | ||
@@ -619,3 +624,3 @@ | ||
setDebugMode(mode: boolean): number { | ||
return this.artoolkitNFT.setDebugMode(this.id, mode); | ||
return this.artoolkitNFT.setDebugMode(mode); | ||
} | ||
@@ -629,3 +634,3 @@ | ||
getDebugMode(): boolean { | ||
return this.artoolkitNFT.getDebugMode(this.id); | ||
return this.artoolkitNFT.getDebugMode(); | ||
} | ||
@@ -638,3 +643,3 @@ | ||
getProcessingImage(): number { | ||
return this.artoolkitNFT.getProcessingImage(this.id); | ||
return this.artoolkitNFT.getProcessingImage(); | ||
} | ||
@@ -664,3 +669,3 @@ | ||
setProjectionNearPlane(value: number): void { | ||
return this.artoolkitNFT.setProjectionNearPlane(this.id, value); | ||
return this.artoolkitNFT.setProjectionNearPlane(value); | ||
} | ||
@@ -673,3 +678,3 @@ | ||
getProjectionNearPlane(): number { | ||
return this.artoolkitNFT.getProjectionNearPlane(this.id); | ||
return this.artoolkitNFT.getProjectionNearPlane(); | ||
} | ||
@@ -683,3 +688,3 @@ | ||
setProjectionFarPlane(value: number): void { | ||
return this.artoolkitNFT.setProjectionFarPlane(this.id, value); | ||
return this.artoolkitNFT.setProjectionFarPlane(value); | ||
} | ||
@@ -692,3 +697,3 @@ | ||
getProjectionFarPlane(): number { | ||
return this.artoolkitNFT.getProjectionFarPlane(this.id); | ||
return this.artoolkitNFT.getProjectionFarPlane(); | ||
} | ||
@@ -706,3 +711,3 @@ | ||
setThresholdMode(mode: number): number { | ||
return this.artoolkitNFT.setThresholdMode(this.id, mode); | ||
return this.artoolkitNFT.setThresholdMode(mode); | ||
} | ||
@@ -716,3 +721,3 @@ | ||
getThresholdMode(): number { | ||
return this.artoolkitNFT.getThresholdMode(this.id); | ||
return this.artoolkitNFT.getThresholdMode(); | ||
} | ||
@@ -740,3 +745,3 @@ | ||
setThreshold(threshold: number): number { | ||
return this.artoolkitNFT.setThreshold(this.id, threshold); | ||
return this.artoolkitNFT.setThreshold(threshold); | ||
} | ||
@@ -756,3 +761,3 @@ | ||
getThreshold(): number { | ||
return this.artoolkitNFT.getThreshold(this.id); | ||
return this.artoolkitNFT.getThreshold(); | ||
} | ||
@@ -770,7 +775,6 @@ | ||
let nft = await this.artoolkitNFT.addNFTMarkers( | ||
this.id, | ||
[urlOrData], | ||
(ids: any) => { | ||
(ids: number[]) => { | ||
this.nftMarkerCount += ids.length; | ||
onSuccess(ids); | ||
onSuccess(ids[0]); | ||
}, | ||
@@ -792,3 +796,2 @@ onError | ||
let nft = await this.artoolkitNFT.addNFTMarkers( | ||
this.id, | ||
urlOrData, | ||
@@ -824,3 +827,3 @@ (ids: number[]) => { | ||
setImageProcMode(mode: number): number { | ||
return this.artoolkitNFT.setImageProcMode(this.id, mode); | ||
return this.artoolkitNFT.setImageProcMode(mode); | ||
} | ||
@@ -834,3 +837,3 @@ | ||
getImageProcMode(): number { | ||
return this.artoolkitNFT.getImageProcMode(this.id); | ||
return this.artoolkitNFT.getImageProcMode(); | ||
} | ||
@@ -867,6 +870,10 @@ | ||
this.artoolkitNFT = await new ARToolkitNFT().init(); | ||
this.FS = this.artoolkitNFT.FS; | ||
this.StringList = this.artoolkitNFT.StringList; | ||
console.log("[ARControllerNFT]", "ARToolkitNFT initialized"); | ||
// load the camera | ||
this.cameraId = await this.artoolkitNFT.loadCamera(this._cameraParam); | ||
this.cameraId = await this.artoolkitNFT.loadCamera(this.cameraParam); | ||
console.log( | ||
@@ -879,3 +886,3 @@ "[ARControllerNFT]", | ||
// setup | ||
this.id = this.artoolkitNFT.setup(this._width, this._height, this.cameraId); | ||
this.id = this.artoolkitNFT.setup(this.width, this.height, this.cameraId); | ||
console.log("[ARControllerNFT]", "Got ID from setup", this.id); | ||
@@ -889,3 +896,3 @@ | ||
this.camera_mat = this.artoolkitNFT.getCameraLens(this.id); | ||
this.camera_mat = this.artoolkitNFT.getCameraLens(); | ||
@@ -910,3 +917,3 @@ this.setProjectionNearPlane(0.1); | ||
private _initNFT() { | ||
this.artoolkitNFT.setupAR2(this.id); | ||
this.artoolkitNFT.setupAR2(); | ||
} | ||
@@ -957,3 +964,3 @@ | ||
if (this.videoLuma) { | ||
this.artoolkitNFT.passVideoData(this.id, data, this.videoLuma); | ||
this.artoolkitNFT.passVideoData(data, this.videoLuma); | ||
return true; | ||
@@ -960,0 +967,0 @@ } |
@@ -36,3 +36,2 @@ /* | ||
*/ | ||
import ARToolkitNFT from "./ARToolkitNFT"; | ||
import { | ||
@@ -44,5 +43,6 @@ INFTMarkerInfo, | ||
import { IARToolkitNFT } from "./abstractions/IARToolkitNFT"; | ||
import { ARToolkitNFT } from "./ARToolkitNFT"; | ||
import { AbstractARControllerNFT } from "./abstractions/AbstractARControllerNFT"; | ||
export default class ARControllerNFT implements AbstractARControllerNFT { | ||
export class ARControllerNFT implements AbstractARControllerNFT { | ||
// private declarations | ||
@@ -54,8 +54,14 @@ private id: number; | ||
private cameraId: number; | ||
private cameraLoaded: boolean; | ||
private artoolkitNFT: IARToolkitNFT; | ||
private FS: any; | ||
private StringList: any; | ||
private listeners: object; | ||
private nftMarkers: INFTMarker[]; | ||
private transform_mat: Float64Array; | ||
private transformGL_RH: Float64Array; | ||
private camera_mat: Float64Array; | ||
private videoWidth: number; | ||
@@ -68,3 +74,3 @@ private videoHeight: number; | ||
private grayscaleSource: Uint8Array; | ||
private camera_mat: Float64Array; | ||
private nftMarkerFound: boolean; // = false | ||
@@ -120,3 +126,2 @@ private nftMarkerFoundTime: number; | ||
this.cameraId = -1; | ||
this.cameraLoaded = false; | ||
@@ -349,6 +354,6 @@ // toolkit instance | ||
* with the given tracked id. | ||
* @return {void} | ||
* @return {number} | ||
*/ | ||
detectNFTMarker(): void { | ||
this.artoolkitNFT.detectNFTMarker(this.id); | ||
detectNFTMarker(): number { | ||
return this.artoolkitNFT.detectNFTMarker(); | ||
} | ||
@@ -401,3 +406,3 @@ | ||
if (this._copyImageToHeap(image)) { | ||
return this.artoolkitNFT.detectMarker(this.id); | ||
return this.artoolkitNFT.detectMarker(); | ||
} | ||
@@ -417,3 +422,3 @@ return -99; | ||
getNFTMarker(markerIndex: number): INFTMarkerInfo { | ||
return this.artoolkitNFT.getNFTMarker(this.id, markerIndex); | ||
return this.artoolkitNFT.getNFTMarker(markerIndex); | ||
} | ||
@@ -427,4 +432,4 @@ | ||
*/ | ||
getNFTData(id: number, index: number) { | ||
return this.artoolkitNFT.getNFTData(id, index); | ||
getNFTData(index: number) { | ||
return this.artoolkitNFT.getNFTData(index); | ||
} | ||
@@ -616,3 +621,3 @@ | ||
setDebugMode(mode: boolean): number { | ||
return this.artoolkitNFT.setDebugMode(this.id, mode); | ||
return this.artoolkitNFT.setDebugMode(mode); | ||
} | ||
@@ -626,3 +631,3 @@ | ||
getDebugMode(): boolean { | ||
return this.artoolkitNFT.getDebugMode(this.id); | ||
return this.artoolkitNFT.getDebugMode(); | ||
} | ||
@@ -635,3 +640,3 @@ | ||
getProcessingImage(): number { | ||
return this.artoolkitNFT.getProcessingImage(this.id); | ||
return this.artoolkitNFT.getProcessingImage(); | ||
} | ||
@@ -661,3 +666,3 @@ | ||
setProjectionNearPlane(value: number): void { | ||
return this.artoolkitNFT.setProjectionNearPlane(this.id, value); | ||
return this.artoolkitNFT.setProjectionNearPlane(value); | ||
} | ||
@@ -670,3 +675,3 @@ | ||
getProjectionNearPlane(): number { | ||
return this.artoolkitNFT.getProjectionNearPlane(this.id); | ||
return this.artoolkitNFT.getProjectionNearPlane(); | ||
} | ||
@@ -680,3 +685,3 @@ | ||
setProjectionFarPlane(value: number): void { | ||
return this.artoolkitNFT.setProjectionFarPlane(this.id, value); | ||
return this.artoolkitNFT.setProjectionFarPlane(value); | ||
} | ||
@@ -689,3 +694,3 @@ | ||
getProjectionFarPlane(): number { | ||
return this.artoolkitNFT.getProjectionFarPlane(this.id); | ||
return this.artoolkitNFT.getProjectionFarPlane(); | ||
} | ||
@@ -703,3 +708,3 @@ | ||
setThresholdMode(mode: number): number { | ||
return this.artoolkitNFT.setThresholdMode(this.id, mode); | ||
return this.artoolkitNFT.setThresholdMode(mode); | ||
} | ||
@@ -713,3 +718,3 @@ | ||
getThresholdMode(): number { | ||
return this.artoolkitNFT.getThresholdMode(this.id); | ||
return this.artoolkitNFT.getThresholdMode(); | ||
} | ||
@@ -737,3 +742,3 @@ | ||
setThreshold(threshold: number): number { | ||
return this.artoolkitNFT.setThreshold(this.id, threshold); | ||
return this.artoolkitNFT.setThreshold(threshold); | ||
} | ||
@@ -753,3 +758,3 @@ | ||
getThreshold(): number { | ||
return this.artoolkitNFT.getThreshold(this.id); | ||
return this.artoolkitNFT.getThreshold(); | ||
} | ||
@@ -767,7 +772,6 @@ | ||
let nft = await this.artoolkitNFT.addNFTMarkers( | ||
this.id, | ||
[urlOrData], | ||
(ids: any) => { | ||
(ids: number[]) => { | ||
this.nftMarkerCount += ids.length; | ||
onSuccess(ids); | ||
onSuccess(ids[0]); | ||
}, | ||
@@ -789,5 +793,4 @@ onError | ||
let nft = await this.artoolkitNFT.addNFTMarkers( | ||
this.id, | ||
urlOrData, | ||
(ids) => { | ||
(ids: number[]) => { | ||
this.nftMarkerCount += ids.length; | ||
@@ -821,3 +824,3 @@ onSuccess(ids); | ||
setImageProcMode(mode: number): number { | ||
return this.artoolkitNFT.setImageProcMode(this.id, mode); | ||
return this.artoolkitNFT.setImageProcMode(mode); | ||
} | ||
@@ -831,3 +834,3 @@ | ||
getImageProcMode(): number { | ||
return this.artoolkitNFT.getImageProcMode(this.id); | ||
return this.artoolkitNFT.getImageProcMode(); | ||
} | ||
@@ -864,2 +867,6 @@ | ||
this.artoolkitNFT = await new ARToolkitNFT().init(); | ||
this.FS = this.artoolkitNFT.FS; | ||
this.StringList = this.artoolkitNFT.StringList; | ||
console.log("[ARControllerNFT]", "ARToolkitNFT initialized"); | ||
@@ -885,3 +892,3 @@ | ||
this.camera_mat = this.artoolkitNFT.getCameraLens(this.id); | ||
this.camera_mat = this.artoolkitNFT.getCameraLens(); | ||
@@ -906,3 +913,3 @@ this.setProjectionNearPlane(0.1); | ||
private _initNFT() { | ||
this.artoolkitNFT.setupAR2(this.id); | ||
this.artoolkitNFT.setupAR2(); | ||
} | ||
@@ -953,3 +960,3 @@ | ||
if (this.videoLuma) { | ||
this.artoolkitNFT.passVideoData(this.id, data, this.videoLuma); | ||
this.artoolkitNFT.passVideoData(data, this.videoLuma); | ||
return true; | ||
@@ -956,0 +963,0 @@ } |
/* | ||
* ARToolkitNFT.ts | ||
* ARToolkitNFT_simd.ts | ||
* JSARToolKitNFT | ||
@@ -36,3 +36,3 @@ * | ||
*/ | ||
import artoolkitNFT from "../build/artoolkitNFT_ES6_wasm.simd"; | ||
import { initARToolkitNFT } from "./factoryFunctions/initARToolkitNFT_simd"; | ||
import { IARToolkitNFT } from "./abstractions/IARToolkitNFT"; | ||
@@ -47,3 +47,6 @@ import { INFTMarkerInfo } from "./abstractions/CommonInterfaces"; | ||
export default class ARToolkitNFT implements IARToolkitNFT { | ||
export class ARToolkitNFT implements IARToolkitNFT { | ||
/** | ||
* static properties | ||
*/ | ||
static get UNKNOWN_MARKER() { | ||
@@ -56,2 +59,45 @@ return UNKNOWN_MARKER; | ||
/* errors */ | ||
static ERROR_MARKER_INDEX_OUT_OF_BOUNDS: number; | ||
/* arDebug */ | ||
static AR_DEBUG_DISABLE: number; | ||
static AR_DEBUG_ENABLE: number; | ||
static AR_DEFAULT_DEBUG_MODE: number; | ||
/* for arlabelingThresh */ | ||
static AR_DEFAULT_LABELING_THRESH: number; | ||
/* for arImageProcMode */ | ||
static AR_IMAGE_PROC_FRAME_IMAGE: number; | ||
static AR_IMAGE_PROC_FIELD_IMAGE: number; | ||
static AR_DEFAULT_IMAGE_PROC_MODE: number; | ||
/* for arGetTransMat */ | ||
static AR_MAX_LOOP_COUNT: number; | ||
static AR_LOOP_BREAK_THRESH: number; | ||
/* Enums */ | ||
static AR_LOG_LEVEL_DEBUG: number; | ||
static AR_LOG_LEVEL_INFO: number; | ||
static AR_LOG_LEVEL_WARN: number; | ||
static AR_LOG_LEVEL_ERROR: number; | ||
static AR_LOG_LEVEL_REL_INFO: number; | ||
static AR_LABELING_THRESH_MODE_MANUAL: number; | ||
static AR_LABELING_THRESH_MODE_AUTO_MEDIAN: number; | ||
static AR_LABELING_THRESH_MODE_AUTO_OTSU: number; | ||
static AR_LABELING_THRESH_MODE_AUTO_ADAPTIVE: number; | ||
static AR_MARKER_INFO_CUTOFF_PHASE_NONE: number; | ||
static AR_MARKER_INFO_CUTOFF_PHASE_PATTERN_EXTRACTION: number; | ||
static AR_MARKER_INFO_CUTOFF_PHASE_MATCH_GENERIC: number; | ||
static AR_MARKER_INFO_CUTOFF_PHASE_MATCH_CONTRAST: number; | ||
static AR_MARKER_INFO_CUTOFF_PHASE_MATCH_BARCODE_NOT_FOUND: number; | ||
static AR_MARKER_INFO_CUTOFF_PHASE_MATCH_BARCODE_EDC_FAIL: number; | ||
static AR_MARKER_INFO_CUTOFF_PHASE_MATCH_CONFIDENCE: number; | ||
static AR_MARKER_INFO_CUTOFF_PHASE_POSE_ERROR: number; | ||
static AR_MARKER_INFO_CUTOFF_PHASE_POSE_ERROR_MULTI: number; | ||
static AR_MARKER_INFO_CUTOFF_PHASE_HEURISTIC_TROUBLESOME_MATRIX_CODES: number; | ||
private instance: any; | ||
@@ -61,14 +107,3 @@ private markerNFTCount: number; | ||
private version: string; | ||
public setup: (width: number, height: number, cameraId: number) => number; | ||
public teardown: () => void; | ||
public setupAR2: (id: number) => void; | ||
public setDebugMode: (id: number, mode: boolean) => number; | ||
public getDebugMode: (id: number) => boolean; | ||
public getProcessingImage: (id: number) => number; | ||
public detectMarker: (id: number) => number; | ||
public detectNFTMarker: (id: number) => number; | ||
public getNFTMarker: (id: number, markerIndex: number) => INFTMarkerInfo; | ||
public getNFTData: (id: number, index: number) => object; | ||
public setLogLevel: (mode: boolean) => number; | ||
public getLogLevel: () => number; | ||
public NFTMarkerInfo: { | ||
@@ -80,19 +115,7 @@ error: number; | ||
}; | ||
public setProjectionNearPlane: (id: number, value: number) => void; | ||
public getProjectionNearPlane: (id: number) => number; | ||
public setProjectionFarPlane: (id: number, value: number) => void; | ||
public getProjectionFarPlane: (id: number) => number; | ||
public setThresholdMode: (id: number, mode: number) => number; | ||
public getThresholdMode: (id: number) => number; | ||
public setThreshold: (id: number, threshold: number) => number; | ||
public getThreshold: (id: number) => number; | ||
public setImageProcMode: (id: number, mode: number) => number; | ||
public getImageProcMode: (id: number) => number; | ||
public getCameraLens: (cameraId: number) => any; | ||
public passVideoData: ( | ||
id: number, | ||
videoFrame: Uint8ClampedArray, | ||
videoLuma: Uint8Array | ||
) => void; | ||
public FS: any; | ||
public StringList: any; | ||
public nftMarkers: any; | ||
// construction | ||
@@ -107,3 +130,3 @@ /** | ||
* A message is displayed in the browser console during the intitialization, for example: | ||
* "ARToolkitNFT 1.3.0" | ||
* "ARToolkitNFT 1.5.0" | ||
*/ | ||
@@ -128,80 +151,167 @@ constructor() { | ||
public async init() { | ||
this.instance = await artoolkitNFT(); | ||
const instance = await initARToolkitNFT(); | ||
this.instance = new instance.ARToolKitNFT(); | ||
this._decorate(); | ||
this.FS = instance.FS; | ||
this.StringList = instance.StringList; | ||
this.nftMarkers = instance.nftMarkers; | ||
//let scope = typeof window !== "undefined" ? window : global; | ||
//scope.artoolkitNFT = this; | ||
ARToolkitNFT.ERROR_MARKER_INDEX_OUT_OF_BOUNDS = | ||
instance.ERROR_MARKER_INDEX_OUT_OF_BOUNDS; | ||
ARToolkitNFT.AR_DEBUG_DISABLE = instance.AR_DEBUG_DISABLE; | ||
ARToolkitNFT.AR_DEBUG_ENABLE = instance.AR_DEBUG_ENABLE; | ||
ARToolkitNFT.AR_DEFAULT_DEBUG_MODE = instance.AR_DEFAULT_DEBUG_MODE; | ||
/* for arlabelingThresh */ | ||
ARToolkitNFT.AR_DEFAULT_LABELING_THRESH = | ||
instance.AR_DEFAULT_LABELING_THRESH; | ||
/* for arImageProcMode */ | ||
ARToolkitNFT.AR_IMAGE_PROC_FRAME_IMAGE = instance.AR_IMAGE_PROC_FRAME_IMAGE; | ||
ARToolkitNFT.AR_IMAGE_PROC_FIELD_IMAGE = instance.AR_IMAGE_PROC_FIELD_IMAGE; | ||
ARToolkitNFT.AR_DEFAULT_IMAGE_PROC_MODE = | ||
instance.AR_DEFAULT_IMAGE_PROC_MODE; | ||
/* for arGetTransMat */ | ||
ARToolkitNFT.AR_MAX_LOOP_COUNT = instance.AR_MAX_LOOP_COUNT; | ||
ARToolkitNFT.AR_LOOP_BREAK_THRESH = instance.AR_LOOP_BREAK_THRESH; | ||
/* Enums */ | ||
ARToolkitNFT.AR_LOG_LEVEL_DEBUG = instance.AR_LOG_LEVEL_DEBUG; | ||
ARToolkitNFT.AR_LOG_LEVEL_INFO = instance.AR_LOG_LEVEL_INFO; | ||
ARToolkitNFT.AR_LOG_LEVEL_WARN = instance.AR_LOG_LEVEL_WARN; | ||
ARToolkitNFT.AR_LOG_LEVEL_ERROR = instance.AR_LOG_LEVEL_ERROR; | ||
ARToolkitNFT.AR_LOG_LEVEL_REL_INFO = instance.AR_LOG_LEVEL_REL_INFO; | ||
ARToolkitNFT.AR_LABELING_THRESH_MODE_MANUAL = | ||
instance.AR_LABELING_THRESH_MODE_MANUAL; | ||
ARToolkitNFT.AR_LABELING_THRESH_MODE_AUTO_MEDIAN = | ||
instance.AR_LABELING_THRESH_MODE_AUTO_MEDIAN; | ||
ARToolkitNFT.AR_LABELING_THRESH_MODE_AUTO_OTSU = | ||
instance.AR_LABELING_THRESH_MODE_AUTO_OTSU; | ||
ARToolkitNFT.AR_LABELING_THRESH_MODE_AUTO_ADAPTIVE = | ||
instance.AR_LABELING_THRESH_MODE_AUTO_ADAPTIVE; | ||
ARToolkitNFT.AR_MARKER_INFO_CUTOFF_PHASE_NONE = | ||
instance.AR_MARKER_INFO_CUTOFF_PHASE_NONE; | ||
ARToolkitNFT.AR_MARKER_INFO_CUTOFF_PHASE_PATTERN_EXTRACTION = | ||
instance.AR_MARKER_INFO_CUTOFF_PHASE_PATTERN_EXTRACTION; | ||
ARToolkitNFT.AR_MARKER_INFO_CUTOFF_PHASE_MATCH_GENERIC = | ||
instance.AR_MARKER_INFO_CUTOFF_PHASE_MATCH_GENERIC; | ||
ARToolkitNFT.AR_MARKER_INFO_CUTOFF_PHASE_MATCH_CONTRAST = | ||
instance.AR_MARKER_INFO_CUTOFF_PHASE_MATCH_CONTRAST; | ||
ARToolkitNFT.AR_MARKER_INFO_CUTOFF_PHASE_MATCH_BARCODE_NOT_FOUND = | ||
instance.AR_MARKER_INFO_CUTOFF_PHASE_MATCH_BARCODE_NOT_FOUND; | ||
ARToolkitNFT.AR_MARKER_INFO_CUTOFF_PHASE_MATCH_BARCODE_EDC_FAIL = | ||
instance.AR_MARKER_INFO_CUTOFF_PHASE_MATCH_BARCODE_EDC_FAIL; | ||
ARToolkitNFT.AR_MARKER_INFO_CUTOFF_PHASE_MATCH_CONFIDENCE = | ||
instance.AR_MARKER_INFO_CUTOFF_PHASE_MATCH_CONFIDENCE; | ||
ARToolkitNFT.AR_MARKER_INFO_CUTOFF_PHASE_POSE_ERROR = | ||
instance.AR_MARKER_INFO_CUTOFF_PHASE_POSE_ERROR; | ||
ARToolkitNFT.AR_MARKER_INFO_CUTOFF_PHASE_POSE_ERROR_MULTI = | ||
instance.AR_MARKER_INFO_CUTOFF_PHASE_POSE_ERROR_MULTI; | ||
ARToolkitNFT.AR_MARKER_INFO_CUTOFF_PHASE_HEURISTIC_TROUBLESOME_MATRIX_CODES = | ||
instance.AR_MARKER_INFO_CUTOFF_PHASE_HEURISTIC_TROUBLESOME_MATRIX_CODES; | ||
return this; | ||
} | ||
// private methods | ||
/** | ||
* Used internally to link the instance in the ModuleLoader to the | ||
* ARToolkitNFT internal methods. | ||
* @return {void} | ||
*/ | ||
private _decorate(): void { | ||
// add delegate methods | ||
[ | ||
"setup", | ||
"teardown", | ||
public setup(width: number, height: number, cameraId: number): number { | ||
return this.instance.setup(width, height, cameraId); | ||
} | ||
"setupAR2", | ||
public teardown(): void { | ||
this.instance.teardown(); | ||
} | ||
"setLogLevel", | ||
"getLogLevel", | ||
public setupAR2(): void { | ||
this.instance.setupAR2(); | ||
} | ||
"setDebugMode", | ||
"getDebugMode", | ||
public setDebugMode(mode: boolean): number { | ||
return this.instance.setDebugMode(mode); | ||
} | ||
"getProcessingImage", | ||
public getDebugMode(): boolean { | ||
return this.instance.getDebugMode(); | ||
} | ||
"detectMarker", | ||
"detectNFTMarker", | ||
"getNFTMarker", | ||
"getNFTData", | ||
public getProcessingImage(): number { | ||
return this.instance.getProcessingImage(); | ||
} | ||
"NFTMarkerInfo", | ||
public detectMarker(): number { | ||
return this.instance.detectMarker(); | ||
} | ||
"setProjectionNearPlane", | ||
"getProjectionNearPlane", | ||
public detectNFTMarker(): number { | ||
return this.instance.detectNFTMarker(); | ||
} | ||
"setProjectionFarPlane", | ||
"getProjectionFarPlane", | ||
public getNFTMarker(markerIndex: number): INFTMarkerInfo { | ||
return this.instance.getNFTMarker(markerIndex); | ||
} | ||
"setThresholdMode", | ||
"getThresholdMode", | ||
public getNFTData(index: number): object { | ||
return this.instance.getNFTData(index); | ||
} | ||
"setThreshold", | ||
"getThreshold", | ||
public setLogLevel(mode: boolean): number { | ||
return this.instance.setLogLevel(mode); | ||
} | ||
public getLogLevel(): number { | ||
return this.instance.getLogLevel(); | ||
} | ||
"setImageProcMode", | ||
"getImageProcMode", | ||
public setProjectionNearPlane(value: number): void { | ||
this.instance.setProjectionNearPlane(value); | ||
} | ||
"getCameraLens", | ||
"passVideoData", | ||
public getProjectionNearPlane(): number { | ||
return this.instance.getProjectionNearPlane(); | ||
} | ||
"StringList", | ||
].forEach((method: string) => { | ||
this.converter()[method] = this.instance[method]; | ||
}); | ||
public setProjectionFarPlane(value: number): void { | ||
this.instance.setProjectionFarPlane(value); | ||
} | ||
// expose constants | ||
for (const co in this.instance) { | ||
if (co.match(/^AR/)) { | ||
this.converter()[co] = this.instance[co]; | ||
} | ||
} | ||
public getProjectionFarPlane(): number { | ||
return this.instance.getProjectionFarPlane(); | ||
} | ||
/** | ||
* Used internally to convert and inject code. | ||
* @return {this} the this object | ||
*/ | ||
private converter(): any { | ||
return this; | ||
public setThresholdMode(mode: number): number { | ||
return this.instance.setThresholdMode(mode); | ||
} | ||
public getThresholdMode(): number { | ||
return this.instance.getThresholdMode(); | ||
} | ||
public setThreshold(threshold: number): number { | ||
return this.instance.setThreshold(threshold); | ||
} | ||
public getThreshold(): number { | ||
return this.instance.getThreshold(); | ||
} | ||
public setImageProcMode(mode: number): number { | ||
return this.instance.setImageProcMode(mode); | ||
} | ||
public getImageProcMode(): number { | ||
return this.instance.getImageProcMode(); | ||
} | ||
public getCameraLens(): any { | ||
return this.instance.getCameraLens(); | ||
} | ||
public passVideoData( | ||
videoFrame: Uint8ClampedArray, | ||
videoLuma: Uint8Array | ||
): void { | ||
this.instance.passVideoData(videoFrame, videoLuma); | ||
} | ||
// --------------------------------------------------------------------------- | ||
@@ -248,3 +358,2 @@ // public accessors | ||
public addNFTMarkers( | ||
arId: number, | ||
urls: Array<string | Array<string>>, | ||
@@ -259,3 +368,3 @@ callback: (filename: number[]) => void, | ||
if (pending === 0) { | ||
const vec = new this.instance.StringList(); | ||
const vec = new this.StringList(); | ||
const markerIds = []; | ||
@@ -265,3 +374,3 @@ for (let i = 0; i < prefixes.length; i++) { | ||
} | ||
var ret = this.instance._addNFTMarkers(arId, vec); | ||
var ret = this.instance._addNFTMarkers(vec); | ||
for (let i = 0; i < ret.size(); i++) { | ||
@@ -342,3 +451,3 @@ markerIds.push(ret.get(i)); | ||
// Note: valid data must be in binary format encoded as Uint8Array | ||
this.instance.FS.writeFile(target, data, { | ||
this.FS.writeFile(target, data, { | ||
encoding: "binary", | ||
@@ -369,3 +478,3 @@ }); | ||
) => { | ||
this.instance.FS.writeFile(target, byteArray, { encoding: "binary" }); | ||
this.FS.writeFile(target, byteArray, { encoding: "binary" }); | ||
callback(byteArray); | ||
@@ -372,0 +481,0 @@ }; |
@@ -36,3 +36,3 @@ /* | ||
*/ | ||
import artoolkitNFT from "../build/artoolkitNFT_ES6_wasm"; | ||
import { initARToolkitNFT } from "./factoryFunctions/initARToolkitNFT"; | ||
import { IARToolkitNFT } from "./abstractions/IARToolkitNFT"; | ||
@@ -47,3 +47,6 @@ import { INFTMarkerInfo } from "./abstractions/CommonInterfaces"; | ||
export default class ARToolkitNFT implements IARToolkitNFT { | ||
export class ARToolkitNFT implements IARToolkitNFT { | ||
/** | ||
* static properties | ||
*/ | ||
static get UNKNOWN_MARKER() { | ||
@@ -56,2 +59,45 @@ return UNKNOWN_MARKER; | ||
/* errors */ | ||
static ERROR_MARKER_INDEX_OUT_OF_BOUNDS: number; | ||
/* arDebug */ | ||
static AR_DEBUG_DISABLE: number; | ||
static AR_DEBUG_ENABLE: number; | ||
static AR_DEFAULT_DEBUG_MODE: number; | ||
/* for arlabelingThresh */ | ||
static AR_DEFAULT_LABELING_THRESH: number; | ||
/* for arImageProcMode */ | ||
static AR_IMAGE_PROC_FRAME_IMAGE: number; | ||
static AR_IMAGE_PROC_FIELD_IMAGE: number; | ||
static AR_DEFAULT_IMAGE_PROC_MODE: number; | ||
/* for arGetTransMat */ | ||
static AR_MAX_LOOP_COUNT: number; | ||
static AR_LOOP_BREAK_THRESH: number; | ||
/* Enums */ | ||
static AR_LOG_LEVEL_DEBUG: number; | ||
static AR_LOG_LEVEL_INFO: number; | ||
static AR_LOG_LEVEL_WARN: number; | ||
static AR_LOG_LEVEL_ERROR: number; | ||
static AR_LOG_LEVEL_REL_INFO: number; | ||
static AR_LABELING_THRESH_MODE_MANUAL: number; | ||
static AR_LABELING_THRESH_MODE_AUTO_MEDIAN: number; | ||
static AR_LABELING_THRESH_MODE_AUTO_OTSU: number; | ||
static AR_LABELING_THRESH_MODE_AUTO_ADAPTIVE: number; | ||
static AR_MARKER_INFO_CUTOFF_PHASE_NONE: number; | ||
static AR_MARKER_INFO_CUTOFF_PHASE_PATTERN_EXTRACTION: number; | ||
static AR_MARKER_INFO_CUTOFF_PHASE_MATCH_GENERIC: number; | ||
static AR_MARKER_INFO_CUTOFF_PHASE_MATCH_CONTRAST: number; | ||
static AR_MARKER_INFO_CUTOFF_PHASE_MATCH_BARCODE_NOT_FOUND: number; | ||
static AR_MARKER_INFO_CUTOFF_PHASE_MATCH_BARCODE_EDC_FAIL: number; | ||
static AR_MARKER_INFO_CUTOFF_PHASE_MATCH_CONFIDENCE: number; | ||
static AR_MARKER_INFO_CUTOFF_PHASE_POSE_ERROR: number; | ||
static AR_MARKER_INFO_CUTOFF_PHASE_POSE_ERROR_MULTI: number; | ||
static AR_MARKER_INFO_CUTOFF_PHASE_HEURISTIC_TROUBLESOME_MATRIX_CODES: number; | ||
private instance: any; | ||
@@ -61,14 +107,3 @@ private markerNFTCount: number; | ||
private version: string; | ||
public setup: (width: number, height: number, cameraId: number) => number; | ||
public teardown: () => void; | ||
public setupAR2: (id: number) => void; | ||
public setDebugMode: (id: number, mode: boolean) => number; | ||
public getDebugMode: (id: number) => boolean; | ||
public getProcessingImage: (id: number) => number; | ||
public detectMarker: (id: number) => number; | ||
public detectNFTMarker: (id: number) => number; | ||
public getNFTMarker: (id: number, markerIndex: number) => INFTMarkerInfo; | ||
public getNFTData: (id: number, index: number) => object; | ||
public setLogLevel: (mode: boolean) => number; | ||
public getLogLevel: () => number; | ||
public NFTMarkerInfo: { | ||
@@ -80,19 +115,7 @@ error: number; | ||
}; | ||
public setProjectionNearPlane: (id: number, value: number) => void; | ||
public getProjectionNearPlane: (id: number) => number; | ||
public setProjectionFarPlane: (id: number, value: number) => void; | ||
public getProjectionFarPlane: (id: number) => number; | ||
public setThresholdMode: (id: number, mode: number) => number; | ||
public getThresholdMode: (id: number) => number; | ||
public setThreshold: (id: number, threshold: number) => number; | ||
public getThreshold: (id: number) => number; | ||
public setImageProcMode: (id: number, mode: number) => number; | ||
public getImageProcMode: (id: number) => number; | ||
public getCameraLens: (cameraId: number) => any; | ||
public passVideoData: ( | ||
id: number, | ||
videoFrame: Uint8ClampedArray, | ||
videoLuma: Uint8Array | ||
) => void; | ||
public FS: any; | ||
public StringList: any; | ||
public nftMarkers: any | ||
// construction | ||
@@ -107,3 +130,3 @@ /** | ||
* A message is displayed in the browser console during the intitialization, for example: | ||
* "ARToolkitNFT 1.3.0" | ||
* "ARToolkitNFT 1.5.0" | ||
*/ | ||
@@ -128,80 +151,167 @@ constructor() { | ||
public async init() { | ||
this.instance = await artoolkitNFT(); | ||
const instance = await initARToolkitNFT(); | ||
this.instance = new instance.ARToolKitNFT(); | ||
this._decorate(); | ||
this.FS = instance.FS; | ||
this.StringList = instance.StringList; | ||
this.nftMarkers = instance.nftMarkers; | ||
//let scope = typeof window !== "undefined" ? window : global; | ||
//scope.artoolkitNFT = this; | ||
ARToolkitNFT.ERROR_MARKER_INDEX_OUT_OF_BOUNDS = | ||
instance.ERROR_MARKER_INDEX_OUT_OF_BOUNDS; | ||
ARToolkitNFT.AR_DEBUG_DISABLE = instance.AR_DEBUG_DISABLE; | ||
ARToolkitNFT.AR_DEBUG_ENABLE = instance.AR_DEBUG_ENABLE; | ||
ARToolkitNFT.AR_DEFAULT_DEBUG_MODE = instance.AR_DEFAULT_DEBUG_MODE; | ||
/* for arlabelingThresh */ | ||
ARToolkitNFT.AR_DEFAULT_LABELING_THRESH = | ||
instance.AR_DEFAULT_LABELING_THRESH; | ||
/* for arImageProcMode */ | ||
ARToolkitNFT.AR_IMAGE_PROC_FRAME_IMAGE = instance.AR_IMAGE_PROC_FRAME_IMAGE; | ||
ARToolkitNFT.AR_IMAGE_PROC_FIELD_IMAGE = instance.AR_IMAGE_PROC_FIELD_IMAGE; | ||
ARToolkitNFT.AR_DEFAULT_IMAGE_PROC_MODE = | ||
instance.AR_DEFAULT_IMAGE_PROC_MODE; | ||
/* for arGetTransMat */ | ||
ARToolkitNFT.AR_MAX_LOOP_COUNT = instance.AR_MAX_LOOP_COUNT; | ||
ARToolkitNFT.AR_LOOP_BREAK_THRESH = instance.AR_LOOP_BREAK_THRESH; | ||
/* Enums */ | ||
ARToolkitNFT.AR_LOG_LEVEL_DEBUG = instance.AR_LOG_LEVEL_DEBUG; | ||
ARToolkitNFT.AR_LOG_LEVEL_INFO = instance.AR_LOG_LEVEL_INFO; | ||
ARToolkitNFT.AR_LOG_LEVEL_WARN = instance.AR_LOG_LEVEL_WARN; | ||
ARToolkitNFT.AR_LOG_LEVEL_ERROR = instance.AR_LOG_LEVEL_ERROR; | ||
ARToolkitNFT.AR_LOG_LEVEL_REL_INFO = instance.AR_LOG_LEVEL_REL_INFO; | ||
ARToolkitNFT.AR_LABELING_THRESH_MODE_MANUAL = | ||
instance.AR_LABELING_THRESH_MODE_MANUAL; | ||
ARToolkitNFT.AR_LABELING_THRESH_MODE_AUTO_MEDIAN = | ||
instance.AR_LABELING_THRESH_MODE_AUTO_MEDIAN; | ||
ARToolkitNFT.AR_LABELING_THRESH_MODE_AUTO_OTSU = | ||
instance.AR_LABELING_THRESH_MODE_AUTO_OTSU; | ||
ARToolkitNFT.AR_LABELING_THRESH_MODE_AUTO_ADAPTIVE = | ||
instance.AR_LABELING_THRESH_MODE_AUTO_ADAPTIVE; | ||
ARToolkitNFT.AR_MARKER_INFO_CUTOFF_PHASE_NONE = | ||
instance.AR_MARKER_INFO_CUTOFF_PHASE_NONE; | ||
ARToolkitNFT.AR_MARKER_INFO_CUTOFF_PHASE_PATTERN_EXTRACTION = | ||
instance.AR_MARKER_INFO_CUTOFF_PHASE_PATTERN_EXTRACTION; | ||
ARToolkitNFT.AR_MARKER_INFO_CUTOFF_PHASE_MATCH_GENERIC = | ||
instance.AR_MARKER_INFO_CUTOFF_PHASE_MATCH_GENERIC; | ||
ARToolkitNFT.AR_MARKER_INFO_CUTOFF_PHASE_MATCH_CONTRAST = | ||
instance.AR_MARKER_INFO_CUTOFF_PHASE_MATCH_CONTRAST; | ||
ARToolkitNFT.AR_MARKER_INFO_CUTOFF_PHASE_MATCH_BARCODE_NOT_FOUND = | ||
instance.AR_MARKER_INFO_CUTOFF_PHASE_MATCH_BARCODE_NOT_FOUND; | ||
ARToolkitNFT.AR_MARKER_INFO_CUTOFF_PHASE_MATCH_BARCODE_EDC_FAIL = | ||
instance.AR_MARKER_INFO_CUTOFF_PHASE_MATCH_BARCODE_EDC_FAIL; | ||
ARToolkitNFT.AR_MARKER_INFO_CUTOFF_PHASE_MATCH_CONFIDENCE = | ||
instance.AR_MARKER_INFO_CUTOFF_PHASE_MATCH_CONFIDENCE; | ||
ARToolkitNFT.AR_MARKER_INFO_CUTOFF_PHASE_POSE_ERROR = | ||
instance.AR_MARKER_INFO_CUTOFF_PHASE_POSE_ERROR; | ||
ARToolkitNFT.AR_MARKER_INFO_CUTOFF_PHASE_POSE_ERROR_MULTI = | ||
instance.AR_MARKER_INFO_CUTOFF_PHASE_POSE_ERROR_MULTI; | ||
ARToolkitNFT.AR_MARKER_INFO_CUTOFF_PHASE_HEURISTIC_TROUBLESOME_MATRIX_CODES = | ||
instance.AR_MARKER_INFO_CUTOFF_PHASE_HEURISTIC_TROUBLESOME_MATRIX_CODES; | ||
return this; | ||
} | ||
// private methods | ||
/** | ||
* Used internally to link the instance in the ModuleLoader to the | ||
* ARToolkitNFT internal methods. | ||
* @return {void} | ||
*/ | ||
private _decorate(): void { | ||
// add delegate methods | ||
[ | ||
"setup", | ||
"teardown", | ||
public setup(width: number, height: number, cameraId: number): number { | ||
return this.instance.setup(width, height, cameraId); | ||
} | ||
"setupAR2", | ||
public teardown(): void { | ||
this.instance.teardown(); | ||
} | ||
"setLogLevel", | ||
"getLogLevel", | ||
public setupAR2(): void { | ||
this.instance.setupAR2(); | ||
} | ||
"setDebugMode", | ||
"getDebugMode", | ||
public setDebugMode(mode: boolean): number { | ||
return this.instance.setDebugMode(mode); | ||
} | ||
"getProcessingImage", | ||
public getDebugMode(): boolean { | ||
return this.instance.getDebugMode(); | ||
} | ||
"detectMarker", | ||
"detectNFTMarker", | ||
"getNFTMarker", | ||
"getNFTData", | ||
public getProcessingImage(): number { | ||
return this.instance.getProcessingImage(); | ||
} | ||
"NFTMarkerInfo", | ||
public detectMarker(): number { | ||
return this.instance.detectMarker(); | ||
} | ||
"setProjectionNearPlane", | ||
"getProjectionNearPlane", | ||
public detectNFTMarker(): number { | ||
return this.instance.detectNFTMarker(); | ||
} | ||
"setProjectionFarPlane", | ||
"getProjectionFarPlane", | ||
public getNFTMarker(markerIndex: number): INFTMarkerInfo { | ||
return this.instance.getNFTMarker(markerIndex); | ||
} | ||
"setThresholdMode", | ||
"getThresholdMode", | ||
public getNFTData(index: number): object { | ||
return this.instance.getNFTData(index); | ||
} | ||
"setThreshold", | ||
"getThreshold", | ||
public setLogLevel(mode: boolean): number { | ||
return this.instance.setLogLevel(mode); | ||
} | ||
public getLogLevel(): number { | ||
return this.instance.getLogLevel(); | ||
} | ||
"setImageProcMode", | ||
"getImageProcMode", | ||
public setProjectionNearPlane(value: number): void { | ||
this.instance.setProjectionNearPlane(value); | ||
} | ||
"getCameraLens", | ||
"passVideoData", | ||
public getProjectionNearPlane(): number { | ||
return this.instance.getProjectionNearPlane(); | ||
} | ||
"StringList", | ||
].forEach((method: string) => { | ||
this.converter()[method] = this.instance[method]; | ||
}); | ||
public setProjectionFarPlane(value: number): void { | ||
this.instance.setProjectionFarPlane(value); | ||
} | ||
// expose constants | ||
for (const co in this.instance) { | ||
if (co.match(/^AR/)) { | ||
this.converter()[co] = this.instance[co]; | ||
} | ||
} | ||
public getProjectionFarPlane(): number { | ||
return this.instance.getProjectionFarPlane(); | ||
} | ||
/** | ||
* Used internally to convert and inject code. | ||
* @return {this} the this object | ||
*/ | ||
private converter(): any { | ||
return this; | ||
public setThresholdMode(mode: number): number { | ||
return this.instance.setThresholdMode(mode); | ||
} | ||
public getThresholdMode(): number { | ||
return this.instance.getThresholdMode(); | ||
} | ||
public setThreshold(threshold: number): number { | ||
return this.instance.setThreshold(threshold); | ||
} | ||
public getThreshold(): number { | ||
return this.instance.getThreshold(); | ||
} | ||
public setImageProcMode(mode: number): number { | ||
return this.instance.setImageProcMode(mode); | ||
} | ||
public getImageProcMode(): number { | ||
return this.instance.getImageProcMode(); | ||
} | ||
public getCameraLens(): any { | ||
return this.instance.getCameraLens(); | ||
} | ||
public passVideoData( | ||
videoFrame: Uint8ClampedArray, | ||
videoLuma: Uint8Array | ||
): void { | ||
this.instance.passVideoData(videoFrame, videoLuma); | ||
} | ||
// --------------------------------------------------------------------------- | ||
@@ -248,3 +358,2 @@ // public accessors | ||
public addNFTMarkers( | ||
arId: number, | ||
urls: Array<string | Array<string>>, | ||
@@ -259,3 +368,3 @@ callback: (filename: number[]) => void, | ||
if (pending === 0) { | ||
const vec = new this.instance.StringList(); | ||
const vec = new this.StringList(); | ||
const markerIds = []; | ||
@@ -265,3 +374,3 @@ for (let i = 0; i < prefixes.length; i++) { | ||
} | ||
var ret = this.instance._addNFTMarkers(arId, vec); | ||
var ret = this.instance._addNFTMarkers(vec); | ||
for (let i = 0; i < ret.size(); i++) { | ||
@@ -342,3 +451,3 @@ markerIds.push(ret.get(i)); | ||
// Note: valid data must be in binary format encoded as Uint8Array | ||
this.instance.FS.writeFile(target, data, { | ||
this.FS.writeFile(target, data, { | ||
encoding: "binary", | ||
@@ -369,3 +478,3 @@ }); | ||
) => { | ||
this.instance.FS.writeFile(target, byteArray, { encoding: "binary" }); | ||
this.FS.writeFile(target, byteArray, { encoding: "binary" }); | ||
callback(byteArray); | ||
@@ -372,0 +481,0 @@ }; |
/* | ||
* index.ts | ||
* index_simd.ts | ||
* JSARToolKitNFT | ||
@@ -36,8 +36,5 @@ * | ||
*/ | ||
import ARToolkitNFT from "./ARToolkitNFT_simd"; | ||
import ARControllerNFT from "./ARControllerNFT_simd"; | ||
import { ARToolkitNFT } from "./ARToolkitNFT_simd"; | ||
import { ARControllerNFT } from "./ARControllerNFT_simd"; | ||
export default { | ||
ARToolkitNFT, | ||
ARControllerNFT, | ||
}; | ||
export { ARToolkitNFT, ARControllerNFT }; |
@@ -36,8 +36,5 @@ /* | ||
*/ | ||
import ARToolkitNFT from "./ARToolkitNFT"; | ||
import ARControllerNFT from "./ARControllerNFT"; | ||
import { ARToolkitNFT } from "./ARToolkitNFT"; | ||
import { ARControllerNFT } from "./ARControllerNFT"; | ||
export default { | ||
ARToolkitNFT, | ||
ARControllerNFT, | ||
}; | ||
export { ARToolkitNFT, ARControllerNFT }; |
import { INFTMarkerInfo } from "./CommonInterfaces"; | ||
export interface IARToolkitNFT { | ||
getCameraLens: (cameraId: number) => any; | ||
passVideoData: (id: number, videoFrame: Uint8ClampedArray, videoLuma: Uint8Array) => void; | ||
setup: { | ||
(width: number, height: number, cameraId: number): number; | ||
}; | ||
setupAR2: { | ||
(id: number): void; | ||
}; | ||
setDebugMode: (id: number, mode: boolean) => number; | ||
getDebugMode: (id: number) => boolean; | ||
getProcessingImage: (id: number) => number; | ||
setLogLevel: (mode: boolean) => number; | ||
getLogLevel: () => number; | ||
getCameraLens(): any; | ||
passVideoData(videoFrame: Uint8ClampedArray, videoLuma: Uint8Array): void; | ||
setup(width: number, height: number, cameraId: number): number; | ||
setupAR2(): void; | ||
setDebugMode(mode: boolean): number; | ||
getDebugMode(): boolean; | ||
getProcessingImage(): number; | ||
setLogLevel(mode: boolean): number; | ||
getLogLevel(): number; | ||
NFTMarkerInfo: INFTMarkerInfo; | ||
loadCamera: (cameraParam: string) => Promise<number>; | ||
setProjectionNearPlane: { | ||
(id: number, value: number): void; | ||
}; | ||
getProjectionNearPlane: (id: number) => number; | ||
setProjectionFarPlane: (id: number, value: number) => void; | ||
getProjectionFarPlane: (id: number) => number; | ||
setThresholdMode: (id: number, mode: number) => number; | ||
getThresholdMode: (id: number) => number; | ||
setThreshold: (id: number, threshold: number) => number; | ||
getThreshold: (id: number) => number; | ||
addNFTMarkers: (arId: number, urls: Array<string>, callback: (ids: number[]) => void, onError2: (errorNumber: number) => void) => Array<number>; | ||
detectMarker: (id: number) => number; | ||
detectNFTMarker: (arId: number) => void; | ||
getNFTMarker: (id: number, markerIndex: number) => INFTMarkerInfo; | ||
getNFTData: (id: number, index: number) => object; | ||
setImageProcMode: (id: number, mode: number) => number; | ||
getImageProcMode: (id: number) => number; | ||
loadCamera(cameraParam: string): Promise<number>; | ||
setProjectionNearPlane(value: number): void; | ||
getProjectionNearPlane(): number; | ||
setProjectionFarPlane(value: number): void; | ||
getProjectionFarPlane(): number; | ||
setThresholdMode(mode: number): number; | ||
getThresholdMode(): number; | ||
setThreshold(threshold: number): number; | ||
getThreshold(): number; | ||
addNFTMarkers(urls: Array<string>, callback: (ids: number[]) => void, onError2: (errorNumber: number) => void): Array<number>; | ||
detectMarker(): number; | ||
detectNFTMarker(): number; | ||
getNFTMarker(markerIndex: number): INFTMarkerInfo; | ||
getNFTData(index: number): object; | ||
setImageProcMode(mode: number): number; | ||
getImageProcMode(): number; | ||
FS: any; | ||
StringList: any; | ||
nftMarkers: any; | ||
} |
import { INFTMarkerInfo, IImageObj, INFTMarker } from "./abstractions/CommonInterfaces"; | ||
import { AbstractARControllerNFT } from "./abstractions/AbstractARControllerNFT"; | ||
export default class ARControllerNFT implements AbstractARControllerNFT { | ||
export declare class ARControllerNFT implements AbstractARControllerNFT { | ||
private id; | ||
@@ -9,4 +9,5 @@ private _width; | ||
private cameraId; | ||
private cameraLoaded; | ||
private artoolkitNFT; | ||
private FS; | ||
private StringList; | ||
private listeners; | ||
@@ -16,2 +17,3 @@ private nftMarkers; | ||
private transformGL_RH; | ||
private camera_mat; | ||
private videoWidth; | ||
@@ -24,3 +26,2 @@ private videoHeight; | ||
private grayscaleSource; | ||
private camera_mat; | ||
private nftMarkerFound; | ||
@@ -44,7 +45,7 @@ private nftMarkerFoundTime; | ||
process(image: IImageObj): void; | ||
detectNFTMarker(): void; | ||
detectNFTMarker(): number; | ||
trackNFTMarkerId(id: number, markerWidth?: number): INFTMarker; | ||
detectMarker(image: IImageObj): number; | ||
getNFTMarker(markerIndex: number): INFTMarkerInfo; | ||
getNFTData(id: number, index: number): object; | ||
getNFTData(index: number): object; | ||
addEventListener(name: string, callback: object): void; | ||
@@ -51,0 +52,0 @@ removeEventListener(name: string, callback: object): void; |
import { INFTMarkerInfo, IImageObj, INFTMarker } from "./abstractions/CommonInterfaces"; | ||
import { AbstractARControllerNFT } from "./abstractions/AbstractARControllerNFT"; | ||
export default class ARControllerNFT implements AbstractARControllerNFT { | ||
export declare class ARControllerNFT implements AbstractARControllerNFT { | ||
private id; | ||
@@ -9,4 +9,5 @@ private _width; | ||
private cameraId; | ||
private cameraLoaded; | ||
private artoolkitNFT; | ||
private FS; | ||
private StringList; | ||
private listeners; | ||
@@ -16,2 +17,3 @@ private nftMarkers; | ||
private transformGL_RH; | ||
private camera_mat; | ||
private videoWidth; | ||
@@ -24,3 +26,2 @@ private videoHeight; | ||
private grayscaleSource; | ||
private camera_mat; | ||
private nftMarkerFound; | ||
@@ -44,7 +45,7 @@ private nftMarkerFoundTime; | ||
process(image: IImageObj): void; | ||
detectNFTMarker(): void; | ||
detectNFTMarker(): number; | ||
trackNFTMarkerId(id: number, markerWidth?: number): INFTMarker; | ||
detectMarker(image: IImageObj): number; | ||
getNFTMarker(markerIndex: number): INFTMarkerInfo; | ||
getNFTData(id: number, index: number): object; | ||
getNFTData(index: number): object; | ||
addEventListener(name: string, callback: object): void; | ||
@@ -51,0 +52,0 @@ removeEventListener(name: string, callback: object): void; |
import { IARToolkitNFT } from "./abstractions/IARToolkitNFT"; | ||
import { INFTMarkerInfo } from "./abstractions/CommonInterfaces"; | ||
export default class ARToolkitNFT implements IARToolkitNFT { | ||
export declare class ARToolkitNFT implements IARToolkitNFT { | ||
static get UNKNOWN_MARKER(): number; | ||
static get NFT_MARKER(): number; | ||
static ERROR_MARKER_INDEX_OUT_OF_BOUNDS: number; | ||
static AR_DEBUG_DISABLE: number; | ||
static AR_DEBUG_ENABLE: number; | ||
static AR_DEFAULT_DEBUG_MODE: number; | ||
static AR_DEFAULT_LABELING_THRESH: number; | ||
static AR_IMAGE_PROC_FRAME_IMAGE: number; | ||
static AR_IMAGE_PROC_FIELD_IMAGE: number; | ||
static AR_DEFAULT_IMAGE_PROC_MODE: number; | ||
static AR_MAX_LOOP_COUNT: number; | ||
static AR_LOOP_BREAK_THRESH: number; | ||
static AR_LOG_LEVEL_DEBUG: number; | ||
static AR_LOG_LEVEL_INFO: number; | ||
static AR_LOG_LEVEL_WARN: number; | ||
static AR_LOG_LEVEL_ERROR: number; | ||
static AR_LOG_LEVEL_REL_INFO: number; | ||
static AR_LABELING_THRESH_MODE_MANUAL: number; | ||
static AR_LABELING_THRESH_MODE_AUTO_MEDIAN: number; | ||
static AR_LABELING_THRESH_MODE_AUTO_OTSU: number; | ||
static AR_LABELING_THRESH_MODE_AUTO_ADAPTIVE: number; | ||
static AR_MARKER_INFO_CUTOFF_PHASE_NONE: number; | ||
static AR_MARKER_INFO_CUTOFF_PHASE_PATTERN_EXTRACTION: number; | ||
static AR_MARKER_INFO_CUTOFF_PHASE_MATCH_GENERIC: number; | ||
static AR_MARKER_INFO_CUTOFF_PHASE_MATCH_CONTRAST: number; | ||
static AR_MARKER_INFO_CUTOFF_PHASE_MATCH_BARCODE_NOT_FOUND: number; | ||
static AR_MARKER_INFO_CUTOFF_PHASE_MATCH_BARCODE_EDC_FAIL: number; | ||
static AR_MARKER_INFO_CUTOFF_PHASE_MATCH_CONFIDENCE: number; | ||
static AR_MARKER_INFO_CUTOFF_PHASE_POSE_ERROR: number; | ||
static AR_MARKER_INFO_CUTOFF_PHASE_POSE_ERROR_MULTI: number; | ||
static AR_MARKER_INFO_CUTOFF_PHASE_HEURISTIC_TROUBLESOME_MATRIX_CODES: number; | ||
private instance; | ||
@@ -10,14 +39,2 @@ private markerNFTCount; | ||
private version; | ||
setup: (width: number, height: number, cameraId: number) => number; | ||
teardown: () => void; | ||
setupAR2: (id: number) => void; | ||
setDebugMode: (id: number, mode: boolean) => number; | ||
getDebugMode: (id: number) => boolean; | ||
getProcessingImage: (id: number) => number; | ||
detectMarker: (id: number) => number; | ||
detectNFTMarker: (id: number) => number; | ||
getNFTMarker: (id: number, markerIndex: number) => INFTMarkerInfo; | ||
getNFTData: (id: number, index: number) => object; | ||
setLogLevel: (mode: boolean) => number; | ||
getLogLevel: () => number; | ||
NFTMarkerInfo: { | ||
@@ -29,22 +46,35 @@ error: number; | ||
}; | ||
setProjectionNearPlane: (id: number, value: number) => void; | ||
getProjectionNearPlane: (id: number) => number; | ||
setProjectionFarPlane: (id: number, value: number) => void; | ||
getProjectionFarPlane: (id: number) => number; | ||
setThresholdMode: (id: number, mode: number) => number; | ||
getThresholdMode: (id: number) => number; | ||
setThreshold: (id: number, threshold: number) => number; | ||
getThreshold: (id: number) => number; | ||
setImageProcMode: (id: number, mode: number) => number; | ||
getImageProcMode: (id: number) => number; | ||
getCameraLens: (cameraId: number) => any; | ||
passVideoData: (id: number, videoFrame: Uint8ClampedArray, videoLuma: Uint8Array) => void; | ||
FS: any; | ||
StringList: any; | ||
nftMarkers: any; | ||
constructor(); | ||
init(): Promise<this>; | ||
private _decorate; | ||
private converter; | ||
setup(width: number, height: number, cameraId: number): number; | ||
teardown(): void; | ||
setupAR2(): void; | ||
setDebugMode(mode: boolean): number; | ||
getDebugMode(): boolean; | ||
getProcessingImage(): number; | ||
detectMarker(): number; | ||
detectNFTMarker(): number; | ||
getNFTMarker(markerIndex: number): INFTMarkerInfo; | ||
getNFTData(index: number): object; | ||
setLogLevel(mode: boolean): number; | ||
getLogLevel(): number; | ||
setProjectionNearPlane(value: number): void; | ||
getProjectionNearPlane(): number; | ||
setProjectionFarPlane(value: number): void; | ||
getProjectionFarPlane(): number; | ||
setThresholdMode(mode: number): number; | ||
getThresholdMode(): number; | ||
setThreshold(threshold: number): number; | ||
getThreshold(): number; | ||
setImageProcMode(mode: number): number; | ||
getImageProcMode(): number; | ||
getCameraLens(): any; | ||
passVideoData(videoFrame: Uint8ClampedArray, videoLuma: Uint8Array): void; | ||
loadCamera(urlOrData: Uint8Array | string): Promise<number>; | ||
addNFTMarkers(arId: number, urls: Array<string | Array<string>>, callback: (filename: number[]) => void, onError2: (errorNumber: number) => void): Array<number>; | ||
addNFTMarkers(urls: Array<string | Array<string>>, callback: (filename: number[]) => void, onError2: (errorNumber: number) => void): Array<number>; | ||
private _storeDataFile; | ||
private ajax; | ||
} |
import { IARToolkitNFT } from "./abstractions/IARToolkitNFT"; | ||
import { INFTMarkerInfo } from "./abstractions/CommonInterfaces"; | ||
export default class ARToolkitNFT implements IARToolkitNFT { | ||
export declare class ARToolkitNFT implements IARToolkitNFT { | ||
static get UNKNOWN_MARKER(): number; | ||
static get NFT_MARKER(): number; | ||
static ERROR_MARKER_INDEX_OUT_OF_BOUNDS: number; | ||
static AR_DEBUG_DISABLE: number; | ||
static AR_DEBUG_ENABLE: number; | ||
static AR_DEFAULT_DEBUG_MODE: number; | ||
static AR_DEFAULT_LABELING_THRESH: number; | ||
static AR_IMAGE_PROC_FRAME_IMAGE: number; | ||
static AR_IMAGE_PROC_FIELD_IMAGE: number; | ||
static AR_DEFAULT_IMAGE_PROC_MODE: number; | ||
static AR_MAX_LOOP_COUNT: number; | ||
static AR_LOOP_BREAK_THRESH: number; | ||
static AR_LOG_LEVEL_DEBUG: number; | ||
static AR_LOG_LEVEL_INFO: number; | ||
static AR_LOG_LEVEL_WARN: number; | ||
static AR_LOG_LEVEL_ERROR: number; | ||
static AR_LOG_LEVEL_REL_INFO: number; | ||
static AR_LABELING_THRESH_MODE_MANUAL: number; | ||
static AR_LABELING_THRESH_MODE_AUTO_MEDIAN: number; | ||
static AR_LABELING_THRESH_MODE_AUTO_OTSU: number; | ||
static AR_LABELING_THRESH_MODE_AUTO_ADAPTIVE: number; | ||
static AR_MARKER_INFO_CUTOFF_PHASE_NONE: number; | ||
static AR_MARKER_INFO_CUTOFF_PHASE_PATTERN_EXTRACTION: number; | ||
static AR_MARKER_INFO_CUTOFF_PHASE_MATCH_GENERIC: number; | ||
static AR_MARKER_INFO_CUTOFF_PHASE_MATCH_CONTRAST: number; | ||
static AR_MARKER_INFO_CUTOFF_PHASE_MATCH_BARCODE_NOT_FOUND: number; | ||
static AR_MARKER_INFO_CUTOFF_PHASE_MATCH_BARCODE_EDC_FAIL: number; | ||
static AR_MARKER_INFO_CUTOFF_PHASE_MATCH_CONFIDENCE: number; | ||
static AR_MARKER_INFO_CUTOFF_PHASE_POSE_ERROR: number; | ||
static AR_MARKER_INFO_CUTOFF_PHASE_POSE_ERROR_MULTI: number; | ||
static AR_MARKER_INFO_CUTOFF_PHASE_HEURISTIC_TROUBLESOME_MATRIX_CODES: number; | ||
private instance; | ||
@@ -10,14 +39,2 @@ private markerNFTCount; | ||
private version; | ||
setup: (width: number, height: number, cameraId: number) => number; | ||
teardown: () => void; | ||
setupAR2: (id: number) => void; | ||
setDebugMode: (id: number, mode: boolean) => number; | ||
getDebugMode: (id: number) => boolean; | ||
getProcessingImage: (id: number) => number; | ||
detectMarker: (id: number) => number; | ||
detectNFTMarker: (id: number) => number; | ||
getNFTMarker: (id: number, markerIndex: number) => INFTMarkerInfo; | ||
getNFTData: (id: number, index: number) => object; | ||
setLogLevel: (mode: boolean) => number; | ||
getLogLevel: () => number; | ||
NFTMarkerInfo: { | ||
@@ -29,22 +46,35 @@ error: number; | ||
}; | ||
setProjectionNearPlane: (id: number, value: number) => void; | ||
getProjectionNearPlane: (id: number) => number; | ||
setProjectionFarPlane: (id: number, value: number) => void; | ||
getProjectionFarPlane: (id: number) => number; | ||
setThresholdMode: (id: number, mode: number) => number; | ||
getThresholdMode: (id: number) => number; | ||
setThreshold: (id: number, threshold: number) => number; | ||
getThreshold: (id: number) => number; | ||
setImageProcMode: (id: number, mode: number) => number; | ||
getImageProcMode: (id: number) => number; | ||
getCameraLens: (cameraId: number) => any; | ||
passVideoData: (id: number, videoFrame: Uint8ClampedArray, videoLuma: Uint8Array) => void; | ||
FS: any; | ||
StringList: any; | ||
nftMarkers: any; | ||
constructor(); | ||
init(): Promise<this>; | ||
private _decorate; | ||
private converter; | ||
setup(width: number, height: number, cameraId: number): number; | ||
teardown(): void; | ||
setupAR2(): void; | ||
setDebugMode(mode: boolean): number; | ||
getDebugMode(): boolean; | ||
getProcessingImage(): number; | ||
detectMarker(): number; | ||
detectNFTMarker(): number; | ||
getNFTMarker(markerIndex: number): INFTMarkerInfo; | ||
getNFTData(index: number): object; | ||
setLogLevel(mode: boolean): number; | ||
getLogLevel(): number; | ||
setProjectionNearPlane(value: number): void; | ||
getProjectionNearPlane(): number; | ||
setProjectionFarPlane(value: number): void; | ||
getProjectionFarPlane(): number; | ||
setThresholdMode(mode: number): number; | ||
getThresholdMode(): number; | ||
setThreshold(threshold: number): number; | ||
getThreshold(): number; | ||
setImageProcMode(mode: number): number; | ||
getImageProcMode(): number; | ||
getCameraLens(): any; | ||
passVideoData(videoFrame: Uint8ClampedArray, videoLuma: Uint8Array): void; | ||
loadCamera(urlOrData: Uint8Array | string): Promise<number>; | ||
addNFTMarkers(arId: number, urls: Array<string | Array<string>>, callback: (filename: number[]) => void, onError2: (errorNumber: number) => void): Array<number>; | ||
addNFTMarkers(urls: Array<string | Array<string>>, callback: (filename: number[]) => void, onError2: (errorNumber: number) => void): Array<number>; | ||
private _storeDataFile; | ||
private ajax; | ||
} |
@@ -1,7 +0,3 @@ | ||
import ARToolkitNFT from "./ARToolkitNFT_simd"; | ||
import ARControllerNFT from "./ARControllerNFT_simd"; | ||
declare const _default: { | ||
ARToolkitNFT: typeof ARToolkitNFT; | ||
ARControllerNFT: typeof ARControllerNFT; | ||
}; | ||
export default _default; | ||
import { ARToolkitNFT } from "./ARToolkitNFT_simd"; | ||
import { ARControllerNFT } from "./ARControllerNFT_simd"; | ||
export { ARToolkitNFT, ARControllerNFT }; |
@@ -1,7 +0,3 @@ | ||
import ARToolkitNFT from "./ARToolkitNFT"; | ||
import ARControllerNFT from "./ARControllerNFT"; | ||
declare const _default: { | ||
ARToolkitNFT: typeof ARToolkitNFT; | ||
ARControllerNFT: typeof ARControllerNFT; | ||
}; | ||
export default _default; | ||
import { ARToolkitNFT } from "./ARToolkitNFT"; | ||
import { ARControllerNFT } from "./ARControllerNFT"; | ||
export { ARToolkitNFT, ARControllerNFT }; |
@@ -41,6 +41,6 @@ const path = require("path"); | ||
filename: "ARToolkitNFT.js", | ||
library: "ARToolkitNFT", | ||
//library: "ARToolkitNFT", | ||
libraryTarget: "umd", | ||
// @see: https://github.com/webpack/webpack/issues/3929 | ||
libraryExport: "default", | ||
//libraryExport: "default", | ||
// @see: https://github.com/webpack/webpack/issues/6522 | ||
@@ -68,6 +68,6 @@ globalObject: "typeof self !== 'undefined' ? self : this", | ||
filename: "ARToolkitNFT_simd.js", | ||
library: "ARToolkitNFT", | ||
//library: "ARToolkitNFT", | ||
libraryTarget: "umd", | ||
// @see: https://github.com/webpack/webpack/issues/3929 | ||
libraryExport: "default", | ||
//libraryExport: "default", | ||
// @see: https://github.com/webpack/webpack/issues/6522 | ||
@@ -74,0 +74,0 @@ globalObject: "typeof self !== 'undefined' ? self : this", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
11787174
64
26097