初次提交
This commit is contained in:
14
src/cv/common.ts
Normal file
14
src/cv/common.ts
Normal file
@ -0,0 +1,14 @@
|
||||
import { getAddon, getConfig } from "./addon";
|
||||
import { Mat } from "./mat";
|
||||
|
||||
export type TypedArray = Uint8Array | Int8Array | Uint16Array | Int16Array | Uint32Array | Int32Array | BigUint64Array | BigInt64Array | Float32Array | Float64Array
|
||||
|
||||
export function FromCV(mat: any): Mat { return new (Mat as any)(mat); }
|
||||
export function M(mat: Mat) { return (mat as any).__mat__; }
|
||||
export function C(name: Parameters<typeof getConfig>[0]) { return getConfig(name); }
|
||||
|
||||
export function resolveArgs<R extends Array<any>>(args: any[], checker: boolean | (() => boolean)): R {
|
||||
if (typeof checker === "function") checker = checker();
|
||||
if (checker) return args as R;
|
||||
return [args[0], new Mat(), ...args.slice(1)] as R;
|
||||
}
|
Reference in New Issue
Block a user