ml5js / ml5-examples

A collection of ml5.js examples
https://examples.ml5js.org
MIT License
629 stars 448 forks source link

Video classification example #16

Closed b2renger closed 6 years ago

b2renger commented 6 years ago

When running the video classification example, I get this error :

Uncaught (in promise) Error: Requested texture size [0x0] is invalid.

cvalenzuela commented 6 years ago

just curious, are you using an external camera?

b2renger commented 6 years ago

No it's the built in camera on a macbook pro. Just to be clearer I do get an image from the camera but it seems it won't just run through the ml5 treatments.

The rest of the message error is :

at Object.e.validateTextureSize (ml5.min.js:1) at p (ml5.min.js:1) at Object.e.createMatrixTexture (ml5.min.js:1) at t.createMatrixTexture (ml5.min.js:1) at t.acquireTexture (ml5.min.js:1) at t.uploadToGPU (ml5.min.js:1) at t.getTexture (ml5.min.js:1) at t.fromPixels (ml5.min.js:1) at t.fromPixels (ml5.min.js:1) at t.fromPixels (ml5.min.js:1)

cvalenzuela commented 6 years ago

Sorry @b2renger for the late late late response. It seems I didn't have email notifications on for this repo. Let me know if you still have issues with this.

jeanpfs commented 6 years ago

Hello guys, I had this problem using the example located at https://github.com/ml5js/ml5-examples/tree/master/p5js/ImageClassification_Video To solve it I changed the version from p5.js to 0.6.1 in index.html

<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.6.1/p5.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.6.1/addons/p5.dom.min.js"></script>
<script src="https://unpkg.com/ml5" type="text/javascript"></script>
AndreasRef commented 6 years ago

I get this issue as well. Explicitly setting the video height + width video.size(320, 240); in the setup function got rid of it for me.

hiteshsahu commented 5 years ago

GIve video element width & height like this


      <video
          crossOrigin="anonymous"
          autoPlay
          width="320"
          height="240"
          style={{ width: window.innerWidth, height: window.innerHeight }}
          ref={video => {
            this.video = video;
          }}
        />