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;? ? }? ?找不到 ndarray 和 ops 請問我該如何引用 ?謝謝 謝謝
ndarray和ops怎么樣才能在瀏覽器中引入并處理圖片data
呼如林
2019-03-12 13:15:38