亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

ndarray和ops怎么樣才能在瀏覽器中引入并處理圖片data

ndarray和ops怎么樣才能在瀏覽器中引入并處理圖片data

呼如林 2019-03-12 13:15:38
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 請問我該如何引用 ?謝謝 謝謝
查看完整描述

1 回答

?
慕斯王

TA貢獻1864條經驗 獲得超2個贊

scijs/ndarray,用npm安裝,然后通過browserify在瀏覽器使用。


查看完整回答
反對 回復 2019-04-03
  • 1 回答
  • 0 關注
  • 120 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號