File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed
CartoonGAN/CartoonGan_WebCam
ObjectDetector/ObjectDetector_COCOSSD_Video Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -8,8 +8,11 @@ function preload() {
8
8
9
9
function setup ( ) {
10
10
createCanvas ( 320 , 240 ) ;
11
- video = createCapture ( VIDEO ) ;
11
+ video = createCapture ( VIDEO , videoReady ) ;
12
12
video . size ( 320 , 240 ) ;
13
+ }
14
+
15
+ function videoReady ( ) {
13
16
cartoonGAN . generate ( video , gotResults ) ;
14
17
}
15
18
Original file line number Diff line number Diff line change @@ -15,9 +15,12 @@ let detections = [];
15
15
16
16
function setup ( ) {
17
17
createCanvas ( 640 , 480 ) ;
18
- video = createCapture ( VIDEO ) ;
18
+ video = createCapture ( VIDEO , videoReady ) ;
19
19
video . size ( 640 , 480 ) ;
20
20
video . hide ( ) ;
21
+ }
22
+
23
+ function videoReady ( ) {
21
24
// Models available are 'cocossd', 'yolo'
22
25
detector = ml5 . objectDetector ( 'cocossd' , modelReady ) ;
23
26
}
@@ -37,8 +40,8 @@ function modelReady() {
37
40
function draw ( ) {
38
41
image ( video , 0 , 0 ) ;
39
42
40
- for ( let i = 0 ; i < detections . length ; i ++ ) {
41
- let object = detections [ i ] ;
43
+ for ( let i = 0 ; i < detections . length ; i += 1 ) {
44
+ const object = detections [ i ] ;
42
45
stroke ( 0 , 255 , 0 ) ;
43
46
strokeWeight ( 4 ) ;
44
47
noFill ( ) ;
You can’t perform that action at this time.
0 commit comments