Browse Source

Introduce constants for clarity

customisations
alemart 9 months ago
parent
commit
8d65461652
1 changed files with 10 additions and 4 deletions
  1. 10
    4
      src/trackers/image-tracker/states/pre-tracking-b.ts

+ 10
- 4
src/trackers/image-tracker/states/pre-tracking-b.ts View File

55
     SUBPIXEL_METHOD,
55
     SUBPIXEL_METHOD,
56
 } from '../settings';
56
 } from '../settings';
57
 
57
 
58
+/** Port of the source image multiplexer: get data from the portal */
59
+const PORT_PORTAL = 0;
60
+
61
+/** Port of the source image multiplexer: get data from the camera */
62
+const PORT_CAMERA = 1;
63
+
58
 
64
 
59
 
65
 
60
 
66
 
121
         this._iterations = 0;
127
         this._iterations = 0;
122
 
128
 
123
         // reset nodes
129
         // reset nodes
124
-        sourceMux.port = 0;
130
+        sourceMux.port = PORT_PORTAL;
125
         sourceBuffer.frozen = false;
131
         sourceBuffer.frozen = false;
126
     }
132
     }
127
 
133
 
206
 
212
 
207
             // get the camera image in the next iteration
213
             // get the camera image in the next iteration
208
             // the warped snapshot from the scanning state is occasionally very blurry
214
             // the warped snapshot from the scanning state is occasionally very blurry
209
-            sourceMux.port = 1;
215
+            sourceMux.port = PORT_CAMERA;
210
             sourceBuffer.frozen = true;
216
             sourceBuffer.frozen = true;
211
 
217
 
212
             // refine the homography
218
             // refine the homography
333
 
339
 
334
         source.media = null;
340
         source.media = null;
335
         imagePortalSource.source = null;
341
         imagePortalSource.source = null;
336
-        sourceMux.port = 0; // 0 = portal; 1 = source
342
+        sourceMux.port = PORT_PORTAL;
337
         sourceBuffer.frozen = false;
343
         sourceBuffer.frozen = false;
338
         referenceKeypointPortalSource.source = null;
344
         referenceKeypointPortalSource.source = null;
339
         imageRectifier.transform = Speedy.Matrix.Eye(3);
345
         imageRectifier.transform = Speedy.Matrix.Eye(3);
358
         keypointSink.turbo = false;
364
         keypointSink.turbo = false;
359
 
365
 
360
         // prepare input
366
         // prepare input
361
-        source.output().connectTo(sourceBuffer.input());
362
         imagePortalSource.output().connectTo(sourceMux.input('in0'));
367
         imagePortalSource.output().connectTo(sourceMux.input('in0'));
368
+        source.output().connectTo(sourceBuffer.input());
363
         sourceBuffer.output().connectTo(sourceMux.input('in1'));
369
         sourceBuffer.output().connectTo(sourceMux.input('in1'));
364
         sourceMux.output().connectTo(screen.input());
370
         sourceMux.output().connectTo(screen.input());
365
         screen.output().connectTo(greyscale.input());
371
         screen.output().connectTo(greyscale.input());

Loading…
Cancel
Save