@privateid/cryptonets-web-sdk
Advanced tools
Comparing version 2.0.34-alpha to 2.0.35-alpha
@@ -646,3 +646,3 @@ /* eslint-disable default-param-last */ | ||
if (isDocument) { | ||
result = yield scanDocument(imageData, isSimd, cb, debugType); | ||
result = yield scanDocument(imageData, isSimd, cb, { input_image_format: "rgba" }, debugType); | ||
} | ||
@@ -649,0 +649,0 @@ else { |
@@ -80,3 +80,3 @@ export declare type Base64 = ArrayBuffer | string; | ||
}>; | ||
scanDocument: (imageInput: ImageData, simd: boolean, cb: any, debug_type: string) => Promise<{ | ||
scanDocument: (imageInput: ImageData, simd: boolean, cb: any, config?: any, debug_type?: string) => Promise<{ | ||
result: number; | ||
@@ -83,0 +83,0 @@ href: ImageData[]; |
@@ -19,3 +19,3 @@ import { Base64, ImageType, LOGTYPE } from './types'; | ||
voiceData: Uint8ClampedArray; | ||
}>, scanDocument: (imageInput: ImageData, simd: boolean, cb: any, debug_type: string) => Promise<{ | ||
}>, scanDocument: (imageInput: ImageData, simd: boolean, cb: any, config?: any, debug_type?: string) => Promise<{ | ||
result: number; | ||
@@ -22,0 +22,0 @@ href: ImageData[]; |
@@ -5,3 +5,3 @@ { | ||
"description": "CryptoNets WebAssembly SDK", | ||
"version": "2.0.34-alpha", | ||
"version": "2.0.35-alpha", | ||
"keywords": [ | ||
@@ -8,0 +8,0 @@ "Face recognition", |
@@ -275,3 +275,3 @@ /* eslint-disable no-eval */ | ||
const scanDocument = async (imageInput, simd, cb, debug_type = 0) => | ||
const scanDocument = async (imageInput, simd, cb, config = {}, debug_type = 0) => | ||
new Promise(async (resolve, reject) => { | ||
@@ -287,2 +287,9 @@ privid_wasm_result = cb; | ||
const encoder = new TextEncoder(); | ||
const config_bytes = encoder.encode(`${config}\0`); | ||
const configInputSize = config.length; | ||
const configInputPtr = wasmPrivModule._malloc(configInputSize); | ||
wasmPrivModule.HEAP8.set(config_bytes, configInputPtr / config_bytes.BYTES_PER_ELEMENT); | ||
const { data: imageData } = imageInput; | ||
@@ -318,2 +325,4 @@ const imageInputSize = imageData.length * imageData.BYTES_PER_ELEMENT; | ||
resultLenPtr, | ||
configInputPtr, | ||
configInputSize | ||
); | ||
@@ -320,0 +329,0 @@ } catch (err) { |
Sorry, the diff of this file is not supported yet
48728970
15399