Git Product home page Git Product logo

depot-recognition's People

Contributors

tsuk1ko avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

zz1998022

depot-recognition's Issues

ImageData类型定义缺失

环境

node: v18.16.0
OS: win11

问题描述

在运行文档中给出的示例后,提示如下错误

PS C:\Users\DazeCake\Development\LittleHandy> node "c:\Users\DazeCake\Development\LittleHandy\app.js"
c:\Users\DazeCake\Development\LittleHandy\node_modules\@arkntools\depot-recognition\dist\index.js:380
  const imgData = new ImageData(new Uint8ClampedArray(img.bitmap.data), img.bitmap.width, img.bitmap.height);
                  ^

ReferenceError: ImageData is not defined
    at c:\Users\DazeCake\Development\LittleHandy\node_modules\@arkntools\depot-recognition\dist\index.js:380:19
    at Array.map (<anonymous>)
    at recognizeNumbers (c:\Users\DazeCake\Development\LittleHandy\node_modules\@arkntools\depot-recognition\dist\index.js:378:57)
    at DeportRecognizer.recognize (c:\Users\DazeCake\Development\LittleHandy\node_modules\@arkntools\depot-recognition\dist\index.js:546:30)
    at async c:\Users\DazeCake\Development\LittleHandy\app.js:29:22

Node.js v18.16.0

在vsc中尝试跳转可以跳转到位于本地路径~\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\lib.dom.d.ts中的此类型定义如下

/** The underlying pixel data of an area of a <canvas> element. It is created using the ImageData() constructor or creator methods on the CanvasRenderingContext2D object associated with a canvas: createImageData() and getImageData(). It can also be used to set a part of the canvas by using putImageData(). */
interface ImageData {
    readonly colorSpace: PredefinedColorSpace;
    /** Returns the one-dimensional array containing the data in RGBA order, as integers in the range 0 to 255. */
    readonly data: Uint8ClampedArray;
    /** Returns the actual dimensions of the data in the ImageData object, in pixels. */
    readonly height: number;
    /** Returns the actual dimensions of the data in the ImageData object, in pixels. */
    readonly width: number;
}

declare var ImageData: {
    prototype: ImageData;
    new(sw: number, sh: number, settings?: ImageDataSettings): ImageData;
    new(data: Uint8ClampedArray, sw: number, sh?: number, settings?: ImageDataSettings): ImageData;
};

可能的解决措施

或许可以手动实现此类型?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.