Public
Edited
Mar 28, 2024
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
input = {
const baseUrl =
"https://raw.githubusercontent.com/mapbox/pixelmatch/master/test/fixtures/";
const img1 = images.startimage;
const img2 = images[`currentimage_${sample}`];
const { width: w, height: h } = img1;

const ctx = DOM.context2d(w, h, 1);
ctx.drawImage(img1, 0, 0);
const data1 = ctx.getImageData(0, 0, w, h).data;
ctx.drawImage(img2, 0, 0);
const data2 = ctx.getImageData(0, 0, w, h).data;
const diff = ctx.createImageData(w, h);

return { img1, img2, w, h, data1, data2, ctx, diff };
}
Insert cell
Insert cell
images = {
const images = {
currentimage_105: await FileAttachment("currentImage_105@1.jpg").image(),
startimage: await FileAttachment("startImage.jpg").image(),
currentimage_305: await FileAttachment("currentImage_305.jpg").image(),
currentimage_290: await FileAttachment("currentImage_290.jpg").image(),
currentimage_265: await FileAttachment("currentImage_265.jpg").image(),
currentimage_245: await FileAttachment("currentImage_245.jpg").image(),
currentimage_205: await FileAttachment("currentImage_205.jpg").image(),
currentimage_185: await FileAttachment("currentImage_185.jpg").image(),
currentimage_25: await FileAttachment("currentImage_25.jpg").image(),
currentimage_150: await FileAttachment("currentImage_150.jpg").image(),
currentimage_170: await FileAttachment("currentImage_170.jpg").image(),
currentimage_240: await FileAttachment("currentImage_240.jpg").image()
};

return images;
}
Insert cell
Insert cell
Insert cell
threshold
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more