function preprocess(imageData) {
const {
width,
height,
data
} = imageData;
const dataTensor = ndarray(new Float32Array(data), [width, height, 4])
const dataProcessedTensor = ndarray(new Float32Array(width * height * 3), [width, height, 3])
//[0,255][0,1]
ops.divseq(dataTensor, 255)
//R
ops.assign(dataProcessedTensor.pick(null, null, 0), dataTensor.pick(null, null, 0))
//G
ops.assign(dataProcessedTensor.pick(null, null, 1), dataTensor.pick(null, null, 1))
//B
ops.assign(dataProcessedTensor.pick(null, null, 2), dataTensor.pick(null, null, 2))
const preprocessedData = dataProcessedTensor.data;
console.log("via process");
return preprocessedData;
}
< H1 > can"t find ndarray and ops. How can I quote them? Thank you < / H1 >