浏览代码

Change resolutions xs+, sm, sm+

customisations
alemart 11 个月前
父节点
当前提交
52b221dcbe

+ 1
- 1
docs/api/camera-source.md 查看文件

@@ -13,7 +13,7 @@ Create a new webcam-based source of data with the specified `settings`.
13 13
 **Arguments**
14 14
 
15 15
 * `settings: object, optional`. An object with the following keys (all are optional):
16
-    * `resolution: Resolution`. The desired [resolution](resolution.md) of the video. The higher the resolution, the longer it takes for the video to be uploaded to the GPU, which impacts performance. The lower the resolution, the less accurate the tracking will be. Suggested values: `"md+"`, `"md"`, `"sm+"`.
16
+    * `resolution: Resolution`. The desired [resolution](resolution.md) of the video. The higher the resolution, the longer it takes for the video to be uploaded to the GPU, which impacts performance. The lower the resolution, the less accurate the tracking will be. Suggested values: `"md+"`, `"md"`, `"sm+"`, `"sm"`.
17 17
     * `aspectRatio: number`. A hint specifying the preferred aspect ratio of the video.
18 18
     * `constraints: MediaTrackConstraints`. Additional video constraints that will be passed to `navigator.mediaDevices.getUserMedia()`.
19 19
 

+ 7
- 7
docs/api/resolution.md 查看文件

@@ -1,15 +1,15 @@
1 1
 # Resolution
2 2
 
3
-A `Resolution` is a setting defined by a string. It is mapped to a size measured in pixels according to special rules. You may use it, for example, to change the resolution of a video captured by a webcam, to adjust the resolution of a video when it is processed by a tracker, or to set the resolution of the virtual scene when it is rendered.
3
+A `Resolution` is a setting defined by a string. It is mapped to a size measured in pixels according to special rules. You may use it, for example, to change the resolution of a video captured by a webcam, to adjust the resolution of a video when it is processed by a tracker, or to set the rendering resolution of a virtual scene.
4 4
 
5 5
 The table below shows examples of how resolution strings are converted to pixels:
6 6
 
7
-| Resolution | 16:9 landscape | 16:10 landscape | 4:3 landscape | Notes |
8
-| ---------- | -------------- | --------------- | ------------- | ----- |
7
+| Resolution | 16:9 | 16:10 | 4:3 | Notes |
8
+| ---------- | ---- | ----- | --- | ----- |
9 9
 | `"xs"` | 214x120 | 192x120 | 160x120 | |
10
-| `"xs+"` | 284x160 | 256x160 | 214x160 | |
11
-| `"sm"` | 356x200 | 320x200 | 266x200 | |
12
-| `"sm+"` | 426x240 | 384x240 | 320x240 | 240p |
10
+| `"xs+"` | 256x144 | 230x144 | 192x144 | 144p |
11
+| `"sm"` | 426x240 | 384x240 | 320x240 | 240p |
12
+| `"sm+"` | 512x288 | 460x288 | 384x288 | |
13 13
 | `"md"` | 568x320 | 512x320 | 426x320 | |
14 14
 | `"md+"` | 640x360 | 576x360 | 480x360 | 360p |
15 15
 | `"lg"` | 854x480 | 768x480 | 640x480 | 480p |
@@ -17,4 +17,4 @@ The table below shows examples of how resolution strings are converted to pixels
17 17
 | `"xl"` | 1280x720 | 1152x720 | 960x720 | 720p |
18 18
 | `"xl+"` | 1366x768 | 1228x768 | 1024x768 | |
19 19
 | `"xxl"` | 1600x900 | 1440x900 | 1200x900 | |
20
-| `"xxl+"` | 1706x960 | 1536x960 | 1280x960 | 960p |
20
+| `"xxl+"` | 1706x960 | 1536x960 | 1280x960 | |

+ 1
- 1
plugins/aframe-with-encantar.js 查看文件

@@ -742,7 +742,7 @@ AFRAME.registerComponent('ar-image-tracker', ARComponent({
742 742
     schema: {
743 743
 
744 744
         /** resolution of the tracker: "xs" | "xs+" | "sm" | "sm+" | "md" | "md+" | "lg" | "lg+" | "xl" | "xl+" | "xxl" | "xxl+" */
745
-        'resolution': { type: 'string', default: 'sm+' },
745
+        'resolution': { type: 'string', default: 'sm' },
746 746
 
747 747
     },
748 748
 

+ 1
- 1
src/sources/camera-source.ts 查看文件

@@ -46,7 +46,7 @@ export interface CameraSourceOptions
46 46
 
47 47
 /** Default options for camera sources */
48 48
 const DEFAULT_CAMERA_OPTIONS: Readonly<Required<CameraSourceOptions>> = {
49
-    resolution: 'md', //'sm+',
49
+    resolution: 'md',
50 50
     aspectRatio: 16/9,
51 51
     constraints: { facingMode: 'environment' },
52 52
 };

+ 1
- 1
src/trackers/image-tracker/settings.ts 查看文件

@@ -21,7 +21,7 @@
21 21
  */
22 22
 
23 23
 /** Default tracking resolution */
24
-export const DEFAULT_TRACKING_RESOLUTION = 'sm+';
24
+export const DEFAULT_TRACKING_RESOLUTION = 'sm';
25 25
 
26 26
 /** Maximum number of keypoints to be stored for each reference image when in the training state */
27 27
 export const TRAIN_MAX_KEYPOINTS = 1024; //512;

+ 5
- 4
src/utils/resolution.ts 查看文件

@@ -30,20 +30,21 @@ export type Resolution = 'xs' | 'xs+' | 'sm' | 'sm+' | 'md' | 'md+' | 'lg' | 'lg
30 30
 /** Reference heights when in landscape mode, measured in pixels */
31 31
 const REFERENCE_HEIGHT: { readonly [R in Resolution]: number } = {
32 32
     'xs' : 120,
33
-    'xs+': 160,
34
-    'sm' : 200,
35
-    'sm+': 240,
33
+    'xs+': 144,
34
+    'sm' : 240,
35
+    'sm+': 288,
36 36
     'md' : 320,
37 37
     'md+': 360,
38 38
     'lg' : 480,
39 39
     'lg+': 600,
40
-    'xl' : 720, // should we define an alias, "hd"?
40
+    'xl' : 720,
41 41
     'xl+': 768,
42 42
     'xxl': 900,
43 43
     'xxl+':960,
44 44
     //'ul-': 1024,
45 45
     //'ul': 1080, // what should we call this? xxxl? ul? (ultra large?)
46 46
     //'ul+': 1200,
47
+    // instead of defining xxxl, what if we accept custom resolution names such as "720p" and "1080p"?
47 48
 };
48 49
 
49 50
 /**

正在加载...
取消
保存