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() {
88
99function setup ( ) {
1010 createCanvas ( 320 , 240 ) ;
11- video = createCapture ( VIDEO ) ;
11+ video = createCapture ( VIDEO , videoReady ) ;
1212 video . size ( 320 , 240 ) ;
13+ }
14+
15+ function videoReady ( ) {
1316 cartoonGAN . generate ( video , gotResults ) ;
1417}
1518
Original file line number Diff line number Diff line change @@ -15,9 +15,12 @@ let detections = [];
1515
1616function setup ( ) {
1717 createCanvas ( 640 , 480 ) ;
18- video = createCapture ( VIDEO ) ;
18+ video = createCapture ( VIDEO , videoReady ) ;
1919 video . size ( 640 , 480 ) ;
2020 video . hide ( ) ;
21+ }
22+
23+ function videoReady ( ) {
2124 // Models available are 'cocossd', 'yolo'
2225 detector = ml5 . objectDetector ( 'cocossd' , modelReady ) ;
2326}
@@ -37,8 +40,8 @@ function modelReady() {
3740function draw ( ) {
3841 image ( video , 0 , 0 ) ;
3942
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 ] ;
4245 stroke ( 0 , 255 , 0 ) ;
4346 strokeWeight ( 4 ) ;
4447 noFill ( ) ;
You can’t perform that action at this time.
0 commit comments