Skip to content

Operation Reference Table

Paula Rudy edited this page Dec 18, 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. An entry under the "Generated from" column denotes the source code responsible for that step was computer generated from the given OpenCV function.
Step Name: Generated from (if applicable): Description:
Blur n/a Replaces each pixel with an average of its neighborhood (reduces fine image detail). Uses cv::blur.
Desaturate n/a Converts a color image into grayscale. Uses cv::cvtColor.
RGB Threshold n/a Converts a color image into black and white based on given threshold ranges for each channel (red, green and blue). Uses cv::inRange.
HSV Threshold n/a 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). See also cv::inRange.
HSL Threshold n/a 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). See also cv::inRange.
Find Contours n/a Finds contours in a binary image (aka black and white image). This function doesn't take into account the border of the image, so contours touching the image border are clipped. If the "external only" box is checked, only the outer contours are detected (contours within another contour are discarded). Outputs a "contoursReport" object (a list of the contours detected). Uses cv::findContours, which implements Satoshi Suzuki's contour finding algorithm as described in "Topological structural analysis of digitized binary images by border following" (published 1985 in "Computer Vision, Graphics, and Image Processing" volume 30, issue 1, pages 32-46) using Rosenfeld and Weszka's algorithm described in "An Improved Method of Angle Detection on Digital Curves" (published in "IEEE Transactions on Computers", vol.24, no. 9, pp. 940-941, September 1975) as the contour approximation method. See also cv::findContours.
Filter Contours n/a Given a "contoursReport" object (the output of the "Find Contours" step- a list of contours), filter only the contours that meet certain criteria. This can be used to narrow down detected contours to only relevant ones. Outputs a "contoursReport" object (a list of contours). See also cv::findContours.
Convex Hulls n/a Given a "contoursReport" object (the output of the "Find Contours" step- a list of contours), finds the convex hull of each contour (IE the smallest convex shape that will encompass that contour). Outputs a "contoursReport" object (a list of contours: in this case, each contour represents a convex hull with the points listed in counter clockwise order). See also cv::convexHull.
Find Blobs n/a 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 n/a Find line segments in a color or grayscale image. Outputs a list of lines (“LinesReport” object). See also cv::LineSegmentDetector.
Filter Lines n/a 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). See also cv::LineSegmentDetector.
Mask n/a 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. See also: "mask operations on matrices" (an opencv 2.4.12.0 tutorial).
Find Min and Max n/a 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. Uses cv::minMaxLoc.
New Point n/a Create a point by x,y value. Use with the "rectangle" step.
New Size n/a Create a new cv “size” value. Use with the "resize" step. See also: cv "Size" type
Get Mat Info n/a 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). See also: cv "Mat" class.
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 using the rule given in the "cmpop" parameter. When the comparison result is true, the corresponding element of output image is set to 255. See also: OpenCV compare types
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 The Laplacian of an image is a special case of the Sobel edge detection method where edges are found where the second derivative is 0. The parameter "ksize" gives the dimensions of the kernel to be used to and so must be odd (IE ksize = 5 results in a 5 by 5 kernel). For the case where "ksize" = 1, a special 3x3 kernel is used. "ksize" cannot exceed 31. The "scale" parameter is a scale to be applied to the computed derivative. The "delta" parameter is added to the results for each pixel prior to storing them in the resulting image. The "borderType" parameter chooses how the edge pixels are computed. See also: the list of possible border handling methods.
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 A method of edge detection using the derivatives of a function of the change of intensity of the pixels of an image. Results in an image where the value of a nonzero pixel is the magnitude of the derivative calculated at that point. The derivative is calculated separately in the x axis direction and the y axis direction, and then combined. The order of the derivative to calculate (IE first derivative, second derivative, etc.) in the x direction is given by the parameter "dx". The order of the derivative in the y direction is given by the "dy" parameter. Note that any decimal component of dx and dy is discarded. The parameter "ksize" gives the dimensions of the kernel to be used to compute that derivative and so must be odd (IE ksize = 5 results in a 5 by 5 kernel). For the case where "ksize" = 1, a 3x1 and 1x3 kernel is used to compute the derivative in the x and y direction respectively. Please note that dx and dy must be greater than or equal to 0, and (dx+dy) must be greater than 0. When "ksize" is not -1, then dx and dy must both be less than ksize. For the case where "ksize"= -1, the Scharr aperture is used (a special kernel that can be more accurate in certain cases) and either (dx, dy) == (0,1) or (dx, dy) == (1,0). The "scale" parameter is a scale to be applied to the computed derivative. The "delta" parameter is added to the results for each pixel prior to storing them in the resulting image. The "borderType" parameter chooses how the edge pixels are computed. See also: the list of possible border handling methods.
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! *******************************************