我玩形狀檢測API(https://github.com/WICG/shape-detection-api),在此基礎上的例子:https://wicg.github.io/shape-detection-api/#examples形狀檢測API:「拋出:DOMException:源會玷污血統」
我試圖讓最簡單的工作:
let faceDetector = new FaceDetector({fastMode: true, maxDetectedFaces: 1});
// Assuming |theImage| is e.g. a <img> content, or a Blob.
faceDetector.detect(theImage)
.then(detectedFaces => {
for (const face of detectedFaces) {
console.log(' Face @ (${face.boundingBox.x}, ${face.boundingBox.y}),' +
' size ${face.boundingBox.width}x${face.boundingBox.height}');
}
}).catch(() => {
console.error("Face Detection failed, boo.");
})
然而,我正在錯誤:
VM153:1 Uncaught (in promise) DOMException: Source would taint origin.
與我使用圖像變量是來自計算器圖像中的一個:
<img src="https://www.gravatar.com/avatar/619aaf27f793d8ffdbc879c74884c0cc?s=32&d=identicon&r=PG" alt="" width="32" height="32" id="testimg">
我的瀏覽器是Google Chrome Canary 61.0.3128.0,啓用了實驗性Web功能。
我錯過了什麼嗎?