@srsergio/taptapp-ar 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -45
- package/dist/compiler/aframe.js +0 -3
- package/dist/compiler/compiler-base.d.ts +3 -7
- package/dist/compiler/compiler-base.js +28 -14
- package/dist/compiler/compiler.js +1 -1
- package/dist/compiler/compiler.worker.js +1 -1
- package/dist/compiler/controller.d.ts +4 -4
- package/dist/compiler/controller.js +4 -5
- package/dist/compiler/controller.worker.js +0 -2
- package/dist/compiler/detector/crop-detector.d.ts +12 -12
- package/dist/compiler/detector/crop-detector.js +0 -2
- package/dist/compiler/detector/detector-lite.d.ts +73 -0
- package/dist/compiler/detector/detector-lite.js +430 -0
- package/dist/compiler/detector/detector.d.ts +20 -21
- package/dist/compiler/detector/detector.js +236 -243
- package/dist/compiler/detector/kernels/cpu/binomialFilter.js +0 -1
- package/dist/compiler/detector/kernels/cpu/computeExtremaAngles.d.ts +1 -1
- package/dist/compiler/detector/kernels/cpu/computeLocalization.js +0 -4
- package/dist/compiler/detector/kernels/cpu/computeOrientationHistograms.js +0 -18
- package/dist/compiler/detector/kernels/cpu/fakeShader.js +1 -1
- package/dist/compiler/detector/kernels/cpu/prune.d.ts +7 -1
- package/dist/compiler/detector/kernels/cpu/prune.js +1 -42
- package/dist/compiler/detector/kernels/webgl/upsampleBilinear.d.ts +1 -1
- package/dist/compiler/detector/kernels/webgl/upsampleBilinear.js +2 -2
- package/dist/compiler/estimation/refine-estimate.js +0 -1
- package/dist/compiler/estimation/utils.d.ts +1 -1
- package/dist/compiler/estimation/utils.js +1 -14
- package/dist/compiler/image-list.js +4 -4
- package/dist/compiler/input-loader.d.ts +4 -5
- package/dist/compiler/input-loader.js +2 -2
- package/dist/compiler/matching/hamming-distance.js +13 -13
- package/dist/compiler/matching/hierarchical-clustering.js +1 -1
- package/dist/compiler/matching/matching.d.ts +20 -4
- package/dist/compiler/matching/matching.js +67 -41
- package/dist/compiler/matching/ransacHomography.js +1 -2
- package/dist/compiler/node-worker.d.ts +1 -0
- package/dist/compiler/node-worker.js +84 -0
- package/dist/compiler/offline-compiler.d.ts +171 -6
- package/dist/compiler/offline-compiler.js +303 -421
- package/dist/compiler/tensorflow-setup.d.ts +0 -1
- package/dist/compiler/tensorflow-setup.js +27 -1
- package/dist/compiler/three.d.ts +7 -12
- package/dist/compiler/three.js +3 -5
- package/dist/compiler/tracker/extract.d.ts +1 -0
- package/dist/compiler/tracker/extract.js +200 -244
- package/dist/compiler/tracker/tracker.d.ts +9 -17
- package/dist/compiler/tracker/tracker.js +13 -18
- package/dist/compiler/utils/cumsum.d.ts +4 -2
- package/dist/compiler/utils/cumsum.js +17 -19
- package/dist/compiler/utils/gpu-compute.d.ts +57 -0
- package/dist/compiler/utils/gpu-compute.js +262 -0
- package/dist/compiler/utils/images.d.ts +4 -4
- package/dist/compiler/utils/images.js +67 -53
- package/dist/compiler/utils/worker-pool.d.ts +13 -0
- package/dist/compiler/utils/worker-pool.js +84 -0
- package/package.json +12 -14
- package/src/compiler/aframe.js +2 -4
- package/src/compiler/compiler-base.js +29 -14
- package/src/compiler/compiler.js +1 -1
- package/src/compiler/compiler.worker.js +1 -1
- package/src/compiler/controller.js +4 -5
- package/src/compiler/controller.worker.js +0 -2
- package/src/compiler/detector/crop-detector.js +0 -2
- package/src/compiler/detector/detector-lite.js +494 -0
- package/src/compiler/detector/detector.js +1052 -1063
- package/src/compiler/detector/kernels/cpu/binomialFilter.js +0 -1
- package/src/compiler/detector/kernels/cpu/computeLocalization.js +0 -4
- package/src/compiler/detector/kernels/cpu/computeOrientationHistograms.js +0 -17
- package/src/compiler/detector/kernels/cpu/fakeShader.js +1 -1
- package/src/compiler/detector/kernels/cpu/prune.js +1 -37
- package/src/compiler/detector/kernels/webgl/upsampleBilinear.js +2 -2
- package/src/compiler/estimation/refine-estimate.js +0 -1
- package/src/compiler/estimation/utils.js +9 -24
- package/src/compiler/image-list.js +4 -4
- package/src/compiler/input-loader.js +2 -2
- package/src/compiler/matching/hamming-distance.js +11 -15
- package/src/compiler/matching/hierarchical-clustering.js +1 -1
- package/src/compiler/matching/matching.js +72 -42
- package/src/compiler/matching/ransacHomography.js +0 -2
- package/src/compiler/node-worker.js +93 -0
- package/src/compiler/offline-compiler.js +339 -504
- package/src/compiler/tensorflow-setup.js +29 -1
- package/src/compiler/three.js +3 -5
- package/src/compiler/tracker/extract.js +211 -267
- package/src/compiler/tracker/tracker.js +13 -22
- package/src/compiler/utils/cumsum.js +17 -19
- package/src/compiler/utils/gpu-compute.js +303 -0
- package/src/compiler/utils/images.js +84 -53
- package/src/compiler/utils/worker-pool.js +89 -0
- package/dist/compiler/estimation/esimate-experiment.d.ts +0 -5
- package/dist/compiler/estimation/esimate-experiment.js +0 -267
- package/dist/compiler/estimation/refine-estimate-experiment.d.ts +0 -6
- package/dist/compiler/estimation/refine-estimate-experiment.js +0 -429
- package/dist/react/AREditor.d.ts +0 -5
- package/dist/react/AREditor.js +0 -159
- package/dist/react/ProgressDialog.d.ts +0 -13
- package/dist/react/ProgressDialog.js +0 -57
- package/src/compiler/estimation/esimate-experiment.js +0 -316
- package/src/compiler/estimation/refine-estimate-experiment.js +0 -512
|
@@ -5,6 +5,24 @@ import "@tensorflow/tfjs-backend-webgl";
|
|
|
5
5
|
// Registrar kernels personalizados
|
|
6
6
|
import "./detector/kernels/cpu/index.js";
|
|
7
7
|
import "./detector/kernels/webgl/index.js";
|
|
8
|
+
/**
|
|
9
|
+
* Intenta cargar el backend de Node.js si está disponible
|
|
10
|
+
*/
|
|
11
|
+
const loadNodeBackend = async () => {
|
|
12
|
+
if (typeof process !== "undefined" && process.versions && process.versions.node) {
|
|
13
|
+
try {
|
|
14
|
+
// Usar import dinámico para evitar errores en el navegador
|
|
15
|
+
await import("@tensorflow/tfjs-node");
|
|
16
|
+
console.log("🚀 TensorFlow Node.js backend cargado correctamente");
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
catch (e) {
|
|
20
|
+
console.warn("⚠️ No se pudo cargar @tensorflow/tfjs-node, usando fallback");
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return false;
|
|
25
|
+
};
|
|
8
26
|
/**
|
|
9
27
|
* Configuración optimizada de TensorFlow para diferentes entornos
|
|
10
28
|
* @returns {Promise<string>} El backend activo ('webgl', 'cpu')
|
|
@@ -12,14 +30,22 @@ import "./detector/kernels/webgl/index.js";
|
|
|
12
30
|
export async function setupTensorFlow() {
|
|
13
31
|
console.log("🔧 Iniciando configuración optimizada de TensorFlow.js...");
|
|
14
32
|
try {
|
|
33
|
+
// Intentar cargar backend de Node.js primero
|
|
34
|
+
const nodeBackendLoaded = await loadNodeBackend();
|
|
15
35
|
// Optimizaciones base para todos los backends
|
|
16
36
|
tf.ENV.set("DEBUG", false);
|
|
17
37
|
tf.ENV.set("WEBGL_CPU_FORWARD", false);
|
|
18
38
|
tf.ENV.set("WEBGL_FORCE_F16_TEXTURES", true);
|
|
19
39
|
// Configuración adaptativa de memoria según el entorno
|
|
20
40
|
const isServerless = typeof window === "undefined";
|
|
21
|
-
const memoryThreshold = isServerless ? 1024 * 1024 * 4 : 1024 * 1024 * 8;
|
|
41
|
+
const memoryThreshold = isServerless ? 1024 * 1024 * 4 : 1024 * 1024 * 8;
|
|
22
42
|
tf.ENV.set("CPU_HANDOFF_SIZE_THRESHOLD", memoryThreshold);
|
|
43
|
+
if (nodeBackendLoaded) {
|
|
44
|
+
await tf.setBackend("tensorflow");
|
|
45
|
+
console.log("🚀 Backend TensorFlow (Node.js) activado");
|
|
46
|
+
await tf.ready();
|
|
47
|
+
return "tensorflow";
|
|
48
|
+
}
|
|
23
49
|
// Configuración específica para entorno serverless
|
|
24
50
|
if (isServerless) {
|
|
25
51
|
try {
|
package/dist/compiler/three.d.ts
CHANGED
|
@@ -24,17 +24,17 @@ export class MindARThree {
|
|
|
24
24
|
userDeviceId: any;
|
|
25
25
|
environmentDeviceId: any;
|
|
26
26
|
shouldFaceUser: boolean;
|
|
27
|
-
scene:
|
|
28
|
-
cssScene:
|
|
29
|
-
renderer:
|
|
30
|
-
cssRenderer:
|
|
31
|
-
camera:
|
|
27
|
+
scene: any;
|
|
28
|
+
cssScene: any;
|
|
29
|
+
renderer: any;
|
|
30
|
+
cssRenderer: any;
|
|
31
|
+
camera: any;
|
|
32
32
|
anchors: any[];
|
|
33
33
|
start(): Promise<void>;
|
|
34
34
|
stop(): void;
|
|
35
35
|
switchCamera(): void;
|
|
36
36
|
addAnchor(targetIndex: any): {
|
|
37
|
-
group:
|
|
37
|
+
group: any;
|
|
38
38
|
targetIndex: any;
|
|
39
39
|
onTargetFound: null;
|
|
40
40
|
onTargetLost: null;
|
|
@@ -43,7 +43,7 @@ export class MindARThree {
|
|
|
43
43
|
visible: boolean;
|
|
44
44
|
};
|
|
45
45
|
addCSSAnchor(targetIndex: any): {
|
|
46
|
-
group:
|
|
46
|
+
group: any;
|
|
47
47
|
targetIndex: any;
|
|
48
48
|
onTargetFound: null;
|
|
49
49
|
onTargetLost: null;
|
|
@@ -58,9 +58,4 @@ export class MindARThree {
|
|
|
58
58
|
postMatrixs: any[] | undefined;
|
|
59
59
|
resize(): void;
|
|
60
60
|
}
|
|
61
|
-
import { Scene } from "three";
|
|
62
|
-
import { WebGLRenderer } from "three";
|
|
63
|
-
import { CSS3DRenderer } from "three/addons/renderers/CSS3DRenderer.js";
|
|
64
|
-
import { PerspectiveCamera } from "three";
|
|
65
|
-
import { Group } from "three";
|
|
66
61
|
import { Controller } from "./controller.js";
|
package/dist/compiler/three.js
CHANGED
|
@@ -87,7 +87,7 @@ export class MindARThree {
|
|
|
87
87
|
return anchor;
|
|
88
88
|
}
|
|
89
89
|
_startVideo() {
|
|
90
|
-
return new Promise((resolve
|
|
90
|
+
return new Promise((resolve) => {
|
|
91
91
|
this.video = document.createElement("video");
|
|
92
92
|
this.video.setAttribute("autoplay", "");
|
|
93
93
|
this.video.setAttribute("muted", "");
|
|
@@ -139,9 +139,8 @@ export class MindARThree {
|
|
|
139
139
|
});
|
|
140
140
|
}
|
|
141
141
|
_startAR() {
|
|
142
|
-
return new Promise(async (resolve
|
|
142
|
+
return new Promise(async (resolve) => {
|
|
143
143
|
const video = this.video;
|
|
144
|
-
const container = this.container;
|
|
145
144
|
this.controller = new Controller({
|
|
146
145
|
inputWidth: video.videoWidth,
|
|
147
146
|
inputHeight: video.videoHeight,
|
|
@@ -221,7 +220,7 @@ export class MindARThree {
|
|
|
221
220
|
postMatrix.compose(position, quaternion, scale);
|
|
222
221
|
this.postMatrixs.push(postMatrix);
|
|
223
222
|
}
|
|
224
|
-
|
|
223
|
+
this.controller.dummyRun(this.video);
|
|
225
224
|
this.ui.hideLoading();
|
|
226
225
|
this.ui.showScanning();
|
|
227
226
|
this.controller.processVideo(this.video);
|
|
@@ -273,7 +272,6 @@ export class MindARThree {
|
|
|
273
272
|
const fov = (2 * Math.atan((1 / proj[5]) * fovAdjust) * 180) / Math.PI; // vertical fov
|
|
274
273
|
const near = proj[14] / (proj[10] - 1.0);
|
|
275
274
|
const far = proj[14] / (proj[10] + 1.0);
|
|
276
|
-
const ratio = proj[5] / proj[0]; // (r-l) / (t-b)
|
|
277
275
|
camera.fov = fov;
|
|
278
276
|
camera.near = near;
|
|
279
277
|
camera.far = far;
|