How to generate raw features without edge impulse studio

Hello,

My Project already deploy with Web Assembly
when I run the browser/index.html I need to paste the raw features from edge impulse studio

Can I generate raw features image without uploading to edge impulse ??

Hi @zenaki yeah you just need to pull the pixels from an image (but it needs to be in the right width/height). Easiest to do it with a canvas. Something like this (from the top of my head!):

let imageWidth = 96;
let imageHeight = 96;

let img = new Image();
img.src = 'mypicture.png';
img.onload = () => {
    let canvas = document.createElement('canvas');
    let context = canvas.getContext('2d');

    context.drawImage(img, 0, 0, imageWidth, imageHeight);
    let imageData = context.getImageData(0, 0, imageWidth, imageHeight);
    let values = [];
    for (let ix = 0; ix < imageWidth * imageHeight; ix++) {
        values.push(Number((imageData.data[ix * 4] << 16)
            | (imageData.data[ix * 4 + 1] << 8)
            | (imageData.data[ix * 4 + 2])));
    }

    // values now contains all features
}
1 Like