new Image()
Image utility.
- Source:
Methods
-
<static> blur(pixels, width, height, diameter) → {array}
-
Computes gaussian blur. Adpated from https://github.com/kig/canvasfilters.
Parameters:
Name Type Description pixels
pixels The pixels in a linear [r,g,b,a,...] array. width
number The image width. height
number The image height. diameter
number Gaussian blur diameter, must be greater than 1. - Source:
Returns:
The edge pixels in a linear [r,g,b,a,...] array.- Type
- array
-
<static> computeIntegralImage(pixels, width, height, opt_integralImage, opt_integralImageSquare, opt_tiltedIntegralImage, opt_integralImageSobel)
-
Computes the integral image for summed, squared, rotated and sobel pixels.
Parameters:
Name Type Description pixels
array The pixels in a linear [r,g,b,a,...] array to loop through. width
number The image width. height
number The image height. opt_integralImage
array Empty array of size `width * height` to be filled with the integral image values. If not specified compute sum values will be skipped. opt_integralImageSquare
array Empty array of size `width * height` to be filled with the integral image squared values. If not specified compute squared values will be skipped. opt_tiltedIntegralImage
array Empty array of size `width * height` to be filled with the rotated integral image values. If not specified compute sum values will be skipped. opt_integralImageSobel
array Empty array of size `width * height` to be filled with the integral image of sobel values. If not specified compute sobel filtering will be skipped. - Source:
-
<static> grayscale(pixels, width, height, fillRGBA, The)
-
Converts a color from a colorspace based on an RGB color model to a grayscale representation of its luminance. The coefficients represent the measured intensity perception of typical trichromat humans, in particular, human vision is most sensitive to green and least sensitive to blue.
Parameters:
Name Type Description pixels
pixels The pixels in a linear [r,g,b,a,...] array. width
number The image width. height
number The image height. fillRGBA
boolean If the result should fill all RGBA values with the gray scale values, instead of returning a single value per pixel. The
Uint8ClampedArray grayscale pixels in a linear array ([p,p,p,a,...] if fillRGBA is true and [p1, p2, p3, ...] if fillRGBA is false). - Source:
-
<static> horizontalConvolve(pixels, width, height, weightsVector, opaque) → {array}
-
Fast horizontal separable convolution. A point spread function (PSF) is said to be separable if it can be broken into two one-dimensional signals: a vertical and a horizontal projection. The convolution is performed by sliding the kernel over the image, generally starting at the top left corner, so as to move the kernel through all the positions where the kernel fits entirely within the boundaries of the image. Adpated from https://github.com/kig/canvasfilters.
Parameters:
Name Type Description pixels
pixels The pixels in a linear [r,g,b,a,...] array. width
number The image width. height
number The image height. weightsVector
array The weighting vector, e.g [-1,0,1]. opaque
number - Source:
Returns:
The convoluted pixels in a linear [r,g,b,a,...] array.- Type
- array
-
<static> separableConvolve(pixels, width, height, horizWeights, vertWeights, opaque) → {array}
-
Fast separable convolution. A point spread function (PSF) is said to be separable if it can be broken into two one-dimensional signals: a vertical and a horizontal projection. The convolution is performed by sliding the kernel over the image, generally starting at the top left corner, so as to move the kernel through all the positions where the kernel fits entirely within the boundaries of the image. Adpated from https://github.com/kig/canvasfilters.
Parameters:
Name Type Description pixels
pixels The pixels in a linear [r,g,b,a,...] array. width
number The image width. height
number The image height. horizWeights
array The horizontal weighting vector, e.g [-1,0,1]. vertWeights
array The vertical vector, e.g [-1,0,1]. opaque
number - Source:
Returns:
The convoluted pixels in a linear [r,g,b,a,...] array.- Type
- array
-
<static> sobel(pixels, width, height) → {array}
-
Compute image edges using Sobel operator. Computes the vertical and horizontal gradients of the image and combines the computed images to find edges in the image. The way we implement the Sobel filter here is by first grayscaling the image, then taking the horizontal and vertical gradients and finally combining the gradient images to make up the final image. Adpated from https://github.com/kig/canvasfilters.
Parameters:
Name Type Description pixels
pixels The pixels in a linear [r,g,b,a,...] array. width
number The image width. height
number The image height. - Source:
Returns:
The edge pixels in a linear [r,g,b,a,...] array.- Type
- array
-
<static> verticalConvolve(pixels, width, height, weightsVector, opaque) → {array}
-
Fast vertical separable convolution. A point spread function (PSF) is said to be separable if it can be broken into two one-dimensional signals: a vertical and a horizontal projection. The convolution is performed by sliding the kernel over the image, generally starting at the top left corner, so as to move the kernel through all the positions where the kernel fits entirely within the boundaries of the image. Adpated from https://github.com/kig/canvasfilters.
Parameters:
Name Type Description pixels
pixels The pixels in a linear [r,g,b,a,...] array. width
number The image width. height
number The image height. weightsVector
array The weighting vector, e.g [-1,0,1]. opaque
number - Source:
Returns:
The convoluted pixels in a linear [r,g,b,a,...] array.- Type
- array