Published
Edited
Aug 29, 2019
1 fork
1 star
Hello, PGLiteINSEE ParquetHello, apcachDruidJS workerHello, OrbitWord Tour: 40k words and their friendsHello, spectral.jsHello, petite-vueHello, @thi.ng/grid-iteratorsHello, thumbhashHello, SwissGLHello, QOI (and glitches)Hello, orbHello, cosmographHello, TabulatorUsing d3.blur with PlotMath.cbrtHello debounceColorcetHello, gliiHello, Open MeteoHello, PyWaveletsHello, typesenseHello, libgifHello, kmeans-engineHappy anniversary, Project Gutenberg!Hello, fflateHello, ArchieML!Hello, d3-bboxCollideHello, jsgeoda!Hello, EDTF!Hello, protovis!Hello, placekeyHello, fuse.jsHello, Reorder.jsHello, shadow DOMjszipHello, procedural-glHello, qhullHello, genetic-jsDruidJSHello, Tippy.jsHello, paintWorkletBig πHello, AutoencoderHello, Shakespearean UUIDsHello, ccwt.jsHello, constrainautorHello, talismanHello, polygon-offsetHello p-queueHello async-poolHello rollup-plugin-asciiHello, algebra.jsHello, pixi.jsHello, d3-renderHello zip/unzipCumulative Wikipedia DonationsHTML <details>regl textureHello, npyjsHello protobufHello, pencil touchHello, LOESSHello html2canvaslegra mapscolor2cssHello, ecsy2D point distributionsHello, delatinThe gpu.js loopDijkstra’s shortest-path treeHello nojacko/Dijkstras-jsHello, tcort/dijkstrajsHello, lambdabaa/dijkstraHello, gpu.js v2
Hello jsqr
Hello qrcodeHello SharedArrayBufferHello GamePad APIHello vtk.jsHello nd4jsHello BiofabricTravelling with a self-organizing mapHello glitchHello UMAP-jsHello pandemoniumHello iocaneHello JSON-editorHello d3-griddingHello mljs/knnWorkerHello lalolibImage to GPU.jsImage to blink.jsTissot's indicatrixVega projectionsHello WebCLGLUsing d3-inertia with observableVideo contouring 3ngraph: pagerank, louvain…Union-FindPerceptron (simple statistics)mljsHello h3-jsEmoji FlagsHello, poisson-disk-sampling
Also listed in…
QRcode
Insert cell
Insert cell
jsQR = require("jsqr")
Insert cell
Insert cell
Insert cell
image = {
if (camera) {
const stream = navigator.mediaDevices
? navigator.mediaDevices.getUserMedia({ video: true })
: new Promise((y, n) => navigator.getUserMedia({ video: true }, y, n));
const video = html`<video autoplay=true playsinline=true></video>`;
video.style.maxWidth = "100%";
yield stream.then(stream => {
if ("srcObject" in video) video.srcObject = stream;
else video.src = URL.createObjectURL(stream);

invalidation.then(() => {
stream.getTracks().forEach(t => t.stop());
URL.revokeObjectURL(video.src);
});
return video;
});
while (true) {
yield video;
}
} else {
yield new Promise((resolve, reject) => {
const image = new Image();
image.onload = () => resolve(image);
image.onerror = reject;
image.crossOrigin = "anonymous";
image.src = url;
});
}
}
Insert cell
watcher = {
const r = jsQR(imageData.data, N, P);

if (r) mutable result = r;
}
Insert cell
Insert cell
mutable N = 600 // this could be informed by the camera (I suppose)
Insert cell
mutable P = 300
Insert cell
imageData = {
const width = N,
height = P;
const context = this ? this.context : DOM.context2d(width, height, 1);
context.drawImage(image, 0, 0, width, height);
const data = context.getImageData(0, 0, width, height);
data.context = context;
return data;
}
Insert cell
viewof url = html`<input style="width:100%;padding:4px;" value="https://cors-anywhere.herokuapp.com/https://hips.hearstapps.com/pop.h-cdn.co/assets/15/35/768x380/gallery-1440781189-wiki.png">`
Insert cell
import {checkbox} from "@jashkenas/inputs"
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more