diff --git a/404.html b/404.html index ed376301..34b02300 100644 --- a/404.html +++ b/404.html @@ -1,5 +1,5 @@ GammaCV
GammaCV Logo
DocsExamplesGitHub

404

Page not found

GammaCV Logo
DocsExamplesGitHub

404

Page not found

GammaCV Logo
DocsExamplesGitHub
GammaCV Logo
DocsExamplesGitHub
GammaCV Logo
DocsExamplesGitHub

AdaptiveThreshold

Description

Applies an adaptive threshold to the input image, + window.__HELPUKRAINEWIDGET_DISABLE_ANALYICS = true;

GammaCV Logo
DocsExamplesGitHub

AdaptiveThreshold

Description

Applies an adaptive threshold to the input image, threshold will be applied to the given channel. -Original paper

Params
tSrcTensorThe source to be thresholded.
uS?numberSize of the avarange box
threshold?numberPercent of the diff to mark black in range 0-100
channel?numberChannel to be applied
tIntegralImage?Tensorsummed area table of the input
Example
gm.adaptiveThreshold(inputImage);
GammaCV Logo
DocsExamplesGitHub

CannyEdges

Description

The Canny edge detector is an edge detection operator that uses + window.__HELPUKRAINEWIDGET_DISABLE_ANALYICS = true;

GammaCV Logo
DocsExamplesGitHub

CannyEdges

Description

The Canny edge detector is an edge detection operator that uses a multi-stage algorithm to detect a wide range of edges in images. -Read more on Wiki.

Params
sobelTensoroutput of SobelOperator.
lownumberLow threshold to be applied.
highnumberHigh threshold to be applied.
Example
gm.cannyEdges(inputImage, 0.25, 0.75);
GammaCV Logo
DocsExamplesGitHub

ColorSegmentation

Description

Color segmentation of given image with simple Euclidian + window.__HELPUKRAINEWIDGET_DISABLE_ANALYICS = true;

GammaCV Logo
DocsExamplesGitHub

ColorSegmentation

Description

Color segmentation of given image with simple Euclidian distance estimation.

Params
tSrcTensorCurrent frame.
clustersnumberNumber of clusters the input image to be clustered.
Example
// segmentation of input image to 5 clusters
- gm.colorSegmentation(inputImage, 5);
GammaCV Logo
DocsExamplesGitHub

Concat

Description

Concat two inputs in one image

Params
tATensorThe first input
tBTensorThe second input
mask?Array.<string>Array that should describe the needed output.
This should be an array of strings in format "{number of input}.{vector component}",
see example for more.

⚠️ STILL UNDER DEVELOPMENT (EXPERIMENTAL, API COULD BE CHANGED OR DEPRECATED)
Example
gm.concat(inputImage1, inputImage2, ['1.r', '1.g', '2.b', '2.a']);
GammaCV Logo
DocsExamplesGitHub

Concat

Description

Concat two inputs in one image

Params
tATensorThe first input
tBTensorThe second input
mask?Array.<string>Array that should describe the needed output.
This should be an array of strings in format "{number of input}.{vector component}",
see example for more.

⚠️ STILL UNDER DEVELOPMENT (EXPERIMENTAL, API COULD BE CHANGED OR DEPRECATED)
Example
gm.concat(inputImage1, inputImage2, ['1.r', '1.g', '2.b', '2.a']);
GammaCV Logo
DocsExamplesGitHub

Contributing to GammaCV

From opening a bug report to creating a pull request: every contribution is appreciated and welcome. If you're planning to implement a new feature or change the api please create an issue first.

Bug report

A good bug report shouldn't leave others needing to chase you for more information. Please try to be as detailed as possible in your report.

Give feedback on issues

Some issues are created without important information. Help make them easier to resolve by adding any relevant information.

Fix bugs and implement features

Confirmed bugs and ready-to-implement features are marked with the help wanted label. Post a comment on an issue to indicate you would like to work on it.

Documentation

We greatly appreciate any time spent fixing typos or clarifying sections in the documentation.

Submitting Changes

After getting some feedback, push to your fork and submit a pull request. We may suggest some changes or improvements or alternatives, but for small changes your pull request should be accepted quickly.

Some things that will increase the chance that your pull request is accepted:

  • Write tests
  • Follow the existing coding style, check with npm run lint
  • Write a good commit message
GammaCV Logo
DocsExamplesGitHub

Contributing to GammaCV

From opening a bug report to creating a pull request: every contribution is appreciated and welcome. If you're planning to implement a new feature or change the api please create an issue first.

Bug report

A good bug report shouldn't leave others needing to chase you for more information. Please try to be as detailed as possible in your report.

Give feedback on issues

Some issues are created without important information. Help make them easier to resolve by adding any relevant information.

Fix bugs and implement features

Confirmed bugs and ready-to-implement features are marked with the help wanted label. Post a comment on an issue to indicate you would like to work on it.

Documentation

We greatly appreciate any time spent fixing typos or clarifying sections in the documentation.

Submitting Changes

After getting some feedback, push to your fork and submit a pull request. We may suggest some changes or improvements or alternatives, but for small changes your pull request should be accepted quickly.

Some things that will increase the chance that your pull request is accepted:

  • Write tests
  • Follow the existing coding style, check with npm run lint
  • Write a good commit message
GammaCV Logo
DocsExamplesGitHub

Convolution

Description

Doing convlolution between a kernel and an image, -see wiki.

Params
tSrcTensorThe source image to be convolved.
tKernelTensorKernel body, tensor with shape [n, m, 4],
where alpha component of each pixel is kernel cell value.
factor?numbera scaling quantity that is multiplied by the result
bias?numberis added on after the factor has been accounted for
Example
gm.conv2d(inputImage, gm.kernels.boxBlur());
GammaCV Logo
DocsExamplesGitHub

Convolution

Description

Doing convlolution between a kernel and an image, +see wiki.

Params
tSrcTensorThe source image to be convolved.
tKernelTensorKernel body, tensor with shape [n, m, 4],
where alpha component of each pixel is kernel cell value.
factor?numbera scaling quantity that is multiplied by the result
bias?numberis added on after the factor has been accounted for
Example
gm.conv2d(inputImage, gm.kernels.boxBlur());
GammaCV Logo
DocsExamplesGitHub

Create Operation

When building graphs using GammaCV, you may want to create a new Operation. This article will describe how to create your own Operation.

Prerequisites

This document assumes familiarity with the fundamentals of GammaCV introduced in the Core Concepts section of Getting Started. We recommend completing Core Concepts before reading this tutorial.

Name operation

To create a shell your operation, you simply need to use RegisterOperation

import * as gm from 'gammacv';
+ window.__HELPUKRAINEWIDGET_DISABLE_ANALYICS = true;
GammaCV Logo
DocsExamplesGitHub

Create Operation

When building graphs using GammaCV, you may want to create a new Operation. This article will describe how to create your own Operation.

Prerequisites

This document assumes familiarity with the fundamentals of GammaCV introduced in the Core Concepts section of Getting Started. We recommend completing Core Concepts before reading this tutorial.

Name operation

To create a shell your operation, you simply need to use RegisterOperation

import * as gm from 'gammacv';
 
 const myOperation = new gm.RegisterOperation('MyOp')

Describe inputs and output

Inputs

You can append input using .Input(name <string>, dtype <string>)

const myOperation = new gm.RegisterOperation('MyOp')
   .Input('src', 'uint8')

This code appends input named src and described it as unsigned byte datatype. @@ -92,7 +92,7 @@ return vec4(data.r * uMultiplier, FILL, FILL, FILL); // will return around vec4(0.78 * 0.5 = 0.39, 1.0, 1.0, 1.0) // that will be viewed in uint8 as vec4(100, 255, 255, 255).` -}

Running this operation will output tensor with next data: [100, 255, 255, 255].

GammaCV Logo
DocsExamplesGitHub

Dilation

Description

Dilation is one of the basic operations in mathematical morphology. + window.__HELPUKRAINEWIDGET_DISABLE_ANALYICS = true;

GammaCV Logo
DocsExamplesGitHub

Dilation

Description

Dilation is one of the basic operations in mathematical morphology. Originally developed for binary images, it has been expanded first to grayscale images, and then to complete lattices. The dilation operation usually uses a structuring element for probing and expanding the shapes contained in the input image. -Wiki

Params
tSrcTensorThe source image to be downsampled.
kernelSizeArray.<number>Size of structure element.
tKernelTensorOptional kernel.
Example
gm.dilate(inputImage, [3, 3]);
GammaCV Logo
DocsExamplesGitHub

Downsample

Description

Performance is always important, but some algorithms are very expensive to apply + window.__HELPUKRAINEWIDGET_DISABLE_ANALYICS = true;

GammaCV Logo
DocsExamplesGitHub

Downsample

Description

Performance is always important, but some algorithms are very expensive to apply to large picture sizes. To accommodate for this in Computer Vision we often need reduce an original image to a smaller size before we apply a given algorithm.

Params
tSrcTensorThe source image to be downsampled.
coefficientnumberDownsampling coefficient.
type?stringDownsampling support two possible variants of processing
pixels to be downsampled 'bicubic', 'nearest'.
Example
// this line reduces an input image in 3x
- gm.downsample(inputImage, 3, 'nearest');
GammaCV Logo
DocsExamplesGitHub

Erosion

Description

Erosion is one of two fundamental operations (the other being dilation) + window.__HELPUKRAINEWIDGET_DISABLE_ANALYICS = true;

GammaCV Logo
DocsExamplesGitHub

Erosion

Description

Erosion is one of two fundamental operations (the other being dilation) in morphological image processing from which all other morphological operations are based. It was originally defined for binary images, later being extended to grayscale images, and subsequently to complete lattices. -Wiki

Params
tSrcTensorThe source image to be downsampled.
kernelSizeArray.<number>Size of structure element.
tKernelTensorOptional kernel.
Example
gm.erode(inputImage, [3, 3]);
GammaCV Logo
DocsExamplesGitHub

GaussianBlur

Description

This operation is default blur operation which actually -convolution with Gaussian kernel.

Params
tSrcTensorThe source image to be grayscaled.
kernelSizenumberSize of the kernel.
sigmanumberSigma coeficient value.
Example
gm.gaussianBlur(inputImage, 5, 3);
GammaCV Logo
DocsExamplesGitHub

GaussianBlur

Description

This operation is default blur operation which actually +convolution with Gaussian kernel.

Params
tSrcTensorThe source image to be grayscaled.
kernelSizenumberSize of the kernel.
sigmanumberSigma coeficient value.
Example
gm.gaussianBlur(inputImage, 5, 3);
GammaCV Logo
DocsExamplesGitHub

Get Started

The library is a high-level abstraction API to create and run operations on different backends (WebGL, WASM, JS). GammaCV also enables you to construct operation graphs and control the flow of execution.

Installation

To use GammaCV you first need to install it. + window.__HELPUKRAINEWIDGET_DISABLE_ANALYICS = true;

GammaCV Logo
DocsExamplesGitHub

Get Started

The library is a high-level abstraction API to create and run operations on different backends (WebGL, WASM, JS). GammaCV also enables you to construct operation graphs and control the flow of execution.

Installation

To use GammaCV you first need to install it. To install the latest stable version run: npm install gammacv --save

Core Concepts

To use GammaCV, you need to understand three core concepts: tensors, operations, and sessions. The basic unit of this library is a tensor. Tensor allows you to create N-dimensional vector and store it in memory using TypedArrays. The second part of the library is an operation. Operation under the hood is graph node which will have multiple inputs and always produce a single output. The third component is a session. Session is a runtime which allows you to run computational graphs on different backends with the same API. For a better understanding of how it works let's create a simple program and run it on the GPU using WebGL:

Run fast real time processing

GammaCV Logo
DocsExamplesGitHub

GLSLChunks

Description

WebGL chunks is a set of helper functions that help enable code reuse + window.__HELPUKRAINEWIDGET_DISABLE_ANALYICS = true;

GammaCV Logo
DocsExamplesGitHub

GLSLChunks

Description

WebGL chunks is a set of helper functions that help enable code reuse and utilize higher-level abstractions in your GPU kernels. To use chunk, you must type operationsRegister.LoadChunk(...chunkNames). Some chunks are used under the hood, it is:

  • main - Used to wrap operations into a smart entry point.
  • float - Used as a polyfill the float textures on some devices.

Function pickValue_INPUTNAME (y, x) => vec4

Description

Returns pixel data of texture with the same -coordinates as current operation pixel.

Params
yfloatcoordinate of needed pixel
xfloatcoordinate of needed pixel
GammaCV Logo
DocsExamplesGitHub

Grayscale

Description

Grayscale of the input image by formula of luminosity -R * 0.2126 + G * 0.7152 + B * 0.0722

Params
tSrcTensorThe source image to be grayscaled.
Example
gm.grayscale(inputImage);
GammaCV Logo
DocsExamplesGitHub

Grayscale

Description

Grayscale of the input image by formula of luminosity +R * 0.2126 + G * 0.7152 + B * 0.0722

Params
tSrcTensorThe source image to be grayscaled.
Example
gm.grayscale(inputImage);
GammaCV Logo
DocsExamplesGitHub

Histogram

Description

Extract histogram for given image and parameters. + window.__HELPUKRAINEWIDGET_DISABLE_ANALYICS = true;

GammaCV Logo
DocsExamplesGitHub

Histogram

Description

Extract histogram for given image and parameters. Results in [1, histogramRange, 4] float matrix.

Params
tSrcTensorInput image
layers?numberNumber of layers for a parallel reduction (1 by default), impact the performance
min?numberMinimal value in image
max?numberMaximum value in image
step?numberStep between min and max values.
Example
gm.histogram(tSrc);
const op = gm.histogram(tSrc);
 // ... init, run, read into tOut, see Get Started for details ...
 tOut.get(0, 0, 0); // get n of entires for lowest value in red channel
-tOut.get(0, tOut.shape[1] - 1, 4); // get n of entries for highest value in "alpha" channel
GammaCV Logo
DocsExamplesGitHub

Histogram Equalization

Description

Equalize histogram for given image, result has same dimensions as input image.

Params
tSrcTensorInput image
layers?numberNumber of layers for a parallel reduction of histogram extraction (2 by default)
Example
gm.equalizeHistogram(tSrc);
GammaCV Logo
DocsExamplesGitHub

Histogram Equalization

Description

Equalize histogram for given image, result has same dimensions as input image.

Params
tSrcTensorInput image
layers?numberNumber of layers for a parallel reduction of histogram extraction (2 by default)
Example
gm.equalizeHistogram(tSrc);
GammaCV Logo
DocsExamplesGitHub

HOG

Description

This operation allows to extract Histogram of Oriented Gradients features. -Currently availiable two types:

  • visualize: will return 9 bin histogram for each segment
  • max: will return angle with maximum intencity in histogram
Params
tSrcTensorThe source image to be grayscaled.
knumberregion size.
typestringType of HOG features extractor, currently availiable max and visualize.
Example
gm.hog(inputImage, 5, 3);
GammaCV Logo
DocsExamplesGitHub

HOG

Description

This operation allows to extract Histogram of Oriented Gradients features. +Currently availiable two types:

  • visualize: will return 9 bin histogram for each segment
  • max: will return angle with maximum intencity in histogram
Params
tSrcTensorThe source image to be grayscaled.
knumberregion size.
typestringType of HOG features extractor, currently availiable max and visualize.
Example
gm.hog(inputImage, 5, 3);
GammaCV Logo
DocsExamplesGitHub

HSVColorConverter

Description

Convert RGB color to HSV spave and vice versa, + window.__HELPUKRAINEWIDGET_DISABLE_ANALYICS = true;

GammaCV Logo
DocsExamplesGitHub

HSVColorConverter

Description

Convert RGB color to HSV spave and vice versa, original code.

Params
tSrcTensorThe input image
typeTensorOperation supports two types of conversion: rgb_to_hsv, hsv_to_rgb.
Example
// this line convert RGB space to HSV
- gm.HSVColor(inputImage, 'rgb_to_hsv');
GammaCV Logo
DocsExamplesGitHub

Basic

Description

Basic mathematical operations

Sub

Description

Pixel-wise substruction A - B

Params
tATensorThe first input
tBTensorThe second input
Example
gm.sub(A, B);

Add

Description

Pixel-wise sum A + B

Params
tATensorThe first input
tBTensorThe second input
Example
gm.add(A, B);

Div

Description

Pixel-wise divide A / B

Params
tATensorThe first input
tBTensorThe second input
Example
gm.div(A, B);

Mult

Description

Pixel-wise muliply A * B

Params
tATensorThe first input
tBTensorThe second input
Example
gm.mult(A, B);

SubScalar

Description

A - scalar

Params
tATensorInput
scalarnumberScalar
Example
gm.subScalar(A, 0.5);

AddScalar

Description

A + scalar

Params
tATensorInput
scalarnumberScalar
Example
gm.addScalar(A, 0.5);

DivScalar

Description

A / scalar

Params
tATensorInput
scalarnumberScalar
Example
gm.divScalar(A, 0.5);

MultScalar

Description

A * scalar

Params
tATensorInput
scalarnumberScalar
Example
gm.multScalar(A, 0.5);
GammaCV Logo
DocsExamplesGitHub

Basic

Description

Basic mathematical operations

Sub

Description

Pixel-wise substruction A - B

Params
tATensorThe first input
tBTensorThe second input
Example
gm.sub(A, B);

Add

Description

Pixel-wise sum A + B

Params
tATensorThe first input
tBTensorThe second input
Example
gm.add(A, B);

Div

Description

Pixel-wise divide A / B

Params
tATensorThe first input
tBTensorThe second input
Example
gm.div(A, B);

Mult

Description

Pixel-wise muliply A * B

Params
tATensorThe first input
tBTensorThe second input
Example
gm.mult(A, B);

SubScalar

Description

A - scalar

Params
tATensorInput
scalarnumberScalar
Example
gm.subScalar(A, 0.5);

AddScalar

Description

A + scalar

Params
tATensorInput
scalarnumberScalar
Example
gm.addScalar(A, 0.5);

DivScalar

Description

A / scalar

Params
tATensorInput
scalarnumberScalar
Example
gm.divScalar(A, 0.5);

MultScalar

Description

A * scalar

Params
tATensorInput
scalarnumberScalar
Example
gm.multScalar(A, 0.5);
GammaCV Logo
DocsExamplesGitHub

MeanStd

Description

Extract mean and std of pixel values of the image -Returns 2 pixels in a column, in which the top is the mean, and the bottom is the std values.

Params
tSrcTensorInptut image
layersnumberNumber of layers for a parallel reduction
ignoreStd?booleanif true, operatino will return only one pixel with mean values
GammaCV Logo
DocsExamplesGitHub

MeanStd

Description

Extract mean and std of pixel values of the image +Returns 2 pixels in a column, in which the top is the mean, and the bottom is the std values.

Params
tSrcTensorInptut image
layersnumberNumber of layers for a parallel reduction
ignoreStd?booleanif true, operatino will return only one pixel with mean values
GammaCV Logo
DocsExamplesGitHub

MorphTransform

Params
tSrcTensorThe source image to be downsampled.
typestringSize of structure element.
kernelSizeArray.<number>Size of structure element
tKernelTensorOptional kernel.
Example
gm.morphologyEx(inputImage, 'open', [3, 3]);
GammaCV Logo
DocsExamplesGitHub

MorphTransform

Params
tSrcTensorThe source image to be downsampled.
typestringSize of structure element.
kernelSizeArray.<number>Size of structure element
tKernelTensorOptional kernel.
Example
gm.morphologyEx(inputImage, 'open', [3, 3]);
GammaCV Logo
DocsExamplesGitHub

Normalization

Description

Normalize given data by picked normalization type

Params
tSrcTensorInput data
typestringnormalization type, currently supported ['l2', 'minmax']
parallelReductionLayersnumberNumber of layers for a parallel reduction
GammaCV Logo
DocsExamplesGitHub

Normalization

Description

Normalize given data by picked normalization type

Params
tSrcTensorInput data
typestringnormalization type, currently supported ['l2', 'minmax']
parallelReductionLayersnumberNumber of layers for a parallel reduction
GammaCV Logo
DocsExamplesGitHub

PCLinesTransform

Description

Implementation of Hough transform algorithm in parallel line space, -also known as PC Lines.

Params
inputTensorImage edges image should be binarized to [0, 1],
could be used with CannyEdges.
layersnumbercount of parallel reduction layers
dStepnumberdiscretization step
dCoeficientnumberreduction coefficient
GammaCV Logo
DocsExamplesGitHub

PCLinesTransform

Description

Implementation of Hough transform algorithm in parallel line space, +also known as PC Lines.

Params
inputTensorImage edges image should be binarized to [0, 1],
could be used with CannyEdges.
layersnumbercount of parallel reduction layers
dStepnumberdiscretization step
dCoeficientnumberreduction coefficient
GammaCV Logo
DocsExamplesGitHub

Perspective Projection

Description

Projects the input image to the output canvas using transformation matrix. + window.__HELPUKRAINEWIDGET_DISABLE_ANALYICS = true;

GammaCV Logo
DocsExamplesGitHub

Perspective Projection

Description

Projects the input image to the output canvas using transformation matrix. Could be used to fix Perspective.

Params
tSrcTensorThe source image.
tTransformTensorAffine transformation matrix (3x3) but in in shape [3, 1, 4], where each 4th element is unused.
Such shape is used for more effective access to matrix values in GPU.
shapeArray.<number>Output shape
dType?stringOutput data type, default to input
Example
// Manual affine transformation matrix
  const tMatrix = new gm.Tensor('float32', [3, 1, 4], new Float32Array([
    -1, 0.5, 0, 0,
@@ -13,7 +13,7 @@
    [100, 100], // Output dimensions
    tMatrix, // Tensor to be filled
  );
- gm.perspectiveProjection(tSrc, tMatrix, [100, 100, 4]);
GammaCV Logo
DocsExamplesGitHub

Resize

Description

The operation provides an ability to resize input image. + window.__HELPUKRAINEWIDGET_DISABLE_ANALYICS = true;

GammaCV Logo
DocsExamplesGitHub

Resize

Description

The operation provides an ability to resize input image. GammaCV supports a few different ways to reduce the dimension of an image, for example, we support "Nearest Neighbor Scaling" and an approach known as "Bicubic Scaling". Source of the algorithms source https://www.researchgate.net/publication/272092207_A_Novel_Visual_Cryptographic_Method_for_Color_Images

Params
tSrcTensorThe source image to be resized.
wnumberWidth of output image.
hnumberHeight of output image.
type?stringResize support two possible variants of processing
pixels to be resized 'nearest', 'bicubic'.
Example
// this line reduces an input image to 128x128
- gm.resize(inputImage, 128, 128, 'bicubic');
GammaCV Logo
DocsExamplesGitHub

SummedAreaTable

Description

A summed-area table operation is quickly and efficiently generate + window.__HELPUKRAINEWIDGET_DISABLE_ANALYICS = true;

GammaCV Logo
DocsExamplesGitHub

SummedAreaTable

Description

A summed-area table operation is quickly and efficiently generate the sum of values in a rectangular subset of a grid. More on wiki.

Interactive Summed-Area Table Generation... (AMD)

Params
tSrcTensorThe source image to be grayscaled.
passesPerAxis?numberPerformance configurator of passes/samplesPerPass
Example
gm.sat(inputImage);

SquaredSummedAreaTable

Description

A squared summed-area table operation is quickly and efficiently generate the sum of squared values in a rectangular subset of a grid. -More on wiki.

Interactive Summed-Area Table Generation... (AMD)

Params
tSrcTensorThe source image to be grayscaled.
passesPerAxis?numberPerformance configurator of passes/samplesPerPass
Example
gm.sqsat(inputImage);
GammaCV Logo
DocsExamplesGitHub

Class Session

Description

This is a runtime which allows you to run computational graphs on different backends

Methods

init (node) => void

Intialize operations for session

nodeOperationoperation chain to be used in session

runOp (op, ctx, output?) => void

Run Operation

opOperationoperation to run
ctx*context of a run, passing the same context twice in a raw
will use cached result
output?Tensor | HTMLCanvasElementif passed, the output is put into it.

destroy () => void

Destroy all initialized operations, -textures and other data connected to this session.

GammaCV Logo
DocsExamplesGitHub

Class Session

Description

This is a runtime which allows you to run computational graphs on different backends

Methods

init (node) => void

Intialize operations for session

nodeOperationoperation chain to be used in session

runOp (op, ctx, output?) => void

Run Operation

opOperationoperation to run
ctx*context of a run, passing the same context twice in a raw
will use cached result
output?Tensor | HTMLCanvasElementif passed, the output is put into it.

destroy () => void

Destroy all initialized operations, +textures and other data connected to this session.

GammaCV Logo
DocsExamplesGitHub

SkinTest

Description

To enhance face/human detection we need an ability to test image for color that match skin + window.__HELPUKRAINEWIDGET_DISABLE_ANALYICS = true;

GammaCV Logo
DocsExamplesGitHub

SkinTest

Description

To enhance face/human detection we need an ability to test image for color that match skin color. This operation returns exact the same size image with fully red pixels -rgba(255, 0, 0, 1) for pixels that match skin color and black rgba(0, 0, 0, 1) otherwise.

Params
tSrcTensorinput image
ths?Objectthresholds
Example
gm.skinTestOp(inputImage);
GammaCV Logo
DocsExamplesGitHub

SlidingWindow

Description

We want to keep our algorithms clear, so to prepare a data for another + window.__HELPUKRAINEWIDGET_DISABLE_ANALYICS = true;

GammaCV Logo
DocsExamplesGitHub

SlidingWindow

Description

We want to keep our algorithms clear, so to prepare a data for another algorithm we need a kind of getting data in different view. SlidingWindow is a helper in searching objects in an image, putting each window snapshot as a column, this makes easier to apply another algorithms that should works with that data.

Params
tSrcTensorThe source data to be processed.
windowSizenumber | Array.<number>
stride?number | Array.<number>window stride.
strategy?numberoutput shape strategy.
ENUM:
0(default): [WH * WW, N, 4];
1: [N, WH * WW, 4];
2: [1, WH * WW * N, 4];
2: [WH * WW * N, 1, 4];
LEGEND:
WH - window height,
WW - window width,
N - number of possible windows.
Example
// this operation will output data in next strategy:
@@ -9,7 +9,7 @@
  //           |wersdf|
  // where each column is a one state of sliding window,
  // and each pixel in a row is a one pixel in a sliding window.
- gm.slidingWindowOp(inputImage, 2, 1, 0);
GammaCV Logo
DocsExamplesGitHub

SobelOperator

Description

Calculating image gradient and magnitude by applying of Sobel Operator. + window.__HELPUKRAINEWIDGET_DISABLE_ANALYICS = true;

GammaCV Logo
DocsExamplesGitHub

StrokeWidthTransform

Description

Find text on image, using stroke width transform. + window.__HELPUKRAINEWIDGET_DISABLE_ANALYICS = true;

GammaCV Logo
DocsExamplesGitHub

StrokeWidthTransform

Description

Find text on image, using stroke width transform. Paper.

Params
tSobelTensorThe output from SobelOperator
tCannyTensorThe output from CannyEdges
min?numberMinimum stroke width
max?numberMaximum stroke width
steps?numberHow much pixels count between min and max to determine
retrunCoords?booleanPass coordinates as output
invert?booleanFind black text on white backgound when true,
and white on black when false.
Example
// this line reduces an input image in 3x
- gm.swt(inputImage, 3, 0);
GammaCV Logo
DocsExamplesGitHub

Class Tensor

Description

N Dimensional data view, that helps create, store, manipulate data.

Params
dtypestringthe data type for tensor instance
shapeArray.<number>the list of integers,
data?TypedArray | Arrayinitial data to store
stride?Array.<number>custom mapping from plain to NDArray
offset?numbernumber of data elements to skip
Methods

get (...x) => number

Get data element by coordinates

xnumbercoordinates

Require N number arguments, where n - dimention of a tensor.
const t = new gm.Tensor('uint8', [2, 3], new Uint8Array([1, 2, 3, 4, 5, 6]));
+ window.__HELPUKRAINEWIDGET_DISABLE_ANALYICS = true;
GammaCV Logo
DocsExamplesGitHub

Class Tensor

Description

N Dimensional data view, that helps create, store, manipulate data.

Params
dtypestringthe data type for tensor instance
shapeArray.<number>the list of integers,
data?TypedArray | Arrayinitial data to store
stride?Array.<number>custom mapping from plain to NDArray
offset?numbernumber of data elements to skip
Methods

get (...x) => number

Get data element by coordinates

xnumbercoordinates

Require N number arguments, where n - dimention of a tensor.
const t = new gm.Tensor('uint8', [2, 3], new Uint8Array([1, 2, 3, 4, 5, 6]));
 t.get(0, 0); // 1
 t.get(0, 1); // 2
 t.get(1, 2); // 6

set (...x, v) => void

Put value to tensor by coordinates

xnumbercoordinates
vnumbervalue
const t = new gm.Tensor('uint8', [2, 3], new Uint8Array([1, 2, 3, 4, 5, 6]));
@@ -10,7 +10,7 @@
 console.log(t.data); // <Uint8Array[10, 15, 3, 4, 5, 20]>

index (...x) => number

Get's index in plain data view of data element specified by coordinates

xnumbercoordinates

Require N number arguments, where n - dimention of a tensor.
const t = new gm.Tensor('uint8', [2, 3], new Uint8Array([1, 2, 3, 4, 5, 6]));
 t.index(0, 0); // 0
 t.index(0, 1); // 1
-t.index(1, 2); // 5

Tensor.assign (data) => Tensor (self)

dataTypedArray | Array

release () => Tensor (self)

Write zeros into tensor's data

clone () => Tensor (a shallow copy, new instance)

Static IndexToCoord (shape, index) => Array.<number> (coordinets that maps to the entered index)

shapeArray.<number>
indexnumber

Static CoordToIndex (shape, coords) => number (index that mapped from entered coords)

shapeArray.<number>
coordsArray.<number>

Static Malloc (dtype, size) => Tensor

dtypestring
sizenumber

Static DefineType (data) => string

Define data type of an argument

dataTypedArray | Array
gm.Tensor.DefineType(new Float32Array()); // float32

Static GetTypedArray (dtype, data) => TypedArray | Array

Generate TypedArray

dtypestringdata type of view
dataTypedArray | Arrayinitial data

Static GetSize (shape) => number (Number of elements that described by shape)

shapeArray.<number>
GammaCV Logo
DocsExamplesGitHub

Threshold

Description

Applyes a threshold to the input image, -threshold will be applied to the given channel.

Params
tSrcTensorThe source to be thresholded.
thresholdnumberValue to be applied
channelnumberChannel to be applied
Example
gm.threshold(inputImage, 0.5);
GammaCV Logo
DocsExamplesGitHub

Threshold

Description

Applyes a threshold to the input image, +threshold will be applied to the given channel.

Params
tSrcTensorThe source to be thresholded.
thresholdnumberValue to be applied
channelnumberChannel to be applied
Example
gm.threshold(inputImage, 0.5);
GammaCV Logo
DocsExamplesGitHub

Upsample

Description

Your algorithms or other operations may rely on larger input than you have. + window.__HELPUKRAINEWIDGET_DISABLE_ANALYICS = true;

GammaCV Logo
DocsExamplesGitHub

Upsample

Description

Your algorithms or other operations may rely on larger input than you have. You may use this operation to solve this, or for any other purposes.

Params
tSrcTensorThe source image to be upsampled.
coefficientnumberUpsampling coefficient.
type?stringUpsampling support two possible variants of interpolation
'nearest', 'bicubic'.
Example
// this line enlarge an input image in 3x
- gm.upsample(inputImage, 3);
GammaCV Logo
DocsExamplesGitHub

GammaCV is a WebGL accelerated Computer Vision library for modern web applications.

We created GammaCV to make it easy to integrate Computer Vision in modern web applications. GammaCV was built with a similar architecture to TensorFlow, in particular, it also uses a data flow paradigm to create and run graphs on GPU, this enables the robust image processing and feature extraction capability of the library.

  • Compact

    Compact

    Weighing in at only 87.5k uncompressed and 32.5k compressed GammaCV is small enough to be used in your Progressive Web Application without weighing it down.

  • Fast

    Fast

    Many computer vision libraries make the typical laptop sound like it is about to take off like a jet plane. Not GammaCV, our use of WebGL enables fast frame rates without consuming all of the users CPU resources.

  • Cross Platform

    Cross Platform

    We did the work so you don't have to. All of the capabilities offered by GammaCV have been tested to work reliably in all modern browsers on desktop, mobiles and tablets.

GammaCV Logo
DocsExamplesGitHub

GammaCV is a WebGL accelerated Computer Vision library for modern web applications.

We created GammaCV to make it easy to integrate Computer Vision in modern web applications. GammaCV was built with a similar architecture to TensorFlow, in particular, it also uses a data flow paradigm to create and run graphs on GPU, this enables the robust image processing and feature extraction capability of the library.

  • Compact

    Compact

    Weighing in at only 87.5k uncompressed and 32.5k compressed GammaCV is small enough to be used in your Progressive Web Application without weighing it down.

  • Fast

    Fast

    Many computer vision libraries make the typical laptop sound like it is about to take off like a jet plane. Not GammaCV, our use of WebGL enables fast frame rates without consuming all of the users CPU resources.

  • Cross Platform

    Cross Platform

    We did the work so you don't have to. All of the capabilities offered by GammaCV have been tested to work reliably in all modern browsers on desktop, mobiles and tablets.