@srsergio/taptapp-ar 1.0.86 → 1.0.87
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.
|
@@ -3,8 +3,6 @@ import { compute as hammingCompute } from "./hamming-distance.js";
|
|
|
3
3
|
import { computeHoughMatches } from "./hough.js";
|
|
4
4
|
import { computeHomography } from "./ransacHomography.js";
|
|
5
5
|
import { multiplyPointHomographyInhomogenous, matrixInverse33 } from "../utils/geometry.js";
|
|
6
|
-
import { FourierEncoder } from "../utils/fourier-encoder.js";
|
|
7
|
-
const encoder = new FourierEncoder(4);
|
|
8
6
|
const INLIER_THRESHOLD = 5.0; // Tightened from 10 to 5 for better precision
|
|
9
7
|
const MIN_NUM_INLIERS = 8; // Restored to 8
|
|
10
8
|
const CLUSTER_MAX_POP = 20;
|
|
@@ -96,7 +94,7 @@ const match = ({ keyframe, querypoints, querywidth, queryheight, debugMode }) =>
|
|
|
96
94
|
return { debugExtra };
|
|
97
95
|
// Second pass with homography guided matching
|
|
98
96
|
const HInv = matrixInverse33(H, 0.00001);
|
|
99
|
-
const dThreshold2 =
|
|
97
|
+
const dThreshold2 = 100; // 10 * 10
|
|
100
98
|
const matches2 = [];
|
|
101
99
|
const hi00 = HInv[0], hi01 = HInv[1], hi02 = HInv[2];
|
|
102
100
|
const hi10 = HInv[3], hi11 = HInv[4], hi12 = HInv[5];
|
|
@@ -115,29 +113,14 @@ const match = ({ keyframe, querypoints, querywidth, queryheight, debugMode }) =>
|
|
|
115
113
|
const col = querypoint.maxima ? kmax : kmin;
|
|
116
114
|
if (!col)
|
|
117
115
|
continue;
|
|
118
|
-
const cx = col.x, cy = col.y, cd = col.d
|
|
116
|
+
const cx = col.x, cy = col.y, cd = col.d;
|
|
119
117
|
const qDesc = querypoint.descriptors;
|
|
120
|
-
// Fourier encoding of the mapped point (where it SHOULD be in the keyframe)
|
|
121
|
-
const qFourier = encoder.encode(mapX / keyframe.w, mapY / keyframe.h);
|
|
122
118
|
for (let k = 0, clen = cx.length; k < clen; k++) {
|
|
123
119
|
const dx = cx[k] - mapX;
|
|
124
120
|
const dy = cy[k] - mapY;
|
|
125
121
|
const d2 = dx * dx + dy * dy;
|
|
126
122
|
if (d2 > dThreshold2)
|
|
127
123
|
continue;
|
|
128
|
-
// 🚀 MOONSHOT: Fourier Spatial Harmony Check
|
|
129
|
-
// We check if the stored point's Fourier signature matches its predicted position
|
|
130
|
-
let fourierSim = 0;
|
|
131
|
-
if (cf) {
|
|
132
|
-
for (let fidx = 0; fidx < 16; fidx++) {
|
|
133
|
-
fourierSim += (cf[k * 16 + fidx] / 127) * qFourier[fidx];
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
else {
|
|
137
|
-
fourierSim = 16; // Backward compatibility
|
|
138
|
-
}
|
|
139
|
-
if (fourierSim < 8)
|
|
140
|
-
continue; // Reject if spatially dissonant (low harmonic match)
|
|
141
124
|
const d = hammingCompute({ v1: cd, v1Offset: k * descSize, v2: qDesc });
|
|
142
125
|
if (d < bestD1) {
|
|
143
126
|
bestD2 = bestD1;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@srsergio/taptapp-ar",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.87",
|
|
4
4
|
"description": "Ultra-fast Augmented Reality (AR) SDK for Node.js and Browser. Image tracking with 100% pure JavaScript, zero-dependencies, and high-performance compilation.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"augmented reality",
|
|
@@ -3,9 +3,6 @@ import { compute as hammingCompute } from "./hamming-distance.js";
|
|
|
3
3
|
import { computeHoughMatches } from "./hough.js";
|
|
4
4
|
import { computeHomography } from "./ransacHomography.js";
|
|
5
5
|
import { multiplyPointHomographyInhomogenous, matrixInverse33 } from "../utils/geometry.js";
|
|
6
|
-
import { FourierEncoder } from "../utils/fourier-encoder.js";
|
|
7
|
-
|
|
8
|
-
const encoder = new FourierEncoder(4);
|
|
9
6
|
|
|
10
7
|
const INLIER_THRESHOLD = 5.0; // Tightened from 10 to 5 for better precision
|
|
11
8
|
const MIN_NUM_INLIERS = 8; // Restored to 8
|
|
@@ -111,7 +108,7 @@ const match = ({ keyframe, querypoints, querywidth, queryheight, debugMode }) =>
|
|
|
111
108
|
|
|
112
109
|
// Second pass with homography guided matching
|
|
113
110
|
const HInv = matrixInverse33(H, 0.00001);
|
|
114
|
-
const dThreshold2 =
|
|
111
|
+
const dThreshold2 = 100; // 10 * 10
|
|
115
112
|
const matches2 = [];
|
|
116
113
|
|
|
117
114
|
const hi00 = HInv[0], hi01 = HInv[1], hi02 = HInv[2];
|
|
@@ -135,12 +132,9 @@ const match = ({ keyframe, querypoints, querywidth, queryheight, debugMode }) =>
|
|
|
135
132
|
const col = querypoint.maxima ? kmax : kmin;
|
|
136
133
|
if (!col) continue;
|
|
137
134
|
|
|
138
|
-
const cx = col.x, cy = col.y, cd = col.d
|
|
135
|
+
const cx = col.x, cy = col.y, cd = col.d;
|
|
139
136
|
const qDesc = querypoint.descriptors;
|
|
140
137
|
|
|
141
|
-
// Fourier encoding of the mapped point (where it SHOULD be in the keyframe)
|
|
142
|
-
const qFourier = encoder.encode(mapX / keyframe.w, mapY / keyframe.h);
|
|
143
|
-
|
|
144
138
|
for (let k = 0, clen = cx.length; k < clen; k++) {
|
|
145
139
|
const dx = cx[k] - mapX;
|
|
146
140
|
const dy = cy[k] - mapY;
|
|
@@ -148,19 +142,6 @@ const match = ({ keyframe, querypoints, querywidth, queryheight, debugMode }) =>
|
|
|
148
142
|
|
|
149
143
|
if (d2 > dThreshold2) continue;
|
|
150
144
|
|
|
151
|
-
// 🚀 MOONSHOT: Fourier Spatial Harmony Check
|
|
152
|
-
// We check if the stored point's Fourier signature matches its predicted position
|
|
153
|
-
let fourierSim = 0;
|
|
154
|
-
if (cf) {
|
|
155
|
-
for (let fidx = 0; fidx < 16; fidx++) {
|
|
156
|
-
fourierSim += (cf[k * 16 + fidx] / 127) * qFourier[fidx];
|
|
157
|
-
}
|
|
158
|
-
} else {
|
|
159
|
-
fourierSim = 16; // Backward compatibility
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
if (fourierSim < 8) continue; // Reject if spatially dissonant (low harmonic match)
|
|
163
|
-
|
|
164
145
|
const d = hammingCompute({ v1: cd, v1Offset: k * descSize, v2: qDesc });
|
|
165
146
|
|
|
166
147
|
if (d < bestD1) {
|