Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions src/face-target/utils/types/face-target.d.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Estimator } from '../../face-geometry/estimator';

type EstimateResult = ReturnType<Estimator['estimate']>;
export type EstimateResult = ReturnType<Estimator['estimate']>;

interface IOnUpdateArgs {
export interface IOnUpdateArgs {
hasFace?: boolean;
estimateResult?: EstimateResult;
}

interface ThreeConstructor {
export interface ThreeConstructor {
container: HTMLDivElement;
uiLoading?: string;
uiScanning?: string;
Expand All @@ -17,13 +17,13 @@ interface ThreeConstructor {
shouldFaceUser?: boolean;
}

interface IAnchor {
export interface IAnchor {
group: THREE.Group;
landmarkIndex: number;
css: boolean;
}

type Matrix4Args = readonly [
export type Matrix4Args = readonly [
number,
number,
number,
Expand All @@ -41,5 +41,3 @@ type Matrix4Args = readonly [
number,
number
];

export type { ThreeConstructor, IAnchor, EstimateResult, IOnUpdateArgs, Matrix4Args };
21 changes: 6 additions & 15 deletions src/image-target/utils/types/compiler.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { INode } from './matching';

interface IMaximaMinimaPoint {
export interface IMaximaMinimaPoint {
maxima: boolean;
x: number;
y: number;
Expand All @@ -9,13 +9,13 @@ interface IMaximaMinimaPoint {
descriptors: number[];
}

type ImageDataWithScale = ImageData & { scale: number };
export type ImageDataWithScale = ImageData & { scale: number };

interface ITrackingFeature extends ImageDataWithScale {
export interface ITrackingFeature extends ImageDataWithScale {
points: Vector2[];
}

interface IKeyFrame {
export interface IKeyFrame {
maximaPoints: IMaximaMinimaPoint[];
minimaPoints: IMaximaMinimaPoint[];
maximaPointsCluster: {
Expand All @@ -29,28 +29,19 @@ interface IKeyFrame {
scale: number;
}

interface ICompilerData {
export interface ICompilerData {
targetImage: ImageData;
imageList: ImageDataWithScale[];
matchingData: IKeyFrame[];
trackingImageList: ImageDataWithScale[];
trackingData: ITrackingFeature[];
}

interface IDataList {
export interface IDataList {
targetImage: {
width: number;
height: number;
};
trackingData: ITrackingFeature[];
matchingData: IKeyFrame[];
}

export type {
IMaximaMinimaPoint,
ImageDataWithScale,
IKeyFrame,
ITrackingFeature,
ICompilerData,
IDataList,
};
24 changes: 7 additions & 17 deletions src/image-target/utils/types/controller.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ import { OneEuroFilter } from '../../../libs/one-euro-filter';
import { ON_UPDATE_EVENT, WORKER_EVENT } from '../constant/controller';
import { IKeyFrame, IMaximaMinimaPoint } from './compiler';

type WorkerEvent = typeof WORKER_EVENT[keyof typeof WORKER_EVENT];
export type WorkerEvent = typeof WORKER_EVENT[keyof typeof WORKER_EVENT];

type OnUpdateEvent = typeof ON_UPDATE_EVENT[keyof typeof ON_UPDATE_EVENT];
export type OnUpdateEvent = typeof ON_UPDATE_EVENT[keyof typeof ON_UPDATE_EVENT];

interface IOnUpdate {
export interface IOnUpdate {
type: typeof ON_UPDATE_EVENT[keyof typeof ON_UPDATE_EVENT];
targetIndex?: number | null;
worldMatrix?: number[] | null;
}

interface IControllerWorkerResult {
export interface IControllerWorkerResult {
SETUP: void;
MATCH: {
targetIndex: number;
Expand All @@ -24,7 +24,7 @@ interface IControllerWorkerResult {
};
}

interface IControllerWorker {
export interface IControllerWorker {
SETUP: {
type: typeof WORKER_EVENT.SETUP;
inputWidth: number;
Expand All @@ -46,7 +46,7 @@ interface IControllerWorker {
};
}

interface ITrackingState {
export interface ITrackingState {
showing: boolean;
isTracking: boolean;
currentModelViewTransform: number[][] | null;
Expand All @@ -56,17 +56,7 @@ interface ITrackingState {
trackingMatrix: number[] | null;
}

interface ITrackingCoords {
export interface ITrackingCoords {
screenCoords: Vector2[];
worldCoords: Vector3[];
}

export type {
WorkerEvent,
OnUpdateEvent,
IOnUpdate,
ITrackingState,
ITrackingCoords,
IControllerWorker,
IControllerWorkerResult,
};
8 changes: 3 additions & 5 deletions src/image-target/utils/types/detector.d.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { IMaximaMinimaPoint } from './compiler';

interface IMatches {
export interface IMatches {
querypoint: IMaximaMinimaPoint;
keypoint: IMaximaMinimaPoint;
}

interface ICrop {
export interface ICrop {
startX: number;
startY: number;
cropSize: number;
}

interface IDebugExtra {
export interface IDebugExtra {
pyramidImages: number[][];
dogPyramidImages: number[][] | null[][];
extremasResults: number[];
Expand All @@ -30,5 +30,3 @@ interface IDebugExtra {
goodTrack: number[];
trackedPoints: Vector2[];
}

export type { ICrop, IDebugExtra, IMatches };
23 changes: 3 additions & 20 deletions src/image-target/utils/types/image-target.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
import * as ICompiler from './compiler';
import * as IController from './controller';
import * as IEstimation from './estimation';
import * as IMatching from './matching';
import * as ITracker from './tracker';

interface ControllerConstructor {
export interface ControllerConstructor {
inputWidth: number;
inputHeight: number;
onUpdate?: ((data: IOnUpdate) => void) | null;
Expand All @@ -16,7 +10,7 @@ interface ControllerConstructor {
filterBeta?: number | null;
}

interface ThreeConstructor {
export interface ThreeConstructor {
container: HTMLDivElement;
imageTargetSrc: string;
maxTrack: number;
Expand All @@ -29,22 +23,11 @@ interface ThreeConstructor {
missTolerance?: number | null;
}

interface IAnchor {
export interface IAnchor {
group: THREE.Group;
targetIndex: number;
onTargetFound: (() => void) | null;
onTargetLost: (() => void) | null;
css: boolean;
visible: boolean;
}

export type {
ICompiler,
IController,
IEstimation,
IMatching,
ITracker,
ControllerConstructor,
ThreeConstructor,
IAnchor,
};
10 changes: 4 additions & 6 deletions src/image-target/utils/types/matching.d.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
import { createRandomizer } from '../randomizer';

interface INode {
export interface INode {
leaf: boolean;
centerPointIndex: number | null;
pointIndexes: number[];
children: INode[];
}

interface IQueryBinLocation {
export interface IQueryBinLocation {
binX: number;
binY: number;
binAngle: number;
binScale: number;
}

interface INodeQueue {
export interface INodeQueue {
node: INode;
d: number;
}

type RandomizerType = ReturnType<typeof createRandomizer>;

export type { INode, RandomizerType, IQueryBinLocation, INodeQueue };
export type RandomizerType = ReturnType<typeof createRandomizer>;
10 changes: 4 additions & 6 deletions src/image-target/utils/types/tracker.d.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { CumulativeSum } from '../../utils/cumsum';

interface IBaseOptions {
export interface IBaseOptions {
image: ImageData;
imageDataCumsum: CumulativeSum;
imageDataSqrCumsum: CumulativeSum;
sdThresh: number;
}

interface IOptions extends IBaseOptions {
export interface IOptions extends IBaseOptions {
featureMap: Float32Array;
templateSize: number;
searchSize: number;
Expand All @@ -16,14 +16,12 @@ interface IOptions extends IBaseOptions {
minSimThresh: number;
}

interface ISimiliarityOptions extends Omit<IBaseOptions, 'sdThresh'> {
export interface ISimiliarityOptions extends Omit<IBaseOptions, 'sdThresh'> {
cx: number;
cy: number;
tx: number;
ty: number;
vlen: number;
}

interface ITemplateOptions extends IBaseOptions, Pick<ISimiliarityOptions, 'cx' | 'cy'> {}

export type { IOptions, ISimiliarityOptions, ITemplateOptions };
export interface ITemplateOptions extends IBaseOptions, Pick<ISimiliarityOptions, 'cx' | 'cy'> {}