Skip to content

Operation Reference Table

Paula Rudy edited this page Nov 22, 2015 · 23 revisions

Operation Reference Table

Here you can find a table containing all the step types currently included in GRIP, including the file location within the project where they are defined, and a link to any relevant OpenCV documentation. A "y" in the "Generated?" column indicates the defining java file was automatically generated from the relevant OpenCV function.
Step Name Relevant OpenCV (if any) Description:
Blur cv::blur Replaces each pixel with an average of its neighborhood (reduces fine image detail)
Desaturate cv::cvtColor Converts a color image into grayscale.
RGB Threshold cv::inRange Converts a color image into black and white based on given threshold ranges for each channel (red, green and blue).
HSV Threshold cv::inRange Uses cv::inRange to threshold an image using the provided inclusive ranges of hue, saturation, and value (does not include white/pale colors- as opposed to HSL Threshold, which does)
HSL Threshold cv::inRange Uses cv::inRange to threshold an image using the provided inclusive ranges of hue, saturation, and lightness (includes white/pale colors, as opposed to HSV Threshold, which does not)
Find Blobs Finds places in the supplied image (an opencv "mat" object that satisfy certain characteristics. Outputs a "blobsReport" object (a list of the blobs detected).
Find Lines cv::LineSegmentDetector Find line segments in a color or grayscale image. Outputs a list of lines (“LinesReport” object).
Filter Lines cv::LineSegmentDetector Given a "LinesReport" object (the output of the "Find Lines" step- a list of lines), filter only the lines that meet certain criteria. This can be used to narrow down detected lines to only relevant ones. Outputs a "LinesReport" object (a list of lines).
Mask "Mask operations on matrices" (an opencv 2.4.12.0 tutorial) Masks off the specified area in an image (an opencv "mat" object). You must pass in a mask image of the same size as the image to be masked off. Any area of the input image where the mask is white is kept the same. Any area where the mask is black is changed to black.
Find Min and Max cv::minMaxLoc Find the minimum and maximum value points and their locations. This operation can only work with a single channel, so the input image must be in grayscale.
New Point (none) Create a point by x,y value. Use with the "rectangle" step.
New Size cv "Size" type Create a new cv “size” value. Use with the "resize" step.
Get Mat Info cv "Mat" class Provides access to the "size", "is empty"(t or f), "channels", "columns", "rows", and "high value" attributes of an opencv_core.Mat object (IE an image).
absdiff cv::absdiff Calculates the per-element absolute difference of two images (opencv "mat" objects). In the case of multi-channel images, each channel is processed independently. Images must be the same size. This step is a good way to find differences between two images (they will be non-black).
adaptiveThreshold cv::adaptiveThreshold This step converts a grayscale image to a black and white ("binary") image.
add cv::add Calculates the per-pixel addition of two images. Images must be the same size. In multi-channel images, each channel is processed separately.
addWeighted cv::addWeighted Calculates the weighted sum of two images. Images must be the same size. Alpha is the weight of the first image, beta is the weight of the second image, and gamma is a constant. In multi-channel images, each channel is processed separately.
applyColorMap cv::applyColorMap Applies a colormap selected from a given list of color maps (which contains a list of GNU Octave/MATLAB- equivalent colormaps) to the source image (an opencv "mat" object). Colormaps map color values in the source image to a color value given in the colormap.
bitwise_and cv::bitwise_and Calculates the per-element bit-wise AND of two images (opencv "mat" objects). In the case of multi-channel images, each channel is processed independently. Images must be the same size.
bitwise_not cv::bitwise_not Calculates the per-element bit-wise inversion of the input image. In the case of multi-channel images, each channel is processed independently.
bitwise_or cv::bitwise_or Calculates the per-element bit-wise or of two images (opencv "mat" objects). In the case of multi-channel images, each channel is processed independently. Images must be the same size.
bitwise_xor cv::bitwise_xor Calculates the per-element bit-wise xor of two images (opencv "mat" objects). In the case of multi-channel images, each channel is processed independently. Images must be the same size.
Canny cv::Canny This step applies a "canny edge detection" algorithm to an input image.
compare cv::compare Performs the per-element comparison of two images or an image and scalar value. When the comparison result is true, the corresponding element of output image is set to 255.
cvtColor cv::cvtColor This step is used to convert an input image from one color space to another (for example, a grayscale image to an RGB image). In case of a transformation to or from RGB color space, the order of the channels should be specified explicitly (RGB or BGR). Note that the default color format in OpenCV is often referred to as RGB but it is actually BGR (the bytes are reversed). So the first byte in a standard (24-bit) color image will be an 8-bit Blue component, the second byte will be Green, and the third byte will be Red. The fourth, fifth, and sixth bytes would then be the second pixel (Blue, then Green, then Red), and so on. See also: color conversions in opencv
dilate cv::dilate Applies a dilation to the given source image. In dilation, the value of an output pixel is the maximum value of all the pixels in the input pixel's "neighborhood". For example, in a binary image (black and white), if any of the pixels is set to the value 1 (white), the output pixel is set to 1. Pixels near the edge of an image have the same size and shape "neighborhood", but all the pixels in that neighborhood that would lie outside the boundaries of the input image are assumed to be the minimum value for that type of image. For example, in a black and white image, this would be "0" (black).
divide cv::divide Performs a per-element division of two images, using a scalar applied to the second image (IE result = input1 * scalar / input2).
erode cv::erode Applies an erosion to the given source image. In erosion, the value of an output pixel is the minimum value of all the pixels in the input pixel's "neighborhood". For example, in a binary image (black and white), if any of the pixels is set to the value 0 (black), the output pixel is set to 0. Pixels near the edge of an image have the same size and shape "neighborhood", but all the pixels in that neighborhood that would lie outside the boundaries of the input image are assumed to be the maximum value for that type of image. For example, in a black and white image, this would be "1" (white).
extractChannel cv::extractChannel Extracts a single channel from the source image. Channel to remove is indicated by an integer representing an index (starting at 0) of an array of the channels in the image.
flip cv::flip Does what it says on the tin. Flips an image vertically, horizontally, or both vertically AND horizontally.
GaussianBlur cv::GaussianBlur A Gaussian blur is a blur operation that gives more weight to central pixels and less weight to it's neighbors (the farther away a pixel is from the current center- ie the pixel whose result is currently being calculated- the less weight it is given. The size of the "neighborhood" and the difference in weights each pixel is given is determined using a 2D Gaussian function, where the stadard derivation in both the x and y direction (sigmaX and sigmaY) gives the distance from the center pixel, and the kernel size (ksize) gives the magnitude of the Gaussian (how quickly the weights change from the outside to the center of the neighborhood).
Laplacian cv::Laplacian
max cv::max Computes the per-element maximum of two images (opencv mat objects). The two images must be the same size. This outputs an image (opencv mat object) where each element represents the maximum value between the two input images.
medianBlur cv::medianBlur Replaces each pixel with the median value of its neighbors (reduces fine image detail). The size of the "window" within which to determine the median is given by the "ksize" parameter (and so "ksize" must be odd and greater than one).
min cv::min Computes the per-element minimum of two images (opencv mat objects). The two images must be the same size. This outputs an image (opencv mat object) where each element represents the minimum value between the two input images.
multiply cv::multiply Performs a per-element multiplication of two images, using a scalar (IE result = scalar * input1 * input2).
rectangle cv::rectangle This step draws a rectangle outline or a filled rectangle whose two opposite corners are pt1 and pt2.
resize cv::resize Resizes the input image. To use an openCV size to define the desired output image size, use the "dsize" parameter. If "dsize" is not used, the output size will be computed using fx and fy as percentages of the original size in the x and y direction respectively.
scaleAdd cv::scaleAdd Calculates the per-pixel addition of two images, where one image is multiplied by a scalar. Images must be the same size. In multi-channel images, each channel is processed seperately.
Sobel cv::Sobel
subtract cv::subtract Calculates the per-element difference between two images (opencv mat objects). Output is an image where each element represents the value resulting when that element of the second image is subtracted from the first. In the case of multi-channel images, each channel is processed independently.
threshold cv::threshold This step provides a single method for accessing a variety of threshold functions.
************************* More to come! *******************************************