Skip to content

Xflow image processing operator list

einabadi edited this page Feb 15, 2013 · 6 revisions

Table of Contents

Basic Pixel-Wise Operations

xflow.grayscale

Converts an input color image to grayscale image.

s = 0.2126 * r + 0.7152 * g + 0.0722 * b

Signature

 output = xflow.grayscale(input)
 @param     texture     input       color image
 @return    texture     output      grayscale image

xflow.complement

Complements colors of an input image.

output = 255 - input (channel-wise)

Signature

 output = xflow.complement(input)
 @param     texture     input       input color image
 @return    texture     output      color complement of the input image

xflow.dim

Dims an input image by a ratio.

output = ratio * input (channel-wise)

Signature

 output = xflow.dim(input, ratio)
 @param     texture     input       input image
 @param     float       ratio       dimming ratio (positive)
 @return    texture     output      dimmed image

xflow.threshold

Thresholds an input grayscale image by a given threshold value.

output = (input > threshold) ? 255 : 0

Signature

 output = xflow.threshold(input, threshold)
 @param     texture     input       input grayscale image
 @param     int         threshod    threshold value [0,255]
 @return    texture     output      thresholded grayscale image

xflow.sliceColor

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 = xflow.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

xflow.mulColorMatrix

Multiplies a 4x4 float color weight matrix to an input image.

output = weights * input (matrix multiplication)

Signature

 output = xflow.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

xflow.createSaturateMatrix

Creates a 4x4 saturate weight matrix according to a saturation degree (weight) to be used with xflow.mulColorMatrix. Weights are based on SVG filter effects.

Signature

 output = xflow.createSaturateMatrix(weight)
 @param     float       weight      weight value
 @return    float       output      a 4x4 saturate weight matrix

xflow.mask

Masks first image with second image according to a weight value.

output = input1 + weight * input2 (channel-wise)

Signature

 output = xflow.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 result

xflow.getChannelMagnitude

Returns channel-wise magnitude (Euclidean norm) of two input images in a new image.

output = sqrt(input1^2 + input2^2) (channel-wise)

Signature

 output = xflow.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
Clone this wiki locally