-
Notifications
You must be signed in to change notification settings - Fork 25
Xflow image processing operator list
Converts an input color image to grayscale image.
s = 0.2126 * r + 0.7152 * g + 0.0722 * b
Signature
output = xflip.grayscale(input)
@param texture input input color image @return texture output output grayscale image
Complements colors of an input image.
output = 255 - input (channel-wise)
Signature
output = xflip.complement(input)
@param texture input input color image @return texture output color complement of the input image
Dims an input image by a given ratio.
output = ratio * input (channel-wise)
Signature
output = xflip.dim(input, ratio)
@param texture input input image @param float ratio dimming ratio (positive) @return texture output dimmed image
Thresholds an input grayscale image by a given threshold value.
output = (input > threshold) ? 255 : 0
Signature
output = xflip.threshold(input, threshold)
@param texture input input grayscale image @param int threshod threshold value [0,255] @return texture output thresholded grayscale image
Slices an input image for colors of interest within an RGB sphere of a given radius centered at a given color. All other colors would become white.
Signature
output = xflip.sliceColor(input, color, radius)
@param texture input input image @param int color key color (color of interest) @param float radius radius of the sphere centered at key color (positive) @return texture output color sliced output image
Multiplies a 4x4 float color weight matrix to an input image.
output = weights * input (matrix multiplication)
Signature
output = xflip.mulColorMatrix(input, weights)
@param texture input input image @param float weights 4x4 color weight matrix @return texture output output image with the new color tone
Creates a 4x4 saturate weight matrix according to a saturation degree (weight) that can be used with xflip.mulColorMatrix. Weights are based on SVG filter effects.
Signature
output = xflip.createSaturateMatrix(weight)
@param float weight weight value @return float output a 4x4 saturate weight matrix
Masks first image with second image according to a weight value.
output = input1 + weight * input2 (channel-wise)
Signature
output = xflip.mask(input1, input2, weight)
@param texture input1 first input image @param texture input2 second input image @param texture weight masking weight @return texture output input1 masked with input2
Returns channel-wise magnitude (Euclidean norm) of two input images in a new image.
output = sqrt(input1^2 + input2^2) (channel-wise)
Signature
output = xflip.getChannelMagnitude(input1, input2)
@param texture input1 first input image @param texture input2 second input image @return texture output channel-wise magnitude of first and second input images
Premultiplies color channels of input image pixels by their alpha values. Color channels of output image are still in the [0,255] range.
Signature
output = xflip.premultiply(input)
@param texture input unpremultiplied input color image (with channels in the range [0,255]) @return texture output premultiplied output image (with channels in the range [0,255])
Unpremultiplies a premultiplied input color image according to the alpha values. Output image is just a normal RGBA image and its channels are in the range [0,255].
Signature
output = xflip.unpremultiply(input)
@param texture input premultiplied input image (with channels in the range [0,255]) @return texture output unpremultiplied output image (with channels in the range [0,255])
All of the five blending operators below are implemented based on SVG filter effect definitions with respect to alpha values. Inputs and outputs of the blending operators are just unpremultiplied images (normal RGBA).
Signature
output = xflip.blendNormal(input1, input2)
@param texture input1 first input image @param texture input2 second input image @return texture output blended output (Normal mode)
Signature
output = xflip.blendMultiply(input1, input2)
@param texture input1 first input image @param texture input2 second input image @return texture output blended output (Multiply mode)
Signature
output = xflip.blendScreen(input1, input2)
@param texture input1 first input image @param texture input2 second input image @return texture output blended output (Screen mode)
Signature
output = xflip.blendLighten(input1, input2)
@param texture input1 first input image @param texture input2 second input image @return texture output blended output (Lighten mode)
Signature
output = xflip.blendDarken(input1, input2)
@param texture input1 first input image @param texture input2 second input image @return texture output blended output (Darken mode)
Convolves an input image by a given square spatial filter with odd sides.
Signature
output = xflip.convolve(input, filter)
@param texture input input image @param float filter square matrix of filter weights (with odd sides) @return texture output convolution result image
Creates a spatial square Gaussian filter of given size (side) and sigma that can be used with xflip.convolve.
Signature
output = xfow.createGaussianFilter(size, sigma)
@param int size side of square filter (must be odd) @param float sigma sigma of Gaussian function (positive) @return texture output square weight matrix of the desired Gaussian filter
Creates a spatial square Averaging filter of given size (side) that can be used with xflip.convolve.
Signature
output = xflip.createAveragingFilter(size)
@param int size side of square filter (must be odd) @return float output square weight matrix of the desired Averaging filter
Convolves an input image by a square median filter of a given size.
Signature
output = xflip.median(input, size)
@param texture input input image @param int size side of square median filter (must be odd) @return texture output output image smoothed by the desired median filter
Erodes an input color image by a given binary square morphological filter. All pixels in the input image which their corresponding filter values are 1 are considered in the filtering process. Erosion for color images is implemented using Minimum math function.
Signature
output = xflip.erode(input, filter)
@param texture input input color image @param int filter binary square morphological filter @return texture output eroded output image
Dilates an input color image by a given binary square morphological filter. All pixels in the input image which their corresponding filter values are 1 are considered in the filtering process. Dilation for color images is implemented using Maximum math function.
Signature
output = xflip.dilate(input, filter)
@param texture input input color image @param int filter binary square morphological filter @return texture output dilated output image
Create a square morphological filter which all of its elements are 1.
Signature
output = xflip.createSquareMorphologyFilter(size)
@param int size side of square morphological filter (must be odd) @return int output output filter with 1 for all elements
Creates histogram of a desired channel of an input image.
Signature
histogram = xflip.createHistogram(input, channel)
@param texture input input image @param int channel desired channel (must be 0, 1 or 2) @return float histogram calculated histogram (an array of size 256)
Creates equalization histogram transform (HST) of a given histogram.
Signature
HST = xflip.createEqualizationHST(histogram)
@param float histogram input histogram (an array of size 256) @return float HST calculated equalization HST for the input histogram (an array of size 256)
Performs a given histogram transform (HST) on a desired channel of an input color image.
Signature
output = xflip.applyHST(input, HST, channel)
@param texture input input color image @param float HST histogram transform @param int channel desired channel (must be 0, 1 or 2) @return texture output output image
Performs a given histogram transform (HST) on a grayscale input image.
Signature
output = xflip.applyGrayscaleHST(input, HST)
@param texture input input grayscale image @param float HST histogram transform @return texture output output image
Pads width and height of an input image to the nearest powers of 2.
Signature
(output, originalSize) = xflip.padToPow2(input)
@param texture input input image @return texture output output padded image (each side to its nearest power of 2) @return int originalSize width and height of the input image (an array of size 2)
Crops input image according to the specified origin and the size.
Signature
output = xflip.crop(input, origin, size)
@param texture input input image @param int origin x and y of cropping area origin (top-left corner, an array of size 2) @param int size width and height of cropping area (an array of size 2) @return texture output output cropped image
Calculates Discrete Fourier Transform (DFT) of a grayscale input image. Output is a Float32 texture which its first and second channels are the amplitude and the phase components of the transformed input image, respectively.
Signature
output = xflip.applyDFT(input)
@param texture input grayscale input image @return texture output DFT of the input image (1st ch.: amplitude, 2nd ch.: phase, Float32)
Calculates Inverse Discrete Fourier Transform (DFTInv) of an input texture in the frequency domain. The input texture must have the same format as the output of xflip.applyDFT.
Signature
output = xflip.applyDFTInv(input)
@param texture input DFT texture (1st ch.: amplitude, 2nd ch.: phase, Float32) @return texture output output grayscale image in the spatial domain
Calculates Fast Fourier Transform (FFT) of an grayscale input image. Output is a Float32 texture which its first and second channels are the amplitude and the phase components of the transformed input image, respectively.
Here we apply radix-2 Cooley-Tukey FFT on subsequent rows and columns of the input image. Therefore, the width and height of the input image must be powers of 2.
Signature
output = xflip.applyFFT(input)
@param texture input grayscale input image (each side must be power of 2) @return texture output FFT of the input image (1st ch.: amplitude, 2nd ch.: phase, Float32)
Calculates Inverse Fast Fourier Transform (FFTInv) of an input texture in the frequency domain. The input texture must have the same format as the output of xflip.applyFFT.
Signature
output = xflip.applyFFTInv(input)
@param texture input FFT texture (1st ch.: amplitude, 2nd ch.: phase, Float32) @return texture output output grayscale image in the spatial domain
Creates grayscale spectrum of a DFT / FFT texture in log10 scale.
Signature
output = xflip.createSpectrumImage(input)
@param texture input DFT / FFT texture (1st ch.: amplitude, 2nd ch.: phase, Float32) @return texture output log-scaled spectrum of the transformation
Applies the frequency domain Gaussian low pass filter (LPF) with a given sigma on the input image. Generated filter has the same size as input image.
Signature
output = xflip.applyGaussianLPF(input, sigma)
@param texture input DFT / FFT texture (1st ch.: amplitude, 2nd ch.: phase, Float32) @param float sigma sigma of the Gaussian function (positive) @return texture output input DFT / FFT texture multiplied by the Gaussian LPF
Applies the frequency domain Gaussian high pass filter (HPF) with a given sigma on the input image. Generated filter has the same size as the input image.
Signature
output = xflip.applyGaussianHPF(input, sigma)
@param texture input DFT / FFT texture (1st ch.: amplitude, 2nd ch.: phase, Float32) @param float sigma sigma of the Gaussian function (positive) @return texture output input DFT / FFT texture multiplied by the Gaussian HPF