This file contains 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
Processing 1 images | |
image shape: (425, 640, 3) min: 0.00000 max: 255.00000 uint8 | |
molded_images shape: (1, 1024, 1024, 3) min: -123.70000 max: 151.10000 float64 | |
image_metas shape: (1, 93) min: 0.00000 max: 1024.00000 float64 | |
anchors shape: (1, 261888, 4) min: -0.35390 max: 1.29134 float32 |
This file contains 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
async function takePhoto(quality) { | |
// create html elements | |
const div = document.createElement('div'); | |
const video = document.createElement('video'); | |
video.style.display = 'block'; | |
// request the stream. This will ask for Permission to access | |
// a connected Camera/Webcam | |
const stream = await navigator.mediaDevices.getUserMedia({video: true}); |
This file contains 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
from IPython.display import display, Javascript | |
from google.colab.output import eval_js | |
from base64 import b64decode | |
def take_photo(filename='photo.jpg', quality=0.8): | |
js = Javascript(''' | |
// ... | |
// JavaScript code here <<== | |
// ... | |
''') |
This file contains 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
import IPython | |
import time | |
import sys | |
import numpy as np | |
import cv2 | |
import base64 | |
import logging | |
from google.colab import output | |
from PIL import Image |
This file contains 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
# register this function, so JS code could call this | |
output.register_callback('notebook.run_algo', run_algo) | |
# put the JS code in cell and run it | |
take_photo() |
OlderNewer