我在 youtube https://www.youtube.com/watch?v=FfHilvUc25c上使用本教程中的 face_detection 库或 API 我尝试过同样的事情,但我收到了画布已被跨源数据污染的错误。我的 index.html 中没有画布。
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="jquery.facedetection.min.js"></script>
<script>
$(document).ready(function(){
$('#picture').faceDetection({
complete: function (faces) {
console.log(faces);
}
});
})
</script>
<img id="picture" src="img/face1.jpg">
我期待在控制台中获得一个数组,但除了显示“未捕获的 DOMException:无法在 'CanvasRenderingContext2D' 上执行 'getImageData':画布已被跨域数据污染”的错误外,没有打印任何内容。
相关分类