Skip to content

Commit 2851d2e

Browse files
authored
Merge pull request #214 from ml5js/nasif.depth-estimation
Update example links to ml5 web editor
2 parents bdb96b4 + de05091 commit 2851d2e

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

docs/reference/depthestimation.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,22 @@ The ml5.js DepthEstimation module offers a pretrained model for inferring depth
55

66
## Quick Start
77

8-
Get up and running with the [webcam example](https://editor.p5js.org/nasif-co/sketches/Pep6DjEtD), which shows a realtime depth map estimated from the webcam video.
8+
Get up and running with the [webcam example](https://editor.p5js.org/ml5/sketches/1AlSdDhwA), which shows a realtime depth map estimated from the webcam video.
99

1010
</br>
1111

1212
[DEMO](iframes/depthestimation ":include :type=iframe width=100% height=550px")
1313

1414
## Examples
15-
- [Webcam](https://editor.p5js.org/nasif-co/sketches/Pep6DjEtD): Show the live depth map of the video captured by the webcam.
16-
- [Video](https://editor.p5js.org/nasif-co/sketches/vifmzXg6o): Generate the depth map of a video file as it plays.
17-
- [Single Image](https://editor.p5js.org/nasif-co/sketches/_TcZofgrt): Depth map of an image using single-shot estimation.
18-
- [Mask Background](https://editor.p5js.org/nasif-co/sketches/Z_1xMhUPl): Showcases how to mask out the background from the depth result.
19-
- [Point Cloud](https://editor.p5js.org/nasif-co/sketches/VbT8hEoDz): Creates a live 3D point cloud visualization of the webcam video.
20-
- [Mesh](https://editor.p5js.org/nasif-co/sketches/X-e1DEZr4): Creates a live 3D mesh geometry of the webcam video.
15+
- [Webcam](https://editor.p5js.org/ml5/sketches/1AlSdDhwA): Show the live depth map of the video captured by the webcam.
16+
- [Video](https://editor.p5js.org/ml5/sketches/YGAqvhn1o): Generate the depth map of a video file as it plays.
17+
- [Single Image](https://editor.p5js.org/ml5/sketches/VpVUFgtOU): Depth map of an image using single frame estimation.
18+
- [Mask Background](https://editor.p5js.org/ml5/sketches/zxi8xUuq4): Showcases how to mask out the background from the depth result.
19+
- [Point Cloud](https://editor.p5js.org/ml5/sketches/7EOC8txJ1): Creates a live 3D point cloud visualization of the webcam video.
20+
- [Mesh](https://editor.p5js.org/ml5/sketches/CE2f9l38k): Creates a live 3D mesh geometry of the webcam video.
2121

2222
## Step-by-Step Guide
23-
### Initialization and options
23+
### Initialization and Options
2424
Before starting, make sure you have included the ml5 library in your `index.html` file:
2525

2626
```html
@@ -52,12 +52,12 @@ async function setup() {
5252
}
5353
```
5454

55-
### Estimating depth
56-
As with many other ml5 models, you have two options to run depth estimation on the image, video or webcam of your choice: _Continuous Estimation_ and _Single Shot Estimation_ .
55+
### Estimating Depth
56+
As with many other ml5 models, you have two options to run depth estimation on the image, video or webcam of your choice: _Continuous Estimation_ and _Single Frame Estimation_ .
5757

5858
For any of these, make sure you first load the image, video or start the webcam capture. This is the media we will pass to the model.
5959

60-
#### Continuous estimation
60+
#### Continuous Estimation
6161
This method is used to continuously estimate depth on every frame of a video or webcam feed.
6262
```js
6363
// Make sure to load the model in preload or async in p5 2.0!
@@ -75,7 +75,7 @@ function gotResults(result) {
7575
```
7676
Using this method, the depth estimator will take care of doing estimation of a frame and waiting for it to finish before working on the next frame. Any time a depth map is ready, it will fire the callback function to provide it.
7777

78-
#### Single shot estimation
78+
#### Single Frame Estimation
7979
This method is used to estimate depth once, for a single image:
8080
```js
8181
// Make sure to load the image and the model in preload or asyn in p5 2.0!
@@ -90,7 +90,7 @@ function gotResults(result) {
9090
```
9191
Because the estimation takes time, we pass in a callback function that will fire when estimation is ready. The `estimate` method is called in setup because it **will only run once**. If calling it multiple times, it is prudent to wait for each operation to finish before starting the next one.
9292

93-
### Using the depth result
93+
### Using the Depth Result
9494
Whenever the callback function fires, we have acces to the depth result that contains all the depth information.
9595
```js
9696
let depthMap;
@@ -171,7 +171,7 @@ depthEstimator.estimateStop()
171171
```
172172
173173
### depthEstimator.estimate()
174-
This method is used for _Single Shot Estimation_: estimating depth one time on a single image or video/webcam frame.
174+
This method is used for _Single Frame Estimation_: estimating depth one time on a single image or video/webcam frame.
175175
176176
```js
177177
depthEstimator.estimate(media, callback)
@@ -197,7 +197,7 @@ These are its properties:
197197
- Type: 2D array of floating point numbers in the 0 - 1 range.
198198
- `mask`: The mask of the people detected in the image and for whom depth values were estimated. It can be used directly with the `mask()` function in p5.
199199
- Type: `p5.Image` object
200-
- `sourceFrame`: The exact frame that was analyzed to create the depth map. Because depth estimation is not immediate, the result can fall out of sync from the source video. By using this value instead of the video, the depth data is guaranteed to be in sync. See a [demo sketch](https://editor.p5js.org/nasif-co/sketches/Z_1xMhUPl) showcasing the difference.
200+
- `sourceFrame`: The exact frame that was analyzed to create the depth map. Because depth estimation is not immediate, the result can fall out of sync from the source video. By using this value instead of the video, the depth data is guaranteed to be in sync. See a [demo sketch](https://editor.p5js.org/ml5/sketches/W8irRhKOw) showcasing the difference.
201201
- Type: `p5.Image`
202202
- `width`: Width of the depth map
203203
- Type: number (integer)

docs/reference/iframes/depthestimation/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<script>
1717
// Navbar will be added on the top of the page.
1818
// You can provide a link to the script file on the p5 web editor.
19-
navbar("https://editor.p5js.org/nasif-co/sketches/Pep6DjEtD");
19+
navbar("https://editor.p5js.org/ml5/sketches/1AlSdDhwA");
2020
</script>
2121

2222
<iframe src="ready.html" name="script-iframe"></iframe>

0 commit comments

Comments
 (0)