Last active
March 16, 2020 18:19
-
-
Save zaidalyafeai/b32e7f03376dc1e4d26e13b041ca00c8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//retrieve the canvas | |
const canvas = document.getElementById("myCanvas"); | |
const ctx = canvas.getContext("2d"); | |
//get image data | |
imgData = ctx.getImageData(0, 0, 28, 28); | |
//convert to tensor | |
const tensor = tf.browser.fromPixels(imgData); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment