@srsergio/taptapp-ar 1.0.18 → 1.0.19

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.
@@ -13,8 +13,8 @@ catch (e) {
13
13
  // Fallback for tests or other environments
14
14
  ControllerWorker = null;
15
15
  }
16
- const DEFAULT_FILTER_CUTOFF = 0.001; // 1Hz. time period in milliseconds
17
- const DEFAULT_FILTER_BETA = 1000;
16
+ const DEFAULT_FILTER_CUTOFF = 0.5; // Mayor cutoff para respuesta más rápida
17
+ const DEFAULT_FILTER_BETA = 0.01; // Mucho menor beta para reducir el "lag" y la tembladera
18
18
  const DEFAULT_WARMUP_TOLERANCE = 5;
19
19
  const DEFAULT_MISS_TOLERANCE = 5;
20
20
  class Controller {
@@ -11,10 +11,10 @@
11
11
  */
12
12
  import { FREAKPOINTS } from "./freak.js";
13
13
  import { gpuCompute } from "../utils/gpu-compute.js";
14
- const PYRAMID_MIN_SIZE = 8;
15
- const PYRAMID_MAX_OCTAVE = 5;
14
+ const PYRAMID_MIN_SIZE = 4; // Reducido de 8 a 4 para exprimir al máximo la resolución
15
+ // PYRAMID_MAX_OCTAVE ya no es necesario, el límite lo da PYRAMID_MIN_SIZE
16
16
  const NUM_BUCKETS_PER_DIMENSION = 8;
17
- const MAX_FEATURES_PER_BUCKET = 10; // Aumentado de 3 a 10 para mayor densidad de puntos tracking
17
+ const MAX_FEATURES_PER_BUCKET = 15; // Aumentado para mayor densidad de puntos tracking y estabilidad
18
18
  const ORIENTATION_NUM_BINS = 36;
19
19
  const FREAK_EXPANSION_FACTOR = 7.0;
20
20
  // Global GPU mode flag
@@ -40,7 +40,8 @@ export class DetectorLite {
40
40
  w = Math.floor(w / 2);
41
41
  h = Math.floor(h / 2);
42
42
  numOctaves++;
43
- if (numOctaves === PYRAMID_MAX_OCTAVE)
43
+ // Límite de seguridad razonable para evitar bucles infinitos en imágenes gigantes
44
+ if (numOctaves === 10)
44
45
  break;
45
46
  }
46
47
  this.numOctaves = numOctaves;
@@ -4,7 +4,7 @@ import { resize } from "./utils/images.js";
4
4
  * Un valor más bajo permite detectar imágenes más pequeñas pero aumenta el tiempo de procesamiento
5
5
  * @constant {number}
6
6
  */
7
- const MIN_IMAGE_PIXEL_SIZE = 100;
7
+ const MIN_IMAGE_PIXEL_SIZE = 32;
8
8
  /**
9
9
  * Construye una lista de imágenes con diferentes escalas para detección de características
10
10
  * @param {Object} inputImage - Imagen de entrada con propiedades width, height y data
@@ -42,7 +42,8 @@ const buildTrackingImageList = (inputImage) => {
42
42
  const minDimension = Math.min(inputImage.width, inputImage.height);
43
43
  const scaleList = [];
44
44
  const imageList = [];
45
- // Solo generamos la versión de 128px para ahorrar espacio (antes generaba 256px y 128px)
45
+ // Generamos versiones de 256px y 128px para tracking robusto a diferentes distancias
46
+ scaleList.push(256.0 / minDimension);
46
47
  scaleList.push(128.0 / minDimension);
47
48
  for (let i = 0; i < scaleList.length; i++) {
48
49
  imageList.push(Object.assign(resize({ image: inputImage, ratio: scaleList[i] }), { scale: scaleList[i] }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@srsergio/taptapp-ar",
3
- "version": "1.0.18",
3
+ "version": "1.0.19",
4
4
  "description": "AR Compiler for Node.js and Browser",
5
5
  "repository": {
6
6
  "type": "git",
@@ -15,8 +15,9 @@ try {
15
15
  ControllerWorker = null;
16
16
  }
17
17
 
18
- const DEFAULT_FILTER_CUTOFF = 0.001; // 1Hz. time period in milliseconds
19
- const DEFAULT_FILTER_BETA = 1000;
18
+ const DEFAULT_FILTER_CUTOFF = 0.5; // Mayor cutoff para respuesta más rápida
19
+ const DEFAULT_FILTER_BETA = 0.01; // Mucho menor beta para reducir el "lag" y la tembladera
20
+
20
21
  const DEFAULT_WARMUP_TOLERANCE = 5;
21
22
  const DEFAULT_MISS_TOLERANCE = 5;
22
23
 
@@ -13,10 +13,13 @@
13
13
  import { FREAKPOINTS } from "./freak.js";
14
14
  import { gpuCompute } from "../utils/gpu-compute.js";
15
15
 
16
- const PYRAMID_MIN_SIZE = 8;
17
- const PYRAMID_MAX_OCTAVE = 5;
16
+ const PYRAMID_MIN_SIZE = 4; // Reducido de 8 a 4 para exprimir al máximo la resolución
17
+ // PYRAMID_MAX_OCTAVE ya no es necesario, el límite lo da PYRAMID_MIN_SIZE
18
+
19
+
18
20
  const NUM_BUCKETS_PER_DIMENSION = 8;
19
- const MAX_FEATURES_PER_BUCKET = 10; // Aumentado de 3 a 10 para mayor densidad de puntos tracking
21
+ const MAX_FEATURES_PER_BUCKET = 15; // Aumentado para mayor densidad de puntos tracking y estabilidad
22
+
20
23
  const ORIENTATION_NUM_BINS = 36;
21
24
  const FREAK_EXPANSION_FACTOR = 7.0;
22
25
 
@@ -46,8 +49,10 @@ export class DetectorLite {
46
49
  w = Math.floor(w / 2);
47
50
  h = Math.floor(h / 2);
48
51
  numOctaves++;
49
- if (numOctaves === PYRAMID_MAX_OCTAVE) break;
52
+ // Límite de seguridad razonable para evitar bucles infinitos en imágenes gigantes
53
+ if (numOctaves === 10) break;
50
54
  }
55
+
51
56
  this.numOctaves = numOctaves;
52
57
  }
53
58
 
@@ -5,7 +5,9 @@ import { resize } from "./utils/images.js";
5
5
  * Un valor más bajo permite detectar imágenes más pequeñas pero aumenta el tiempo de procesamiento
6
6
  * @constant {number}
7
7
  */
8
- const MIN_IMAGE_PIXEL_SIZE = 100;
8
+ const MIN_IMAGE_PIXEL_SIZE = 32;
9
+
10
+
9
11
 
10
12
  /**
11
13
  * Construye una lista de imágenes con diferentes escalas para detección de características
@@ -49,7 +51,8 @@ const buildTrackingImageList = (inputImage) => {
49
51
  const minDimension = Math.min(inputImage.width, inputImage.height);
50
52
  const scaleList = [];
51
53
  const imageList = [];
52
- // Solo generamos la versión de 128px para ahorrar espacio (antes generaba 256px y 128px)
54
+ // Generamos versiones de 256px y 128px para tracking robusto a diferentes distancias
55
+ scaleList.push(256.0 / minDimension);
53
56
  scaleList.push(128.0 / minDimension);
54
57
  for (let i = 0; i < scaleList.length; i++) {
55
58
  imageList.push(
@@ -59,4 +62,5 @@ const buildTrackingImageList = (inputImage) => {
59
62
  return imageList;
60
63
  };
61
64
 
65
+
62
66
  export { buildImageList, buildTrackingImageList };