瀏覽代碼

Introduce constants for clarity

customisations
alemart 9 月之前
父節點
當前提交
8d65461652
共有 1 個文件被更改,包括 10 次插入4 次删除
  1. 10
    4
      src/trackers/image-tracker/states/pre-tracking-b.ts

+ 10
- 4
src/trackers/image-tracker/states/pre-tracking-b.ts 查看文件

@@ -55,6 +55,12 @@ import {
55 55
     SUBPIXEL_METHOD,
56 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,7 +127,7 @@ export class ImageTrackerPreTrackingBState extends ImageTrackerState
121 127
         this._iterations = 0;
122 128
 
123 129
         // reset nodes
124
-        sourceMux.port = 0;
130
+        sourceMux.port = PORT_PORTAL;
125 131
         sourceBuffer.frozen = false;
126 132
     }
127 133
 
@@ -206,7 +212,7 @@ export class ImageTrackerPreTrackingBState extends ImageTrackerState
206 212
 
207 213
             // get the camera image in the next iteration
208 214
             // the warped snapshot from the scanning state is occasionally very blurry
209
-            sourceMux.port = 1;
215
+            sourceMux.port = PORT_CAMERA;
210 216
             sourceBuffer.frozen = true;
211 217
 
212 218
             // refine the homography
@@ -333,7 +339,7 @@ export class ImageTrackerPreTrackingBState extends ImageTrackerState
333 339
 
334 340
         source.media = null;
335 341
         imagePortalSource.source = null;
336
-        sourceMux.port = 0; // 0 = portal; 1 = source
342
+        sourceMux.port = PORT_PORTAL;
337 343
         sourceBuffer.frozen = false;
338 344
         referenceKeypointPortalSource.source = null;
339 345
         imageRectifier.transform = Speedy.Matrix.Eye(3);
@@ -358,8 +364,8 @@ export class ImageTrackerPreTrackingBState extends ImageTrackerState
358 364
         keypointSink.turbo = false;
359 365
 
360 366
         // prepare input
361
-        source.output().connectTo(sourceBuffer.input());
362 367
         imagePortalSource.output().connectTo(sourceMux.input('in0'));
368
+        source.output().connectTo(sourceBuffer.input());
363 369
         sourceBuffer.output().connectTo(sourceMux.input('in1'));
364 370
         sourceMux.output().connectTo(screen.input());
365 371
         screen.output().connectTo(greyscale.input());

Loading…
取消
儲存