使用服务器文件中的图像时我有同样的问题(加载比本地文件慢)。这是我的修复(从大约 16568 的行号):
if (time = new Date().getTime(), $$.is("img")) {
source = new Image(), source.src = $$.attr("src"),
source.crossOrigin = $$.attr("crossorigin");
$(source).load(function () {
canvas = ccv.pre(source);
options.grayscale && (canvas = ccv.grayscale(canvas, source));
try {
options.async && window.Worker ? ccv.detect_objects({
canvas: canvas,
cascade: cascade,
interval: options.interval,
min_neighbors: options.minNeighbors,
worker: 1,
async: !0
})(done) : done(ccv.detect_objects({
canvas: canvas,
cascade: cascade,
interval: options.interval,
min_neighbors: options.minNeighbors
}));
} catch (e) {
options.error.apply($$, [2, e.message]), options.complete.apply($$, [!1]);
}
});
return this;
}