AdaptiveThreshold
Description
Applies an adaptive threshold to the input image, + window.__HELPUKRAINEWIDGET_DISABLE_ANALYICS = true;
AdaptiveThreshold
Description
Applies an adaptive threshold to the input image, threshold will be applied to the given channel. -Original paper
Params
tSrc | Tensor | The source to be thresholded. |
uS? | number | Size of the avarange box |
threshold? | number | Percent of the diff to mark black in range 0-100 |
channel? | number | Channel to be applied |
tIntegralImage? | Tensor | summed area table of the input |
Example
gm.adaptiveThreshold(inputImage);
CannyEdges
Description
The Canny edge detector is an edge detection operator that uses + window.__HELPUKRAINEWIDGET_DISABLE_ANALYICS = true;
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
sobel | Tensor | output of SobelOperator. |
low | number | Low threshold to be applied. |
high | number | High threshold to be applied. |
Example
gm.cannyEdges(inputImage, 0.25, 0.75);
Cast
Description
Change the texture data type
Params
tSrc | Tensor | The source to be changed. |
dtype | string | The destination data type |
Example
gm.cast(inputImage, 'float32');
Cast
Description
Change the texture data type
Params
tSrc | Tensor | The source to be changed. |
dtype | string | The destination data type |
Example
gm.cast(inputImage, 'float32');
ColorSegmentation
Description
Color segmentation of given image with simple Euclidian + window.__HELPUKRAINEWIDGET_DISABLE_ANALYICS = true;
ColorSegmentation
Description
Color segmentation of given image with simple Euclidian distance estimation.
Params
tSrc | Tensor | Current frame. |
clusters | number | Number of clusters the input image to be clustered. |
Example
// segmentation of input image to 5 clusters
- gm.colorSegmentation(inputImage, 5);
Concat
Description
Concat two inputs in one image
Params
tA | Tensor | The first input |
tB | Tensor | The 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']);
Concat
Description
Concat two inputs in one image
Params
tA | Tensor | The first input |
tB | Tensor | The 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']);
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
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
Convolution
Description
Doing convlolution between a kernel and an image, -see wiki.
Params
tSrc | Tensor | The source image to be convolved. |
tKernel | Tensor | Kernel body, tensor with shape [n, m, 4], where alpha component of each pixel is kernel cell value. |
factor? | number | a scaling quantity that is multiplied by the result |
bias? | number | is added on after the factor has been accounted for |
Example
gm.conv2d(inputImage, gm.kernels.boxBlur());
Convolution
Description
Doing convlolution between a kernel and an image, +see wiki.
Params
tSrc | Tensor | The source image to be convolved. |
tKernel | Tensor | Kernel body, tensor with shape [n, m, 4], where alpha component of each pixel is kernel cell value. |
factor? | number | a scaling quantity that is multiplied by the result |
bias? | number | is added on after the factor has been accounted for |
Example
gm.conv2d(inputImage, gm.kernels.boxBlur());
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;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].
DocsExamplesGitHub Dilation
Description
Dilation is one of the basic operations in mathematical morphology.
+ window.__HELPUKRAINEWIDGET_DISABLE_ANALYICS = true;
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
tSrc Tensor The source image to be downsampled. kernelSize Array.<number> Size of structure element. tKernel Tensor Optional kernel.
Example
gm.dilate(inputImage, [3, 3]);
DocsExamplesGitHub Downsample
Description
Performance is always important, but some algorithms are very expensive to apply
+ window.__HELPUKRAINEWIDGET_DISABLE_ANALYICS = true;
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
tSrc Tensor The source image to be downsampled. coefficient number Downsampling coefficient. type? string Downsampling 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');
DocsExamplesGitHub Erosion
Description
Erosion is one of two fundamental operations (the other being dilation)
+ window.__HELPUKRAINEWIDGET_DISABLE_ANALYICS = true;
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
tSrc Tensor The source image to be downsampled. kernelSize Array.<number> Size of structure element. tKernel Tensor Optional kernel.
Example
gm.erode(inputImage, [3, 3]);
DocsExamplesGitHub GaussianBlur
Description
This operation is default blur operation which actually
-convolution with Gaussian kernel.
Params
tSrc Tensor The source image to be grayscaled. kernelSize number Size of the kernel. sigma number Sigma coeficient value.
Example
gm.gaussianBlur(inputImage, 5, 3);
DocsExamplesGitHub GaussianBlur
Description
This operation is default blur operation which actually
+convolution with Gaussian kernel.
Params
tSrc Tensor The source image to be grayscaled. kernelSize number Size of the kernel. sigma number Sigma coeficient value.
Example
gm.gaussianBlur(inputImage, 5, 3);
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;
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
DocsExamplesGitHub GLSLChunks
Description
WebGL chunks is a set of helper functions that help enable code reuse
+ window.__HELPUKRAINEWIDGET_DISABLE_ANALYICS = true;
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
y float coordinate of needed pixel x float coordinate of needed pixel
DocsExamplesGitHub Grayscale
Description
Grayscale of the input image by formula of luminosity
-R * 0.2126 + G * 0.7152 + B * 0.0722
Params
tSrc Tensor The source image to be grayscaled.
Example
gm.grayscale(inputImage);
DocsExamplesGitHub Grayscale
Description
Grayscale of the input image by formula of luminosity
+R * 0.2126 + G * 0.7152 + B * 0.0722
Params
tSrc Tensor The source image to be grayscaled.
Example
gm.grayscale(inputImage);
DocsExamplesGitHub Histogram
Description
Extract histogram for given image and parameters.
+ window.__HELPUKRAINEWIDGET_DISABLE_ANALYICS = true;
DocsExamplesGitHub Histogram
Description
Extract histogram for given image and parameters.
Results in [1, histogramRange, 4] float matrix.
Params
tSrc Tensor Input image layers? number Number of layers for a parallel reduction (1 by default), impact the performance min? number Minimal value in image max? number Maximum value in image step? number Step 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
DocsExamplesGitHub Histogram Equalization
Description
Equalize histogram for given image, result has same dimensions as input image.
Params
tSrc Tensor Input image layers? number Number of layers for a parallel reduction of histogram extraction (2 by default)
Example
gm.equalizeHistogram(tSrc);
DocsExamplesGitHub Histogram Equalization
Description
Equalize histogram for given image, result has same dimensions as input image.
Params
tSrc Tensor Input image layers? number Number of layers for a parallel reduction of histogram extraction (2 by default)
Example
gm.equalizeHistogram(tSrc);
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 segmentmax
: will return angle with maximum intencity in histogram
Params
tSrc Tensor The source image to be grayscaled. k number region size. type string Type of HOG features extractor, currently availiable max and visualize.
Example
gm.hog(inputImage, 5, 3);
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 segmentmax
: will return angle with maximum intencity in histogram
Params
tSrc Tensor The source image to be grayscaled. k number region size. type string Type of HOG features extractor, currently availiable max and visualize.
Example
gm.hog(inputImage, 5, 3);
DocsExamplesGitHub HSVColorConverter
Description
Convert RGB color to HSV spave and vice versa,
+ window.__HELPUKRAINEWIDGET_DISABLE_ANALYICS = true;
DocsExamplesGitHub HSVColorConverter
Description
Convert RGB color to HSV spave and vice versa,
original code.
Params
tSrc Tensor The input image type Tensor Operation 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');
DocsExamplesGitHub Basic
Description
Basic mathematical operations
Sub
Description
Pixel-wise substruction A - B
Params
tA Tensor The first input tB Tensor The second input
Example
gm.sub(A, B);
Add
Description
Pixel-wise sum A + B
Params
tA Tensor The first input tB Tensor The second input
Example
gm.add(A, B);
Div
Description
Pixel-wise divide A / B
Params
tA Tensor The first input tB Tensor The second input
Example
gm.div(A, B);
Mult
Description
Pixel-wise muliply A * B
Params
tA Tensor The first input tB Tensor The second input
Example
gm.mult(A, B);
SubScalar
Description
A - scalar
Params
tA Tensor Input scalar number Scalar
Example
gm.subScalar(A, 0.5);
AddScalar
Description
A + scalar
Params
tA Tensor Input scalar number Scalar
Example
gm.addScalar(A, 0.5);
DivScalar
Description
A / scalar
Params
tA Tensor Input scalar number Scalar
Example
gm.divScalar(A, 0.5);
MultScalar
Description
A * scalar
Params
tA Tensor Input scalar number Scalar
Example
gm.multScalar(A, 0.5);
DocsExamplesGitHub Basic
Description
Basic mathematical operations
Sub
Description
Pixel-wise substruction A - B
Params
tA Tensor The first input tB Tensor The second input
Example
gm.sub(A, B);
Add
Description
Pixel-wise sum A + B
Params
tA Tensor The first input tB Tensor The second input
Example
gm.add(A, B);
Div
Description
Pixel-wise divide A / B
Params
tA Tensor The first input tB Tensor The second input
Example
gm.div(A, B);
Mult
Description
Pixel-wise muliply A * B
Params
tA Tensor The first input tB Tensor The second input
Example
gm.mult(A, B);
SubScalar
Description
A - scalar
Params
tA Tensor Input scalar number Scalar
Example
gm.subScalar(A, 0.5);
AddScalar
Description
A + scalar
Params
tA Tensor Input scalar number Scalar
Example
gm.addScalar(A, 0.5);
DivScalar
Description
A / scalar
Params
tA Tensor Input scalar number Scalar
Example
gm.divScalar(A, 0.5);
MultScalar
Description
A * scalar
Params
tA Tensor Input scalar number Scalar
Example
gm.multScalar(A, 0.5);
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
tSrc Tensor Inptut image layers number Number of layers for a parallel reduction ignoreStd? boolean if true, operatino will return only one pixel with mean values
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
tSrc Tensor Inptut image layers number Number of layers for a parallel reduction ignoreStd? boolean if true, operatino will return only one pixel with mean values
DocsExamplesGitHub MinMax
Description
Extract min and max for given image
Params
tSrc Tensor Input image layers number Number of layers for a parallel reduction
DocsExamplesGitHub MinMax
Description
Extract min and max for given image
Params
tSrc Tensor Input image layers number Number of layers for a parallel reduction
DocsExamplesGitHub Normalization
Description
Normalize given data by picked normalization type
Params
tSrc Tensor Input data type string normalization type, currently supported ['l2', 'minmax'] parallelReductionLayers number Number of layers for a parallel reduction
DocsExamplesGitHub Normalization
Description
Normalize given data by picked normalization type
Params
tSrc Tensor Input data type string normalization type, currently supported ['l2', 'minmax'] parallelReductionLayers number Number of layers for a parallel reduction
DocsExamplesGitHub PCLinesTransform
Description
Implementation of Hough transform algorithm in parallel line space,
-also known as PC Lines.
Params
input Tensor Image edges image should be binarized to [0, 1],
could be used with CannyEdges. layers number count of parallel reduction layers dStep number discretization step dCoeficient number reduction coefficient
DocsExamplesGitHub PCLinesTransform
Description
Implementation of Hough transform algorithm in parallel line space,
+also known as PC Lines.
Params
input Tensor Image edges image should be binarized to [0, 1],
could be used with CannyEdges. layers number count of parallel reduction layers dStep number discretization step dCoeficient number reduction coefficient
DocsExamplesGitHub Perspective Projection
Description
Projects the input image to the output canvas using transformation matrix.
+ window.__HELPUKRAINEWIDGET_DISABLE_ANALYICS = true;
DocsExamplesGitHub Perspective Projection
Description
Projects the input image to the output canvas using transformation matrix.
Could be used to fix Perspective.
Params
tSrc Tensor The source image. tTransform Tensor Affine 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. shape Array.<number> Output shape dType? string Output 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]);
DocsExamplesGitHub Resize
Description
The operation provides an ability to resize input image.
+ window.__HELPUKRAINEWIDGET_DISABLE_ANALYICS = true;
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
tSrc Tensor The source image to be resized. w number Width of output image. h number Height of output image. type? string Resize 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');
DocsExamplesGitHub SummedAreaTable
Description
A summed-area table operation is quickly and efficiently generate
+ window.__HELPUKRAINEWIDGET_DISABLE_ANALYICS = true;
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
tSrc Tensor The source image to be grayscaled. passesPerAxis? number Performance 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
tSrc Tensor The source image to be grayscaled. passesPerAxis? number Performance configurator of passes/samplesPerPass
Example
gm.sqsat(inputImage);
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
node Operation operation chain to be used in session
runOp (op, ctx, output?) => void
Run Operation
op Operation operation to run ctx * context of a run, passing the same context twice in a raw
will use cached result output? Tensor | HTMLCanvasElement if passed, the output is put into it.
destroy () => void
Destroy all initialized operations,
-textures and other data connected to this session.
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
node Operation operation chain to be used in session
runOp (op, ctx, output?) => void
Run Operation
op Operation operation to run ctx * context of a run, passing the same context twice in a raw
will use cached result output? Tensor | HTMLCanvasElement if passed, the output is put into it.
destroy () => void
Destroy all initialized operations,
+textures and other data connected to this session.
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;
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
tSrc Tensor input image ths? Object thresholds
Example
gm.skinTestOp(inputImage);
DocsExamplesGitHub SlidingWindow
Description
We want to keep our algorithms clear, so to prepare a data for another
+ window.__HELPUKRAINEWIDGET_DISABLE_ANALYICS = true;
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
tSrc Tensor The source data to be processed. windowSize number | Array.<number> stride? number | Array.<number> window stride. strategy? number output 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);
DocsExamplesGitHub SobelOperator
Description
Calculating image gradient and magnitude by applying of Sobel Operator.
+ window.__HELPUKRAINEWIDGET_DISABLE_ANALYICS = true;
DocsExamplesGitHub SobelOperator
Description
Calculating image gradient and magnitude by applying of Sobel Operator.
Output description:
0 - GX
1 - GY
-2 - Magnitude
Params
tSrc Tensor Input image.
Example
gm.sobelOperator(inputImage);
DocsExamplesGitHub StrokeWidthTransform
Description
Find text on image, using stroke width transform.
+ window.__HELPUKRAINEWIDGET_DISABLE_ANALYICS = true;
DocsExamplesGitHub StrokeWidthTransform
Description
Find text on image, using stroke width transform.
Paper.
Params
tSobel Tensor The output from SobelOperator tCanny Tensor The output from CannyEdges min? number Minimum stroke width max? number Maximum stroke width steps? number How much pixels count between min and max to determine retrunCoords? boolean Pass coordinates as output invert? boolean Find 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);
DocsExamplesGitHub Class Tensor
Description
N Dimensional data view, that helps create, store, manipulate data.
Params
dtype string the data type for tensor instance shape Array.<number> the list of integers, data? TypedArray | Array initial data to store stride? Array.<number> custom mapping from plain to NDArray offset? number number of data elements to skip
Methods
get (...x) => number
Get data element by coordinates
x number coordinates
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;DocsExamplesGitHub Class Tensor
Description
N Dimensional data view, that helps create, store, manipulate data.
Params
dtype string the data type for tensor instance shape Array.<number> the list of integers, data? TypedArray | Array initial data to store stride? Array.<number> custom mapping from plain to NDArray offset? number number of data elements to skip
Methods
get (...x) => number
Get data element by coordinates
x number coordinates
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
x number coordinates v number value
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
x number coordinates
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)
data TypedArray | 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)
shape Array.<number> index number
Static CoordToIndex (shape, coords) => number (index that mapped from entered coords)
shape Array.<number> coords Array.<number>
Static Malloc (dtype, size) => Tensor
dtype string size number
Static DefineType (data) => string
Define data type of an argument
data TypedArray | Array
gm.Tensor.DefineType(new Float32Array()); // float32
Static GetTypedArray (dtype, data) => TypedArray | Array
Generate TypedArray
dtype string data type of view data TypedArray | Array initial data
Static GetSize (shape) => number (Number of elements that described by shape)
shape Array.<number>
DocsExamplesGitHub Threshold
Description
Applyes a threshold to the input image,
-threshold will be applied to the given channel.
Params
tSrc Tensor The source to be thresholded. threshold number Value to be applied channel number Channel to be applied
Example
gm.threshold(inputImage, 0.5);
DocsExamplesGitHub Threshold
Description
Applyes a threshold to the input image,
+threshold will be applied to the given channel.
Params
tSrc Tensor The source to be thresholded. threshold number Value to be applied channel number Channel to be applied
Example
gm.threshold(inputImage, 0.5);
DocsExamplesGitHub Upsample
Description
Your algorithms or other operations may rely on larger input than you have.
+ window.__HELPUKRAINEWIDGET_DISABLE_ANALYICS = true;
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
tSrc Tensor The source image to be upsampled. coefficient number Upsampling coefficient. type? string Upsampling support two possible variants of interpolation
'nearest', 'bicubic'.
Example
// this line enlarge an input image in 3x
- gm.upsample(inputImage, 3);
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
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
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
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.
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
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
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
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.