Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | 3x 3x 3x 3x 1x 3x 213x 209x 213x 212x 212x 209x 3x 1x 1x 1x 1x 3x 212x 212x 211x 211x 3x 212x | import { Image } from './Image'; import { ImageScanner } from './ImageScanner'; import { Symbol } from './Symbol'; const defaultScannerPromise = ImageScanner.create(); export const getDefaultScanner = async () => { return await defaultScannerPromise; }; const scanImage = async ( image: Image, scanner?: ImageScanner ): Promise<Array<Symbol>> => { if (scanner === undefined) { scanner = await defaultScannerPromise; } const res = scanner.scan(image); Iif (res < 0) { throw Error('Scan Failed'); } if (res === 0) return []; return image.getSymbols(); }; export const scanGrayBuffer = async ( buffer: ArrayBuffer, width: number, height: number, scanner?: ImageScanner ): Promise<Array<Symbol>> => { const image = await Image.createFromGrayBuffer(width, height, buffer); const res = await scanImage(image, scanner); image.destory(); return res; }; export const scanRGBABuffer = async ( buffer: ArrayBuffer, width: number, height: number, scanner?: ImageScanner ): Promise<Array<Symbol>> => { const image = await Image.createFromRGBABuffer(width, height, buffer); const res = await scanImage(image, scanner); image.destory(); return res; }; export const scanImageData = async ( image: ImageData, scanner?: ImageScanner ): Promise<Array<Symbol>> => { return await scanRGBABuffer( image.data.buffer, image.width, image.height, scanner ); }; |