为什么人群HTML会破坏此图像?

问题描述

我正在使用Crowd HTML Elements执行边界框注释,但是当我尝试加载一些图像时,在开发工具控制台中出现此错误

crowd-html-elements.js:1 window.onError received an event without an error:  {event: ErrorEvent}
(anonymous) @ crowd-html-elements.js:1
error (async)
e @ crowd-html-elements.js:1
e @ crowd-html-elements.js:1
./src/crowd-html-elements-loader.ts @ crowd-html-elements.js:1
s @ crowd-html-elements.js:1
(anonymous) @ crowd-html-elements.js:1
(anonymous) @ crowd-html-elements.js:1
crowd-html-elements-without-ce-polyfill.js:6282 window.onError received an event without an error:  {event: ErrorEvent}
(anonymous) @ crowd-html-elements-without-ce-polyfill.js:6282
error (async)
e @ crowd-html-elements-without-ce-polyfill.js:6282
e @ crowd-html-elements-without-ce-polyfill.js:6282
./src/index.ts @ crowd-html-elements-without-ce-polyfill.js:6282
r @ crowd-html-elements-without-ce-polyfill.js:1
(anonymous) @ crowd-html-elements-without-ce-polyfill.js:1
(anonymous) @ crowd-html-elements-without-ce-polyfill.js:1
crowd-html-elements-without-ce-polyfill.js:6282 Uncaught Error: Unexpected image dimensions during normalization
    at Function.normalizeHeight (crowd-html-elements-without-ce-polyfill.js:6282)
    at Function.normalizeDimensions (crowd-html-elements-without-ce-polyfill.js:6282)
    at new a (crowd-html-elements-without-ce-polyfill.js:6282)
    at ie.handleTargetimageLoaded (crowd-html-elements-without-ce-polyfill.js:6282)
    at Image.r.onload (crowd-html-elements-without-ce-polyfill.js:6282)
normalizeHeight @ crowd-html-elements-without-ce-polyfill.js:6282
normalizeDimensions @ crowd-html-elements-without-ce-polyfill.js:6282
a @ crowd-html-elements-without-ce-polyfill.js:6282
handleTargetimageLoaded @ crowd-html-elements-without-ce-polyfill.js:6282
r.onload @ crowd-html-elements-without-ce-polyfill.js:6282
load (async)
setBackgroundImage @ crowd-html-elements-without-ce-polyfill.js:6282
renderImageSrcChange @ crowd-html-elements-without-ce-polyfill.js:6282
shouldComponentUpdate @ crowd-html-elements-without-ce-polyfill.js:6282
q @ crowd-html-elements-without-ce-polyfill.js:6278
B @ crowd-html-elements-without-ce-polyfill.js:6278
q @ crowd-html-elements-without-ce-polyfill.js:6278
B @ crowd-html-elements-without-ce-polyfill.js:6278
F @ crowd-html-elements-without-ce-polyfill.js:6278
N @ crowd-html-elements-without-ce-polyfill.js:6278
E @ crowd-html-elements-without-ce-polyfill.js:6278
N @ crowd-html-elements-without-ce-polyfill.js:6278
E @ crowd-html-elements-without-ce-polyfill.js:6278
N @ crowd-html-elements-without-ce-polyfill.js:6278
E @ crowd-html-elements-without-ce-polyfill.js:6278
N @ crowd-html-elements-without-ce-polyfill.js:6278
T @ crowd-html-elements-without-ce-polyfill.js:6278
q @ crowd-html-elements-without-ce-polyfill.js:6278
B @ crowd-html-elements-without-ce-polyfill.js:6278
F @ crowd-html-elements-without-ce-polyfill.js:6278
N @ crowd-html-elements-without-ce-polyfill.js:6278
T @ crowd-html-elements-without-ce-polyfill.js:6278
G @ crowd-html-elements-without-ce-polyfill.js:6278
w @ crowd-html-elements-without-ce-polyfill.js:6278
S @ crowd-html-elements-without-ce-polyfill.js:6278
e.reactMount @ crowd-html-elements-without-ce-polyfill.js:3
e.updateRegion @ crowd-html-elements-without-ce-polyfill.js:3
(anonymous) @ crowd-html-elements-without-ce-polyfill.js:3
(anonymous) @ crowd-html-elements-without-ce-polyfill.js:3
(anonymous) @ crowd-html-elements-without-ce-polyfill.js:3
e.reactBatchUpdate @ crowd-html-elements-without-ce-polyfill.js:3
i @ crowd-html-elements-without-ce-polyfill.js:3
f.componentDidUpdate @ crowd-html-elements-without-ce-polyfill.js:3
q @ crowd-html-elements-without-ce-polyfill.js:6278
B @ crowd-html-elements-without-ce-polyfill.js:6278
F @ crowd-html-elements-without-ce-polyfill.js:6278
N @ crowd-html-elements-without-ce-polyfill.js:6278
E @ crowd-html-elements-without-ce-polyfill.js:6278
N @ crowd-html-elements-without-ce-polyfill.js:6278
E @ crowd-html-elements-without-ce-polyfill.js:6278
N @ crowd-html-elements-without-ce-polyfill.js:6278
T @ crowd-html-elements-without-ce-polyfill.js:6278
q @ crowd-html-elements-without-ce-polyfill.js:6278
B @ crowd-html-elements-without-ce-polyfill.js:6278
q @ crowd-html-elements-without-ce-polyfill.js:6278
B @ crowd-html-elements-without-ce-polyfill.js:6278
q @ crowd-html-elements-without-ce-polyfill.js:6278
B @ crowd-html-elements-without-ce-polyfill.js:6278
q @ crowd-html-elements-without-ce-polyfill.js:6278
B @ crowd-html-elements-without-ce-polyfill.js:6278
F @ crowd-html-elements-without-ce-polyfill.js:6278
N @ crowd-html-elements-without-ce-polyfill.js:6278
E @ crowd-html-elements-without-ce-polyfill.js:6278
N @ crowd-html-elements-without-ce-polyfill.js:6278
T @ crowd-html-elements-without-ce-polyfill.js:6278
G @ crowd-html-elements-without-ce-polyfill.js:6278
w @ crowd-html-elements-without-ce-polyfill.js:6278
_renderReactComponent @ crowd-html-elements-without-ce-polyfill.js:6282
_updateReactComponent @ crowd-html-elements-without-ce-polyfill.js:6282
Y @ crowd-html-elements-without-ce-polyfill.js:5984
C @ crowd-html-elements-without-ce-polyfill.js:5984
k @ crowd-html-elements-without-ce-polyfill.js:5984
_propertiesChanged @ crowd-html-elements-without-ce-polyfill.js:5984
_flushProperties @ crowd-html-elements-without-ce-polyfill.js:5954
_flushProperties @ crowd-html-elements-without-ce-polyfill.js:5984
_invalidateProperties @ crowd-html-elements-without-ce-polyfill.js:5984
_setProperty @ crowd-html-elements-without-ce-polyfill.js:5984
Object.defineProperty.set @ crowd-html-elements-without-ce-polyfill.js:5954
(anonymous) @ labeling.html:199
async function (async)
(anonymous) @ labeling.html:198
Promise.then (async)
(anonymous) @ labeling.html:196

在归一化期间出现的意外的图像尺寸部分似乎是问题所在,但我没有发现任何有关故障排除的信息。有人可以解释期望的图像尺寸是什么,为什么有些图像会失败?

这是引发错误代码段。

            static normalizeHeight(e) {
                if (e.height === e.naturalHeight)
                    return e.height;
                if (e.height === e.naturalWidth)
                    return e.height;
                if (Math.abs(e.height - e.naturalHeight) < 2)
                    return e.naturalHeight;
                if (Math.abs(e.height - e.naturalWidth) < 2)
                    return e.naturalWidth;
                throw new Error("Unexpected image dimensions during normalization")
            }
            static normalizeWidth(e) {
                if (e.width === e.naturalWidth)
                    return e.width;
                if (e.width === e.naturalHeight)
                    return e.width;
                if (Math.abs(e.width - e.naturalWidth) < 2)
                    return e.naturalWidth;
                if (Math.abs(e.width - e.naturalHeight) < 2)
                    return e.naturalHeight;
                throw new Error("Unexpected image dimensions during normalization")

谢谢!

解决方法

事实证明,该问题与应用于网站的画布部分(用于加载标签工具)的css样式有关。