您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

settings.ts 6.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. /*
  2. * encantar.js
  3. * GPU-accelerated Augmented Reality for the web
  4. * Copyright (C) 2022-2024 Alexandre Martins <alemartf(at)gmail.com>
  5. *
  6. * This program is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU Lesser General Public License as published
  8. * by the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public License
  17. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  18. *
  19. * settings.ts
  20. * Settings of the Image Tracker
  21. */
  22. /** Default tracking resolution */
  23. export const DEFAULT_TRACKING_RESOLUTION = 'sm';
  24. /** Maximum number of keypoints to be stored for each reference image when in the training state */
  25. export const TRAIN_MAX_KEYPOINTS = 1024; //512;
  26. /** Percentage relative to the screen size adjusted to the aspect ratio of the reference image */
  27. export const TRAIN_IMAGE_SCALE = 0.8; // ORB is not scale invariant
  28. /** Width and height of the Normalized Image Space (NIS) */
  29. export const NIS_SIZE = 1024; // keypoint positions are stored as fixed point
  30. /** Used to identify the best maches */
  31. export const SCAN_MATCH_RATIO = 0.7; // usually a value in [0.6, 0.8]
  32. /** Maximum number of keypoints to be analyzed when in the scanning state */
  33. export const SCAN_MAX_KEYPOINTS = 512;
  34. /** Number of pyramid levels to be scanned by the corner detector when in the scanning & training states */
  35. export const SCAN_PYRAMID_LEVELS = 4; //7;
  36. /** Scale factor between pyramid levels to be scanned by the corner detector when in the scanning & training states */
  37. export const SCAN_PYRAMID_SCALEFACTOR = 1.19; // 2 ^ 0.25
  38. /** Threshold of the FAST corner detector used in the scanning/training states */
  39. export const SCAN_FAST_THRESHOLD = 60;
  40. /** Minimum number of accepted matches for us to move out of the scanning state */
  41. export const SCAN_MIN_MATCHES = 20; //30;
  42. /** When in the scanning state, we require the image to be matched during a few consecutive frames before accepting it */
  43. export const SCAN_CONSECUTIVE_FRAMES = 30;//15;//45;
  44. /** Reprojection error, in NIS pixels, used when estimating a motion model (scanning state) */
  45. export const SCAN_RANSAC_REPROJECTIONERROR_NIS = (NIS_SIZE * 0.02) | 0;
  46. /** Reprojection error, in NDC, used when estimating a motion model (scanning state) */
  47. export const SCAN_RANSAC_REPROJECTIONERROR_NDC = SCAN_RANSAC_REPROJECTIONERROR_NIS / (NIS_SIZE / 2);
  48. /** Number of tables used in the LSH-based keypoint matching */
  49. export const SCAN_LSH_TABLES = 8; // up to 32
  50. /** Hash size, in bits, used in the LSH-based keypoint matching */
  51. export const SCAN_LSH_HASHSIZE = 15; // up to 16
  52. /** Use the Nightvision filter when in the scanning/training state? */
  53. export const SCAN_WITH_NIGHTVISION = true;
  54. /** Nightvision filter: gain */
  55. export const NIGHTVISION_GAIN = 0.3; // 0.2;
  56. /** Nightvision filter: offset */
  57. export const NIGHTVISION_OFFSET = 0.5;
  58. /** Nightvision filter: decay */
  59. export const NIGHTVISION_DECAY = 0.0;
  60. /** Nightvision filter: quality level */
  61. export const NIGHTVISION_QUALITY = 'low';
  62. /** Kernel size (square) of the Gaussian filter applied before computing the ORB descriptors */
  63. export const ORB_GAUSSIAN_KSIZE = 9;
  64. /** Sigma of the Gaussian filter applied before computing the ORB descriptors */
  65. export const ORB_GAUSSIAN_SIGMA = 2.0;
  66. /** Kernel size (square) of the Gaussian filter applied before subpixel refinement for noise reduction */
  67. export const SUBPIXEL_GAUSSIAN_KSIZE = 5;
  68. /** Sigma of the Gaussian filter applied before subpixel refinement for noise reduction */
  69. export const SUBPIXEL_GAUSSIAN_SIGMA = 1.0;
  70. /** Subpixel refinement method */
  71. export const SUBPIXEL_METHOD = 'bilinear-upsample'; // 'quadratic1d';
  72. /** Minimum acceptable number of matched keypoints when in a pre-tracking state */
  73. export const PRE_TRACK_MIN_MATCHES = 4;
  74. /** Minimum acceptable number of matched keypoints when in the tracking state */
  75. export const TRACK_MIN_MATCHES = 4;//10; //20;
  76. /** Maximum number of keypoints to be analyzed in the tracking state */
  77. export const TRACK_MAX_KEYPOINTS = 200; //400; // <-- impacts performance!
  78. /** Capacity of the keypoint detector used in the the tracking state */
  79. export const TRACK_DETECTOR_CAPACITY = 2048; //4096;
  80. /** Quality of the Harris/Shi-Tomasi corner detector */
  81. export const TRACK_HARRIS_QUALITY = 0.005; // get a lot of keypoints
  82. /** Use the Nightvision filter when in the tracking state? */
  83. export const TRACK_WITH_NIGHTVISION = false; // produces shaking?
  84. /** Relative size (%) of the (top, right, bottom, left) borders of the rectified image */
  85. export const TRACK_RECTIFIED_BORDER = 0.15; //0.20;
  86. /** Relative size (%) used to clip keypoints from the borders of the rectified image */
  87. export const TRACK_CLIPPING_BORDER = TRACK_RECTIFIED_BORDER * 1.20; //1.25; //1.15;
  88. /** Scale of the rectified image in NDC, without taking the aspect ratio into consideration */
  89. export const TRACK_RECTIFIED_SCALE = 1 - 2 * TRACK_RECTIFIED_BORDER;
  90. /** Reprojection error, in NIS pixels, used when estimating a motion model (tracking state) */
  91. export const TRACK_RANSAC_REPROJECTIONERROR_NIS = (NIS_SIZE * 0.0125) | 0;
  92. /** Reprojection error, in NDC, used when estimating a motion model (tracking state) */
  93. export const TRACK_RANSAC_REPROJECTIONERROR_NDC = TRACK_RANSAC_REPROJECTIONERROR_NIS / (NIS_SIZE / 2);
  94. /** We use a N x N grid to spatially distribute the keypoints in order to compute a better homography */
  95. export const TRACK_GRID_GRANULARITY = 10; //20; // the value of N
  96. /** Used to identify the best maches */
  97. export const TRACK_MATCH_RATIO = 0.75; // usually a value in [0.6, 0.8] - low values => strict tracking
  98. /** Number of consecutive frames in which we tolerate a "target lost" situation */
  99. export const TRACK_LOST_TOLERANCE = 15;