Comments (8)
@jamesmfriedman, please check out the latest release (0.3.8), which added the Typescript support.
from gammacv.
^ plus you get the benefit of being able to specify multiple output formats for different environments.
Currently, my open src project RMWC supports ES and ESNext out of the box. Transpilation for the win. https://jamesmfriedman.github.io/rmwc/
from gammacv.
We have a little progress to add a ts definitions https://github.com/PeculiarVentures/GammaCV/blob/basic-typings/lib/index.d.ts
I'll try to finish up it ASAP
from gammacv.
Moving to TS vs just having types would be good and we would be open to working with you on that change.
Also extensions to the library would also be potentially welcome. Let us know what you’ve added.
from gammacv.
I've done a couple of massive js to ts overhauls at this point. It looks like a lot of it would just be moving your current jsdoc comments to proper typescript types. I'd be happy to make a branch and get the boilerplate handled so it can start being iterated on.
Other than that I've just been lazily adding types where I've needed them.
declare module 'gammacv/dist' {
export class Operation {}
export class Session {
init(input: Tensor | Operation): void;
runOp(
/** operation to run */
op: Tensor | Operation,
/** context of a run, passing the same context twice in a row will use cached result */
ctx: any,
/** if passed, the output is put into it. */
output?: Tensor
): void;
}
export class Tensor {
constructor(
/** the data type for tensor instance */
dtype: string,
/** the list of integers */
shape: ShapeT,
/** initial data to store */
data?: number[],
/** custom mapping from plain to NDArray */
stride?: number[],
/** number of data elements to skip */
offset?: number
);
data: Uint8Array;
dtype: string;
shape: ShapeT;
size: number;
stride: ShapeT;
get: (x: number, y: number, z: number) => number;
}
export class Line {
static Intersection(l1: Line, l2: Line): TupleT | false;
fromParallelCoords(
x: number,
y: number,
w: number,
h: number,
maxDistance: number,
maxAngles: number
): void;
x1: number;
y1: number;
x2: number;
y2: number;
px: number;
py: number;
length: number;
angle: number;
}
export class Rect {
constructor(...args: number[]);
}
type ShapeT = [number, number, number];
type TupleT = [number, number];
export const imageTensorFromURL: (
imgSrc: string,
type?: string,
size?: ShapeT,
cors?: boolean
) => Promise<Tensor>;
export const grayscale: (
/** The source image to be grayscale. */
tSrc: Tensor
) => Tensor;
export const downsample: (
/** The source image to be downsampled. */
tSrc: Tensor,
/** Downsampling coefficient. */
downsampleCoefficient?: number,
/** Downsampling support two possible variants of processing. */
type?: 'max' | 'mean'
) => Tensor;
export const upsample: (
/** The source image to be downsampled. */
tSrc: Tensor,
/** Upsampling coefficient. */
upsampleCoefficient?: number,
/** Downsampling support two possible variants of processing. */
interpolation?: 'nearest' | 'linear'
) => Tensor;
export const norm: (
/** Input data */
tSrc: Tensor,
/** Normalization type */
type: 'l2' | 'minmax',
/** Number of layers for a parallel reduction */
parallelReductionLayers?: number
) => Tensor;
export const gaussianBlur: (
/** Input data */
tSrc: Tensor,
/** Size of the kernel. */
kernelSize: number,
/** Sigma coeficient value. */
sigma: number
) => Tensor;
export const morphologyEx: (
/** Input data */
tSrc: Tensor,
/** Operation type. */
type?: 'open' | 'close' | 'gradient' | 'tophat' | 'blackhat',
/** Size structure of element. */
kernelSize?: TupleT,
/** Optional Kernel */
tKernel?: Tensor
) => Tensor;
export const sobelOperator: (
/** The source image. */
tSrc: Tensor
) => Tensor;
export const cannyEdges: (
/** Input data */
tSrc: Tensor,
/** The low threshold to be applied. */
lowThreshold: number,
/** The high threshold to be applied. */
highThreshold: number
) => Tensor;
export const dilate: (
/** Input data */
tSrc: Tensor,
/** Size of the kernel. */
kernelSize: TupleT,
/** Optional kernel. */
tKernel?: Tensor
) => Tensor;
export const pcLinesEnhance: (
/** The source image. */
tSrc: Tensor
) => Tensor;
export const pcLines: (
/** Image edges image should be binarized to [0, 1], could be used with Canny Edges. */
tSrc: Tensor,
/** count of parallel reduction layers. */
layers?: number,
/** discretization step */
dStep?: number,
/** reduction coefficient */
downsampleCoefficient?: number
) => Tensor;
export const canvasFromTensor: (
canvas: HTMLCanvasElement,
tSrc: Tensor,
rgba?: boolean,
transposed?: boolean
) => void;
export const canvasDrawLine: (
canvas: HTMLCanvasElement,
line: Line,
color?: string,
width?: number
) => void;
export const tensorFrom: (
input: Tensor | Operation,
cast?: boolean
) => Tensor;
export const generateTransformMatrix: (
/** A rectangle */
rect: Rect,
/** this is an output shape you want to have [height, width], e.g you want your quadrilateral to be fixed to a rectangle with width 640 and height 480 */
dstBounds: TupleT,
/** we can use a placeholder instead of returning a new Tensor, because we want to reuse already allocated memory, and change the value from a call to call without reconstructing the graph */
transformMatrix?: Tensor,
/** Amount to pad */
pad?: number
) => Tensor;
export const perspectiveProjection: (
tSrc: Tensor,
tTransformMatrix: Tensor,
shape?: ShapeT,
dType?: string
) => Tensor;
}
from gammacv.
Please do
from gammacv.
@jamesmfriedman @WorldThirteen could we close it?
from gammacv.
Yeah, thanks guys!
from gammacv.
Related Issues (20)
- Explanation needed about Line HOT 2
- CaptureVideo class still use check for deprecated API
- Does GammaCV support color detection and tracking? HOT 1
- Cropping HOT 2
- OES_texture_float is not supported on Android Mali GPU's HOT 1
- CI test flow stoped working
- Local tests does't work on Chrome >= 96
- Is GammaCV available as a .js module?
- How to run canny edge detection in gammacv as a webpage? HOT 1
- Error with pcLines HOT 2
- Perspective transform broken on some iOS devices HOT 2
- Feature Description Algorithms HOT 3
- StrokeWidthTransform (swt) example HOT 6
- Maybe just a dumb doubt HOT 3
- Sry for distrub HOT 4
- Spell mistake? HOT 2
- Not getting correct lines. HOT 1
- The use of eval causes problems for bundlers and minification, use new Function instead. HOT 2
- Enable gammaCV to work in webworkers HOT 1
- Types mistake HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gammacv.