sj.opencv
Class OpenCV

java.lang.Object
  extended by sj.opencv.OpenCV

public class OpenCV
extends java.lang.Object

Author: Siggi & Julián Date: Jul 28, 2010


Constructor Summary
OpenCV()
           
 
Method Summary
static void absDiff(IplImage src1, IplImage src2, IplImage dst)
          Calculates the absolute difference between two arrays.
static void absDiffS(IplImage src1, IplImage dst, Scalar value)
          Calculates the absolute difference between an array and a scalar.
static void adaptiveThreshold(IplImage src, IplImage dst, double maxValue)
          Applies an adaptive threshold to an array with default values.
static void adaptiveThreshold(IplImage src, IplImage dst, double maxValue, Constants.AdaptiveThreshAlg thresh_alg, Constants.AdaptiveThreshType thresh_type, int block_size, double param1)
          Applies an adaptive threshold to an array.
static void add(IplImage src1, IplImage src2, IplImage dst)
          Computes the per-element sum of two arrays.
static void add(IplImage src1, IplImage src2, IplImage dst, IplImage mask)
          Computes the per-element sum of two arrays.
static void addS(IplImage src, Scalar value, IplImage dst)
          Computes the sum of an array and a scalar.
static void addS(IplImage src, Scalar value, IplImage dst, IplImage mask)
          Computes the sum of an array and a scalar.
static void addWeighted(IplImage src1, double alpha, IplImage src2, double beta, double gamma, IplImage dst)
          Computes the weighted sum of two arrays.
static IplImage allocateIplImage(int width, int height)
          Calls allocateIPLImage with default 8bit pixel depth and BGRA color model
static IplImage allocateIplImage(int width, int height, Constants.PixelDepth pixel_depth, Constants.ColorModel color_model)
          Natively allocates an IplImage and returns a pointer to it Also puts that into a collection that will be deallocated when application exits
static IplImage allocateIplImage(int width, int height, Constants.PixelDepth pixel_depth, Constants.ColorModel color_model, java.nio.ByteBuffer buffer)
           
static void and(IplImage src1, IplImage src2, IplImage dst)
          Calculates the per-element bit-wise conjunction of two arrays.
static void and(IplImage src1, IplImage src2, IplImage dst, IplImage mask)
          Calculates the per-element bit-wise conjunction of two arrays.
static void andS(IplImage src, Scalar value, IplImage dst)
          Calculates the per-element bit-wise conjunction of an array and a scalar.
static void andS(IplImage src, Scalar value, IplImage dst, IplImage mask)
          Calculates the per-element bit-wise conjunction of an array and a scalar.
static Scalar avg(IplImage img)
          Calculates the average (mean) of array elements, independently for each channel:
static Scalar avg(IplImage img, IplImage mask)
          Calculates the average (mean) of array elements, independently for each channel.
static void avgSdv(IplImage img, Scalar mean, Scalar stdDev)
          Calculates the average value and standard deviation of array elements, independently for each channel.
static void avgSdv(IplImage img, Scalar mean, Scalar stdDev, IplImage mask)
          Calculates the average value and standard deviation of array elements, independently for each channel.
static void calcBackProject(IplImage img, IplImage backProject, Histogram hist)
           
static void calcBackProject(java.util.List<IplImage> images, IplImage backProject, Histogram hist)
           
static void calcHist(IplImage img, Histogram hist, int accumulate, IplImage mask)
           
static void calcHist(java.util.List<IplImage> images, Histogram hist, int accumulate, IplImage mask)
           
static void calibrateCamera2(float[] objectPoints, float[] imagePoints, int[] pointCounts, java.awt.Dimension imageSize, float[] cameraMatrix, float[] distortion, float[] rotations, float[] translations, Constants.CalibrationFlag[] flags)
           
static int camshift(IplImage probImage, java.awt.Rectangle window, TermCriteria criteria, ConnectedComp comp, Box2D box)
           
static Capture captureFromCAM(int index)
          Initializes capturing a video from a camera
static Capture captureFromFile(java.lang.String filename)
          Initializes capturing a video from a file
static void circle(IplImage img, java.awt.Point center, int radius, Scalar color)
          Draws a simple or filled circle with a given center and radius using default parameters: thickness equals 1, line type equals CV_8, and shift is 0.
static void circle(IplImage img, java.awt.Point center, int radius, Scalar color, int thickness, Constants.LineType lineType, int shift)
          Draws a simple or filled circle with a given center and radius.
static void clearHist(Histogram hist)
           
static void clearND(IplImage img, int[] idx)
          Clears (sets to zero) a specific array element.
static IplImage cloneImage(IplImage img)
          Makes a full copy of an image, including the header, data, and ROI.
static void cmp(IplImage src1, IplImage src2, IplImage dst, Constants.CompareMode mode)
          Performs per-element comparison of two arrays.
static void cmpS(IplImage src, double value, IplImage dst, Constants.CompareMode mode)
          Performs per-element comparison of an array and a scalar.
static void convertScale(IplImage src, IplImage dst)
          Copies one array to another and performs type conversion.
static void convertScale(IplImage src, IplImage dst, double scale, double shift)
          Copies one array to another with optional scaling, which is performed first, and/or optional type conversion, performed after.
static void copy(IplImage src, IplImage dst)
          Copies one array to another.
static void copy(IplImage src, IplImage dst, IplImage mask)
          Copies one array to another.
static int countNonZero(IplImage img)
          Counts non-zero array elements.
static Histogram createHist(int dims, int[] sizes, Constants.HistogramType type, float[] ranges, int uniform)
           
static MemStorage createMemStorage(int blockSize)
          Creates an empty memory storage.
static VideoWriter createVideoWriter(java.lang.String filename, Constants.VideoCodec videoCodec, double fps, java.awt.Dimension frameSize, boolean isColor)
           
static void cvtColor(IplImage src, IplImage dst)
          Converts the colormode of src to the colormode of dst and stores the result in dst
static void cvtColor(IplImage src, IplImage dst, Constants.ColorConversion conversion)
          Converts the colormode of src according to the conversion method provided.
static void cvtScaleAbs(IplImage src, IplImage dst)
          Converts input array elements to another 8-bit unsigned integer.
static void cvtScaleAbs(IplImage src, IplImage dst, double scale, double shift)
          Converts input array elements to another 8-bit unsigned integer with optional linear transformation.
static void deAllocate(BasePointer pointer)
          Deallocates an arbitrary pointer
static Blob[] detectBlobs(IplImage im, int minArea, int maxArea, int maxBlobs, boolean findHoles, int maxVertices)
          This method finds blobs in image, calculates their centroids, areas and moments and returns their contours
static void div(IplImage src1, IplImage src2, IplImage dst)
          Performs per-element division of two arrays.
static void div(IplImage src1, IplImage src2, IplImage dst, double scale)
          Performs per-element division of two arrays.
static void drawChessboardCorners(IplImage img, java.awt.Dimension patternSize, float[] corners, int cornerCount, boolean patternWasFound)
           
static void ellipseBox(IplImage img, Box2D box, Scalar color)
           
static void ellipseBox(IplImage img, Box2D box, Scalar color, int thickness, Constants.LineType lineType, int shift)
           
static void exp(IplImage src, IplImage dst)
          Calculates the exponent of every array element.
static void extractSURF(IplImage img, IplImage mask, java.util.List<SURFPoint> keypoints, java.util.List<float[]> descriptors, MemStorage storage, SURFParams params)
           
static boolean findChessboardCorners(IplImage img, java.awt.Dimension patternSize, float[] corners, int[] cornerCount, Constants.CalibrationFlag[] flags)
           
static Contour[] findContours(IplImage img, MemStorage storage)
           
static Contour[] findContours(IplImage img, MemStorage storage, Constants.FindContoursMode mode, Constants.FindContoursMethod method, java.awt.Point offset)
           
static void findCornerSubPix(IplImage img, float[] corners, int cornerCount, java.awt.Dimension winSize, java.awt.Dimension zeroZoneSize, TermCriteria criteria)
           
static void findOutliers(float[] points, int pointSize, int nPoints, int[] outliers, int kdTrees, int knn, int searchChecks, double stdDevFactor)
           
static Box2D fitEllipse2(float[] points)
           
static Box2D fitEllipse2(java.util.List<java.awt.Point> points)
           
static FLANNIndex FLANNIndex(float[] features, int featureSize, int nFeatures, FLANNIndexParams params)
           
static void flip(IplImage src, IplImage dst, Constants.FlipMode mode)
          Flips an image around the x-axis, y-axis, or both.
static void floodFill(IplImage src, java.awt.Point seed_point, Scalar lo_diff, Scalar up_diff, IplImage mask)
          Fills a connected component with the given color
static void floodFill(IplImage src, java.awt.Point seed_point, Scalar new_val, Scalar lo_diff, Scalar up_diff, Constants.FloodFillConnectivity connectivity, Constants.FloodFillFlags flags, IplImage mask)
          Fills a connected component with the given color
static void GEMM(IplImage src1, IplImage src2, double alpha, IplImage src3, double beta, IplImage dst, Constants.GEMMFlag[] gemmFlags)
          Performs generalized matrix multiplication.
static Scalar get1D(IplImage img, int idx0)
          Return a specific array element.
static Scalar get2D(IplImage img, int idx0, int idx1)
          Return a specific array element.
static Scalar get3D(IplImage img, int idx0, int idx1, int idx2)
          Return a specific array element.
static double getCaptureProperty(Capture capture, Constants.CaptureProperty property)
          Gets video capturing properties.
static int getDimSize(IplImage img, int index)
          Returns the particular dimension size (number of elements per that dimension).
static int getImageCOI(IplImage img)
          Returns the index of the channel of interest of an image.
static java.awt.Rectangle getImageROI(IplImage img)
          Returns the image region of interest (ROI).
static float getMaxHistValue(Histogram hist)
           
static float getMinHistValue(Histogram hist)
           
static Scalar getND(IplImage img, int[] idx)
          Return a specific array element.
static double getReal1D(IplImage img, int idx0)
          Return a specific element of a single-channel 1D array.
static double getReal2D(IplImage img, int idx0, int idx1)
          Return a specific element of a single-channel 2D array.
static double getReal3D(IplImage img, int idx0, int idx1, int idx2)
          Return a specific element of a single-channel 3D array.
static double getRealND(IplImage img, int[] idx)
          Return a specific element of a single-channel n-dimensional array.
static java.awt.Dimension getSize(IplImage img)
          Returns the size of a matrix or the size of an image ROI.
static StarKeypoint[] getStarKeypoints(IplImage img, MemStorage storage, StarDetectorParams params)
           
static java.awt.Rectangle[] haarDetectObjects(IplImage img, HaarClassifierCascade cascade, MemStorage storage)
          Default version of haarDetectObjects with parameters suited for object detection in video images.
static java.awt.Rectangle[] haarDetectObjects(IplImage img, HaarClassifierCascade cascade, MemStorage storage, double scaleFactor, int minNeighbors, Constants.HaarClassifierFlag[] flags, java.awt.Dimension minSize)
          Detects objects the cascade has been trained for and returns those regions as a sequence of rectangles.
static Font initFont(Constants.FontType[] fontType, double hScale, double vScale, double shear, int thickness, Constants.LineType lineType)
           
static void initUndistortMap(float[] cameraMatrix, float[] distortion, IplImage mapx, IplImage mapy)
          Computes an undistortion map.
static void inRange(IplImage src, IplImage lower, IplImage upper, IplImage dst)
          Checks that array elements lie between the elements of two other arrays dst(I) is set to 0xff (all 1 -bits) if src(I) is within the range and 0 otherwise.
static void inRangeS(IplImage src, Scalar lower, Scalar upper, IplImage dst)
          Checks that array elements lie between two scalars dst(I)’ is set to 0xff (all 1 -bits) if ‘src(I)’ is within the range and 0 otherwise.
static void knnSearch(FLANNIndex index, float[] queries, int querySize, int nQueries, int[] indices, float[] dists, int knn, FLANNSearchParams params)
           
static void line(IplImage img, java.awt.Point pt1, java.awt.Point pt2, Scalar color)
           
static void line(IplImage img, java.awt.Point pt1, java.awt.Point pt2, Scalar color, int thickness, Constants.LineType lineType, int shift)
          The function draws the line segment between pt1 and pt2 points in the image.
static HaarClassifierCascade loadHaarClassifierCascade(java.lang.String filename)
          Loads a trained cascade of Haar classifiers from a file.
static IplImage loadImage(java.lang.String location, Constants.ImageLoadColorMode color_mode)
          The function cvLoadImage() loads an image from the specified file and returns the pointer to the loaded image.
static void matMul(IplImage src1, IplImage src2, IplImage dst)
          Performs matrix multiplication.
static void matMulAdd(IplImage src1, IplImage src2, IplImage src3, IplImage dst)
          Performs matrix multiplication with optional shifting.
static void polyLine(IplImage img, java.util.List<java.awt.Point[]> pts, int[] npts, int contours, boolean isClosed, Scalar color)
          Draws single or multiple polygonal curves using default parameters: thickness equals 1, line type equals CV_8, and shift is 0.
static void polyLine(IplImage img, java.util.List<java.awt.Point[]> pts, int[] npts, int contours, boolean isClosed, Scalar color, int thickness, Constants.LineType lineType, int shift)
          Draws single or multiple polygonal curves.
static void putText(IplImage img, java.lang.String text, java.awt.Point pos, Font font, Scalar color)
           
static boolean queryFrame(Capture capture, IplImage dst)
          Grabs and retrieves a frame from a capture source The function provides a modifiable image dst with the image data
static void rectangle(IplImage img, java.awt.Point pt1, java.awt.Point pt2, Scalar color)
          Draws a simple, thick, or filled rectangle using default parameters: thickness equals 1, line type equals CV_8, and shift is 0.
static void rectangle(IplImage img, java.awt.Point pt1, java.awt.Point pt2, Scalar color, int thickness, Constants.LineType lineType, int shift)
          Draws a simple, thick, or filled rectangle.
static void rectangle(IplImage img, java.awt.Rectangle rect, Scalar color)
          Draws a simple, thick, or filled rectangle using default parameters: thickness equals 1, line type equals CV_8, and shift is 0.
static void rectangle(IplImage img, java.awt.Rectangle rect, Scalar color, int thickness, Constants.LineType lineType, int shift)
          Draws a simple, thick, or filled rectangle.
static void releaseCapture(Capture capture)
          Releases the capture object allocated by captureFromFile() or captureFromCAM().
static void releaseHaarClassifierCascade(HaarClassifierCascade cascade)
          Releases the Haar classifier cascade.
static void releaseHist(Histogram hist)
           
static void releaseMemStorage(MemStorage storage)
          Deallocates all storage memory blocks or returns them to the parent, if any.
static void releaseVideoWriter(VideoWriter writer)
           
static void remap(IplImage src, IplImage dst, IplImage mapx, IplImage mapy, Constants.InterpolationMode mode, boolean fillOutliers, Scalar fillValue)
          Transforms the source image using the specified map:
static void resetImageROI(IplImage img)
          Resets the image Region of Interest (ROI) to include the entire image and releases the ROI structure.
static void resize(IplImage src, IplImage dst)
          Resizes the source image to the destination image's dimensions using linear interpolation.
static void resize(IplImage src, IplImage dst, Constants.InterpolationMode mode)
          Resizes the source image to the destination image's dimensions using the specified linear interpolation.
static void rodrigues2(float[] src, float[] dst)
          This function performs the Rodrigues transform.
static void saveImage(java.lang.String location, IplImage image)
          Saves an image to a specified file.
static void scaleHist(Histogram hist, double scale, double shift)
           
static void set(IplImage dst, Scalar value)
          every element of an array to a given value array arr is of IplImage type, then is ROI used, but COI must not be set.
static void set(IplImage dst, Scalar value, IplImage mask)
          every element of an array to a given value array arr is of IplImage type, then is ROI used, but COI must not be set.
static void setCaptureProperty(Capture capture, Constants.CaptureProperty property, double value)
          Sets video capture properties
static void setChannel(IplImage im, int channel, int value)
          Sets a certain channel in an image to a value (mostly useful to set alpha to 255 after color conversion to 4byte pixel depth)
static void setImageCOI(IplImage img, int coi)
          Sets the channel of interest in an image.
static void setImageROI(IplImage img, java.awt.Rectangle roi)
          Sets an image Region Of Interest (ROI).
static int solve(float[] A, float[] b, float[] x, int rows, int cols, Constants.SolveMethod method)
           
static void split(IplImage src, IplImage dst0, IplImage dst1, IplImage dst2, IplImage dst3)
           
static void sub(IplImage src1, IplImage src2, IplImage dst, IplImage mask)
          Computes the per-element difference between two arrays The function subtracts one array from another one dst(I)=src1(I)-src2(I) if mask(I)!=0 All the arrays must have the same type, except the mask, and the same size (or ROI size).
static void subRS(IplImage src1, Scalar value, IplImage dst, IplImage mask)
          Computes the difference between a scalar and an array.
static void subS(IplImage src1, Scalar value, IplImage dst, IplImage mask)
          Computes the difference between an array and a scalar.
static Scalar sum(IplImage im)
          Adds up array elements The function calculates the sum S of array elements, independently for each channel the array is IplImage and COI is set, the function processes the selected channel only and stores the sum to the first scalar component.
static void svd(float[] A, float[] W, float[] U, float[] V, int rows, int cols, Constants.SVDFlag[] flags)
           
static void threshold(IplImage src, IplImage dst, double threshold, double maxValue, Constants.ThresholdType threshold_type)
          Applies a fixed-level threshold to array elements
static void undistort2(IplImage src, IplImage dst, float[] cameraMatrix, float[] distortion)
          Transforms the image to compensate radial and tangential lens distortion.
static int writeFrame(VideoWriter writer, IplImage img)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OpenCV

public OpenCV()
Method Detail

allocateIplImage

public static IplImage allocateIplImage(int width,
                                        int height,
                                        Constants.PixelDepth pixel_depth,
                                        Constants.ColorModel color_model)
Natively allocates an IplImage and returns a pointer to it Also puts that into a collection that will be deallocated when application exits

Parameters:
width - of image
height - of image
pixel_depth - of image
color_model - of image
Returns:
an IplImage pointer

allocateIplImage

public static IplImage allocateIplImage(int width,
                                        int height,
                                        Constants.PixelDepth pixel_depth,
                                        Constants.ColorModel color_model,
                                        java.nio.ByteBuffer buffer)
Parameters:
width - - The width of the image.
height - - The height of the image.
pixel_depth - - The pixel depth of the image.
color_model - - The color model of the image.
buffer - - A byte buffer containing the image data.
Returns:
an IplImage pointer

allocateIplImage

public static IplImage allocateIplImage(int width,
                                        int height)
Calls allocateIPLImage with default 8bit pixel depth and BGRA color model

See Also:
allocateIPLImage(int width, int height, PixelDepth pixel_depth, ColorModel color_model)

deAllocate

public static void deAllocate(BasePointer pointer)
Deallocates an arbitrary pointer

Parameters:
pointer - the native object to be deallocated
Throws:
java.lang.RuntimeException - if pointer is already deallocated
java.lang.RuntimeException - if pointer type is not recognized

absDiff

public static void absDiff(IplImage src1,
                           IplImage src2,
                           IplImage dst)
Calculates the absolute difference between two arrays.

dst(i) = | src1(i) - src2(i) |

The arrays must have the same data type and the same size (or ROI size).

Parameters:
src1 - – the first source image
src2 - – the second source image
dst - – the destination image

absDiffS

public static void absDiffS(IplImage src1,
                            IplImage dst,
                            Scalar value)
Calculates the absolute difference between an array and a scalar.

dst(i) = | src1(i) - value |

The arrays must have the same pixel depth and the same size (or ROI size).

Parameters:
src - – the source image
dst - – the destination image
value - – the scalar

add

public static void add(IplImage src1,
                       IplImage src2,
                       IplImage dst)
Computes the per-element sum of two arrays.

dst(i) = src1(i) + src2(i)

All the arrays must have the same type and the same size (or ROI size). For types that have limited range this operation is saturating.

Parameters:
src1 - - the first source array
src2 - - the second source array
dst - - the destination array

add

public static void add(IplImage src1,
                       IplImage src2,
                       IplImage dst,
                       IplImage mask)
Computes the per-element sum of two arrays.

dst(i) = src1(i) + src2(i), if mask(i) != 0

The operation mask is optional, and a null value can be passed as mask argument. All the arrays must have the same type, except the mask, and the same size (or ROI size). For types that have limited range this operation is saturating.

Parameters:
src1 - - the first source array
src2 - - the second source array
dst - - the destination array
mask - - the optional operation mask, 8-bit single channel array; specifies elements of the destination array to be changed

addS

public static void addS(IplImage src,
                        Scalar value,
                        IplImage dst)
Computes the sum of an array and a scalar.

dst(i) = src(i) + value

All the arrays must have the same type and the same size (or ROI size). For types that have limited range this operation is saturating.

Parameters:
src - - the source array
value - - the scalar
dst - - the destination array

addS

public static void addS(IplImage src,
                        Scalar value,
                        IplImage dst,
                        IplImage mask)
Computes the sum of an array and a scalar.

dst(i) = src(i) + value, if mask(i) != 0

The operation mask is optional, and a null value can be passed as mask argument. All the arrays must have the same type, except the mask, and the same size (or ROI size). For types that have limited range this operation is saturating.

Parameters:
src - - the source array
value - - the scalar
dst - - the destination array
mask - - the optional operation mask, 8-bit single channel array; specifies elements of the destination array to be changed

addWeighted

public static void addWeighted(IplImage src1,
                               double alpha,
                               IplImage src2,
                               double beta,
                               double gamma,
                               IplImage dst)
Computes the weighted sum of two arrays.

dst(i) = src1(i)*alpha + src2(i)*beta + gamma

All the arrays must have the same type and the same size (or ROI size). For types that have limited range this operation is saturating.

Parameters:
src1 - - the first source array
alpha - - weight of the first array's elements
src2 - - the second source array
beta - - weight of the second array's elements
gamma - - scalar added to each sum
dst - - the destination array

and

public static void and(IplImage src1,
                       IplImage src2,
                       IplImage dst)
Calculates the per-element bit-wise conjunction of two arrays.

dst(i) = src1(i) & src2(i)

In the case of floating-point arrays their bit representations are used for the operation. All the arrays must have the same type and the same size.

Parameters:
src1 - - the first source array
src2 - - the second source arrray
dst - - the destination array

and

public static void and(IplImage src1,
                       IplImage src2,
                       IplImage dst,
                       IplImage mask)
Calculates the per-element bit-wise conjunction of two arrays.

dst(i) = src1(i) & src2(i), if mask(i) != 0

The operation mask is optional, and a null value can be passed as mask argument. In the case of floating-point arrays their bit representations are used for the operation. All the arrays must have the same type, except the mask, and the same size.

Parameters:
src1 - - the first source array
src2 - - the second source arrray
dst - - the destination array
mask - - the optional operation mask, 8-bit single channel array; specifies elements of the destination array to be changed

andS

public static void andS(IplImage src,
                        Scalar value,
                        IplImage dst)
Calculates the per-element bit-wise conjunction of an array and a scalar.

dst(i) = src(i) & value

Prior to the actual operation, the scalar is converted to the same type as that of the array(s). In the case of floating-point arrays their bit representations are used for the operation. All the arrays must have the same type, except the mask, and the same size.

Parameters:
src - - the source array
value - - the scalar
dst - - the destination array

andS

public static void andS(IplImage src,
                        Scalar value,
                        IplImage dst,
                        IplImage mask)
Calculates the per-element bit-wise conjunction of an array and a scalar.

dst(i) = src(i) & value, if mask(i) != 0

The operation mask is optional, and a null value can be passed as mask argument. Prior to the actual operation, the scalar is converted to the same type as that of the array(s). In the case of floating-point arrays their bit representations are used for the operation. All the arrays must have the same type, except the mask, and the same size.

Parameters:
src - - the source array
value - - the scalar
dst - - the destination array
mask - - the optional operation mask, 8-bit single channel array; specifies elements of the destination array to be changed

avg

public static Scalar avg(IplImage img)
Calculates the average (mean) of array elements, independently for each channel:

Parameters:
img - - the array
Returns:
the Scalar containing the average for each channel

avg

public static Scalar avg(IplImage img,
                         IplImage mask)
Calculates the average (mean) of array elements, independently for each channel.

Parameters:
img - - the array
mask - - the optional operation mask
Returns:
the Scalar containing the average for each channel

avgSdv

public static void avgSdv(IplImage img,
                          Scalar mean,
                          Scalar stdDev)
Calculates the average value and standard deviation of array elements, independently for each channel.

Parameters:
img - - the array
mean - - the Scalar where the average values will be stored
stdDev - - the Scalar where the standard deviations will be stored

avgSdv

public static void avgSdv(IplImage img,
                          Scalar mean,
                          Scalar stdDev,
                          IplImage mask)
Calculates the average value and standard deviation of array elements, independently for each channel.

Parameters:
img - - the array
mean - - the Scalar where the average values will be stored
stdDev - - the Scalar where the standard deviations will be stored
mask - - the optional operation mask

clearND

public static void clearND(IplImage img,
                           int[] idx)
Clears (sets to zero) a specific array element.

Parameters:
img - - the input array
idx - - an array of the element indices to be cleared

cloneImage

public static IplImage cloneImage(IplImage img)
Makes a full copy of an image, including the header, data, and ROI.

Parameters:
img - - the original image
Returns:
the cloned image

cmp

public static void cmp(IplImage src1,
                       IplImage src2,
                       IplImage dst,
                       Constants.CompareMode mode)
Performs per-element comparison of two arrays.

dst(i) = src1(i) op src2(i)

dst(i) is set to 0xff (all 1-bits) if the specific relation between the elements is true and 0 otherwise. All the arrays must have the same size (or ROI size). The source arrays must have a single channel.

Parameters:
src1 - - the first source array, must have a single channel
src2 - - the second source array, must have a single channel
dst - - the destination array, must have 8u or 8s type
mode - - the relation to be checked between the two elements
  • CV_CMP_EQ: src1(i) “equal to” src2(i)
  • CV_CMP_GT: src1(i) “greater than” src2(i)
  • CV_CMP_GE: src1(i) “greater or equal” src2(i)
  • CV_CMP_LT: src1(i) “less than” src2(i)
  • CV_CMP_LE: src1(i) “less or equal” src2(i)
  • CV_CMP_NE: src1(i) “not equal” src2(i)

cmpS

public static void cmpS(IplImage src,
                        double value,
                        IplImage dst,
                        Constants.CompareMode mode)
Performs per-element comparison of an array and a scalar.

dst(i) = src1(i) op value

dst(i) is set to 0xff (all 1-bits) if the specific relation between the elements is true and 0 otherwise. All the arrays must have the same size (or ROI size).

Parameters:
src1 - - the source array, must have a single channel
value - - the scalar value to compare each array element with
dst - - the destination array, must have 8u or 8s type
mode - - the relation to be checked between the two elements
  • CV_CMP_EQ: src1(i) “equal to” value
  • CV_CMP_GT: src1(i) “greater than” value
  • CV_CMP_GE: src1(i) “greater or equal” value
  • CV_CMP_LT: src1(i) “less than” value
  • CV_CMP_LE: src1(i) “less or equal” value
  • CV_CMP_NE: src1(i) “not equal” value

convertScale

public static void convertScale(IplImage src,
                                IplImage dst)
Copies one array to another and performs type conversion. All the channels of multi-channel arrays are processed independently.

The type of conversion is done with rounding and saturation. That is, if the result of scaling plus conversion cannot be represented exactly by a value of the destination array element type, it is set to the nearest representable value on the real axis.

This is equivalent to calling convertScale(src, dst, 1.0, 0).

Parameters:
src - - the source array
dst - - the destination array

convertScale

public static void convertScale(IplImage src,
                                IplImage dst,
                                double scale,
                                double shift)
Copies one array to another with optional scaling, which is performed first, and/or optional type conversion, performed after. All the channels of multi-channel arrays are processed independently.

The type of conversion is done with rounding and saturation. That is, if the result of scaling plus conversion cannot be represented exactly by a value of the destination array element type, it is set to the nearest representable value on the real axis.

In the case of scale=1, shift=0 no pre-scaling is done. This is a specially optimized case and it has the appropriate Convert name. If the source and destination arrays have equal types, this is also a special case that can be used to scale and shift a matrix or an image and that is called Scale .

Parameters:
src - - the source array
dst - - the destination array
scale - - the scale factor
shift - - the value added to the scaled source array elements

cvtScaleAbs

public static void cvtScaleAbs(IplImage src,
                               IplImage dst)
Converts input array elements to another 8-bit unsigned integer. The function is similar to convertScale() , but it stores absolute values of the conversion results. It is equivalent to calling cvtScaleAbs(src, dst, 1.0, 0).

The function supports only destination arrays of 8u (8-bit unsigned integers) type; for other types the function can be emulated by a combination of convertScale() and abs() functions.

Parameters:
src - - the source array
dst - - the destination array

cvtScaleAbs

public static void cvtScaleAbs(IplImage src,
                               IplImage dst,
                               double scale,
                               double shift)
Converts input array elements to another 8-bit unsigned integer with optional linear transformation. The function is similar to convertScale() , but it stores absolute values of the conversion results.

The function supports only destination arrays of 8u (8-bit unsigned integers) type; for other types the function can be emulated by a combination of convertScale() and abs() functions.

Parameters:
src - - the source array
dst - - the destination array
scale - - the scale factor
shift - - the value added to the scaled source array elements

copy

public static void copy(IplImage src,
                        IplImage dst)
Copies one array to another.

dst(i) = src(i)

Both arrays must have the same type, the same number of dimensions, and the same size. If any of the passed arrays is of IplImage type, then its ROI and COI fields are used.

Parameters:
src - - the source array
dst - - the destination array

copy

public static void copy(IplImage src,
                        IplImage dst,
                        IplImage mask)
Copies one array to another.

dst(i) = src(i), if mask(i) != 0

The operation mask is optional, and a null value can be passed as mask argument. Both arrays must have the same type, the same number of dimensions, and the same size. If any of the passed arrays is of IplImage type, then its ROI and COI fields are used.

Parameters:
src - - the source array
dst - - the destination array
mask - - the optional operation mask, 8-bit single channel array; specifies elements of the destination array to be changed

countNonZero

public static int countNonZero(IplImage img)
Counts non-zero array elements.

In the case of IplImage both ROI and COI are supported.

Parameters:
img - - the array must be a single-channel array or a multi-channel image with COI set
Returns:
the number of non-zero elements in img

div

public static void div(IplImage src1,
                       IplImage src2,
                       IplImage dst)
Performs per-element division of two arrays.

dst(i) = src1(i) / src2(i), if src1 != null

dst(i) = 1 / src2(i), otherwise

This is equivalent to calling div(src1, src2, dst, 1.0). All the arrays must have the same type and the same size (or ROI size).

Parameters:
src1 - - the first source array. If null, the array is assumed to be all 1’s.
src2 - - the second source array
dst - - the destination array

div

public static void div(IplImage src1,
                       IplImage src2,
                       IplImage dst,
                       double scale)
Performs per-element division of two arrays.

dst(i) = scale * src1(i) / src2(i), if src1 != null

dst(i) = scale / src2(i), otherwise

All the arrays must have the same type and the same size (or ROI size).

Parameters:
src1 - - the first source array. If null, the array is assumed to be all 1’s.
src2 - - the second source array
dst - - the destination array
scale - - the optional scale factor

exp

public static void exp(IplImage src,
                       IplImage dst)
Calculates the exponent of every array element.

dst(i) = e^(src(i))

The maximum relative error is about 7x10e-6 . Currently, the function converts denormalized values to zeros on output.

Parameters:
src - - the source array, it should have float or double type
dst - - the destination array, it should have float or double type

flip

public static void flip(IplImage src,
                        IplImage dst,
                        Constants.FlipMode mode)
Flips an image around the x-axis, y-axis, or both.

Parameters:
src - - The source image.
dst - - The destination image.
mode - - The flip mode.

GEMM

public static void GEMM(IplImage src1,
                        IplImage src2,
                        double alpha,
                        IplImage src3,
                        double beta,
                        IplImage dst,
                        Constants.GEMMFlag[] gemmFlags)
Performs generalized matrix multiplication.

dst = alpha * op(src1) * op(src2) + beta * op(src3), where op(X) is X or transpose(X)

All the matrices should have the same data type and coordinated sizes. Real or complex floating-point matrices are supported.

Parameters:
src1 - - the first source array
src2 - - the second source array
alpha - - the alpha value
src3 - - the third source array (shift). Can be null if there is no shift.
beta - - the beta value
dst - - the destination array
gemmFlags - - the operation flags that can be a combination of the following values:
  • CV_GEMM_A_T - transpose of src1
  • CV_GEMM_B_T - transpose of src2
  • CV_GEMM_C_T - transpose of src3

    matMulAdd

    public static void matMulAdd(IplImage src1,
                                 IplImage src2,
                                 IplImage src3,
                                 IplImage dst)
    Performs matrix multiplication with optional shifting. This is equivalent to calling GEMM(src1, src2, 1, src3, 1, dst, new GEMMFlag[]{}).

    dst = src1 * src2 + src3

    All the matrices should have the same data type and coordinated sizes. Real or complex floating-point matrices are supported.

    Parameters:
    src1 - - the first source array
    src2 - - the second source array
    src3 - - the third source array (shift). Can be null if there is no shift.
    dst - - the destination array

    matMul

    public static void matMul(IplImage src1,
                              IplImage src2,
                              IplImage dst)
    Performs matrix multiplication. This is equivalent to calling mulMatAdd(src1, src2, null, dst).

    dst = src1 * src2

    Parameters:
    src1 - - the first source array
    src2 - - the second source array
    dst - - the destination array

    get1D

    public static Scalar get1D(IplImage img,
                               int idx0)
    Return a specific array element.

    Parameters:
    img - - the input array
    idx0 - - the first zero-based component of the element index
    Returns:
    the array element

    get2D

    public static Scalar get2D(IplImage img,
                               int idx0,
                               int idx1)
    Return a specific array element.

    Parameters:
    img - - the input array
    idx0 - - the first zero-based component of the element index
    idx1 - - the second zero-based component of the element index
    Returns:
    the array element

    get3D

    public static Scalar get3D(IplImage img,
                               int idx0,
                               int idx1,
                               int idx2)
    Return a specific array element.

    Parameters:
    img - - the input array
    idx0 - - the first zero-based component of the element index
    idx1 - - the second zero-based component of the element index
    idx2 - - the third zero-based component of the element index
    Returns:
    the array element

    getND

    public static Scalar getND(IplImage img,
                               int[] idx)
    Return a specific array element.

    Parameters:
    img - - the input array
    idx - - array of element indices
    Returns:
    the array element

    getDimSize

    public static int getDimSize(IplImage img,
                                 int index)
    Returns the particular dimension size (number of elements per that dimension).

    Parameters:
    img - - the input array
    index - - zero-based dimension index (for images 0 means height, 1 means width)
    Returns:
    the dimension size

    getImageCOI

    public static int getImageCOI(IplImage img)
    Returns the index of the channel of interest of an image.

    Parameters:
    img - - the image
    Returns:
    the channel of interest of in an IplImage

    getImageROI

    public static java.awt.Rectangle getImageROI(IplImage img)
    Returns the image region of interest (ROI). If there is no ROI set, Rectangle(0, 0, img.getWidth(), img.getHeight()) is returned.

    Parameters:
    img - - the image.
    Returns:
    a rectangle specifying the ROI.

    getReal1D

    public static double getReal1D(IplImage img,
                                   int idx0)
    Return a specific element of a single-channel 1D array.

    Parameters:
    img - - the input array. Must have a single channel.
    idx0 - - the first zero-based component of the element index
    Returns:
    - the array element

    getReal2D

    public static double getReal2D(IplImage img,
                                   int idx0,
                                   int idx1)
    Return a specific element of a single-channel 2D array.

    Parameters:
    img - - the input array. Must have a single channel.
    idx0 - - the first zero-based component of the element index
    idx1 - - the second zero-based component of the element index
    Returns:
    - the array element

    getReal3D

    public static double getReal3D(IplImage img,
                                   int idx0,
                                   int idx1,
                                   int idx2)
    Return a specific element of a single-channel 3D array.

    Parameters:
    img - - the input array. Must have a single channel.
    idx0 - - the first zero-based component of the element index
    idx1 - - the second zero-based component of the element index
    idx2 - - the third zero-based component of the element index
    Returns:
    - the array element

    getRealND

    public static double getRealND(IplImage img,
                                   int[] idx)
    Return a specific element of a single-channel n-dimensional array.

    Parameters:
    img - - the input array
    idx - - array of the element indices
    Returns:
    the array element

    getSize

    public static java.awt.Dimension getSize(IplImage img)
    Returns the size of a matrix or the size of an image ROI.

    Parameters:
    img - - the input matrix or image
    Returns:
    the number of rows and columns of the input matrix or image. In the case of an image the size of ROI is returned.

    inRange

    public static void inRange(IplImage src,
                               IplImage lower,
                               IplImage upper,
                               IplImage dst)
    Checks that array elements lie between the elements of two other arrays dst(I) is set to 0xff (all 1 -bits) if src(I) is within the range and 0 otherwise. All the arrays must have the same type, except the destination, and the same size (or ROI size). * @param src – The first source array

    Parameters:
    src - – The source array
    lower - – The inclusive lower boundary array
    upper - – The exclusive upper boundary array
    dst - – The destination array, must have 8u or 8s type

    inRangeS

    public static void inRangeS(IplImage src,
                                Scalar lower,
                                Scalar upper,
                                IplImage dst)
    Checks that array elements lie between two scalars dst(I)’ is set to 0xff (all 1 -bits) if ‘src(I)’ is within the range and 0 otherwise. All the arrays must have the same size (or ROI size).

    Parameters:
    src - – The source array
    lower - – The inclusive lower boundary
    upper - – The exclusive upper boundary
    dst - – The destination array, must have 8u or 8s type

    resetImageROI

    public static void resetImageROI(IplImage img)
    Resets the image Region of Interest (ROI) to include the entire image and releases the ROI structure.

    Parameters:
    img - - the image.

    set

    public static void set(IplImage dst,
                           Scalar value)
    every element of an array to a given value array arr is of IplImage type, then is ROI used, but COI must not be set.

    Parameters:
    dst - The destination array
    value - Fill value

    set

    public static void set(IplImage dst,
                           Scalar value,
                           IplImage mask)
    every element of an array to a given value array arr is of IplImage type, then is ROI used, but COI must not be set.

    Parameters:
    dst - The destination array
    value - Fill value
    mask - Operation mask, 8-bit single channel array; specifies elements of the destination array to be changed

    setChannel

    public static void setChannel(IplImage im,
                                  int channel,
                                  int value)
    Sets a certain channel in an image to a value (mostly useful to set alpha to 255 after color conversion to 4byte pixel depth)

    Parameters:
    im -
    channel -
    value -

    setImageCOI

    public static void setImageCOI(IplImage img,
                                   int coi)
    Sets the channel of interest in an image.

    Most OpenCV functions do not support the COI setting, so to process an individual image/matrix channel one may copy -via copy() or split()- the channel to a separate image/matrix, process it and then copy the result back -via copy() or merge()- if needed.

    Parameters:
    img - - the image
    coi - - the channel of interest
    • 0 - all channels are selected
    • 1 - first channel is selected
    • etc.

      setImageROI

      public static void setImageROI(IplImage img,
                                     java.awt.Rectangle roi)
      Sets an image Region Of Interest (ROI).

      Most OpenCV functions support the use of ROI and treat the image rectangle as a separate image. For example, all of the pixel coordinates are counted from the top-left (or bottom-left) corner of the ROI, not the original image.

      Parameters:
      img - - the image.
      roi - - a rectangle specifying the ROI.

      solve

      public static int solve(float[] A,
                              float[] b,
                              float[] x,
                              int rows,
                              int cols,
                              Constants.SolveMethod method)

      split

      public static void split(IplImage src,
                               IplImage dst0,
                               IplImage dst1,
                               IplImage dst2,
                               IplImage dst3)

      sub

      public static void sub(IplImage src1,
                             IplImage src2,
                             IplImage dst,
                             IplImage mask)
      Computes the per-element difference between two arrays The function subtracts one array from another one dst(I)=src1(I)-src2(I) if mask(I)!=0 All the arrays must have the same type, except the mask, and the same size (or ROI size). For types that have limited range this operation is saturating.

      Parameters:
      src1 - – The first source array
      src2 - – The second source array
      dst - – The destination array
      mask - – Operation mask, 8-bit single channel array; specifies elements of the destination array to be changed

      subS

      public static void subS(IplImage src1,
                              Scalar value,
                              IplImage dst,
                              IplImage mask)
      Computes the difference between an array and a scalar. The function subtracts a scalar from every element of the source array dst(I)=src(I)-value if mask(I)!=0 All the arrays must have the same type, except the mask, and the same size (or ROI size). For types that have limited range this operation is saturating.

      Parameters:
      src - – The first source array
      value - – Subtracted scalar
      dst - – The destination array
      mask - – Operation mask, 8-bit single channel array; specifies elements of the destination array to be changed

      subRS

      public static void subRS(IplImage src1,
                               Scalar value,
                               IplImage dst,
                               IplImage mask)
      Computes the difference between a scalar and an array. The function subtracts every element of source array from a scalar dst(I)=value-src(I) if mask(I)!=0 All the arrays must have the same type, except the mask, and the same size (or ROI size). For types that have limited range this operation is saturating.

      Parameters:
      src - – The first source array
      value - – Scalar to subtract from
      dst - – The destination array
      mask - – Operation mask, 8-bit single channel array; specifies elements of the destination array to be changed

      sum

      public static Scalar sum(IplImage im)
      Adds up array elements The function calculates the sum S of array elements, independently for each channel the array is IplImage and COI is set, the function processes the selected channel only and stores the sum to the first scalar component.

      Parameters:
      im -
      Returns:

      svd

      public static void svd(float[] A,
                             float[] W,
                             float[] U,
                             float[] V,
                             int rows,
                             int cols,
                             Constants.SVDFlag[] flags)

      createMemStorage

      public static MemStorage createMemStorage(int blockSize)
      Creates an empty memory storage.

      Parameters:
      blockSize - - Size of the storage blocks in bytes. If it is 0, the block size is set to a default value - currently it is about 64K.

      releaseMemStorage

      public static void releaseMemStorage(MemStorage storage)
      Deallocates all storage memory blocks or returns them to the parent, if any. Then it deallocates the storage header and clears the pointer to the storage. All child storage associated with a given parent storage block must be released before the parent storage block is released.

      Parameters:
      storage - - Pointer to the released storage.

      circle

      public static void circle(IplImage img,
                                java.awt.Point center,
                                int radius,
                                Scalar color)
      Draws a simple or filled circle with a given center and radius using default parameters: thickness equals 1, line type equals CV_8, and shift is 0.


      circle

      public static void circle(IplImage img,
                                java.awt.Point center,
                                int radius,
                                Scalar color,
                                int thickness,
                                Constants.LineType lineType,
                                int shift)
      Draws a simple or filled circle with a given center and radius.

      Parameters:
      img - - Image where the circle is drawn.
      center - - Center of the circle.
      radius - - Radius of the circle.
      color - - Circle color.
      thickness - - Thickness of the circle outline if positive, otherwise this indicates that a filled circle is to be drawn.
      lineType - - Type of the circle boundary.
      shift - - Number of fractional bits in the center coordinates and radius value.

      ellipseBox

      public static void ellipseBox(IplImage img,
                                    Box2D box,
                                    Scalar color)

      ellipseBox

      public static void ellipseBox(IplImage img,
                                    Box2D box,
                                    Scalar color,
                                    int thickness,
                                    Constants.LineType lineType,
                                    int shift)

      line

      public static void line(IplImage img,
                              java.awt.Point pt1,
                              java.awt.Point pt2,
                              Scalar color)

      line

      public static void line(IplImage img,
                              java.awt.Point pt1,
                              java.awt.Point pt2,
                              Scalar color,
                              int thickness,
                              Constants.LineType lineType,
                              int shift)
      The function draws the line segment between pt1 and pt2 points in the image. The line is clipped by the image or ROI rectangle. For non-antialiased lines with integer coordinates the 8-connected or 4-connected Bresenham algorithm is used. Thick lines are drawn with rounding endings. Antialiased lines are drawn using Gaussian filtering.

      Parameters:
      img -
      p1 -
      p2 -
      color -
      thickness -
      lineType -
      shift -

      polyLine

      public static void polyLine(IplImage img,
                                  java.util.List<java.awt.Point[]> pts,
                                  int[] npts,
                                  int contours,
                                  boolean isClosed,
                                  Scalar color)
      Draws single or multiple polygonal curves using default parameters: thickness equals 1, line type equals CV_8, and shift is 0.


      polyLine

      public static void polyLine(IplImage img,
                                  java.util.List<java.awt.Point[]> pts,
                                  int[] npts,
                                  int contours,
                                  boolean isClosed,
                                  Scalar color,
                                  int thickness,
                                  Constants.LineType lineType,
                                  int shift)
      Draws single or multiple polygonal curves.

      Parameters:
      img - - The image that will be drawn.
      pts - - List of arrays containing the polygons' vertices. The arrays have the form [x0, y0, x1, y1, x2, y2, ...].
      npts - - An array containing the number of vertices of each of polygons in pts.
      contours - - The number of contours that bind the filled region.
      isClosed - - Indicates whether the polylines must be drawn closed. If closed, the function draws the line from the last vertex of every contour to the first vertex.
      color - - Polyline color.
      thickness - - Thickness of the polyline edges.
      lineType - - Type of the line segments.
      shift - - Number of fractional bits in the vertex coordinates.

      rectangle

      public static void rectangle(IplImage img,
                                   java.awt.Point pt1,
                                   java.awt.Point pt2,
                                   Scalar color)
      Draws a simple, thick, or filled rectangle using default parameters: thickness equals 1, line type equals CV_8, and shift is 0.


      rectangle

      public static void rectangle(IplImage img,
                                   java.awt.Rectangle rect,
                                   Scalar color)
      Draws a simple, thick, or filled rectangle using default parameters: thickness equals 1, line type equals CV_8, and shift is 0.


      rectangle

      public static void rectangle(IplImage img,
                                   java.awt.Point pt1,
                                   java.awt.Point pt2,
                                   Scalar color,
                                   int thickness,
                                   Constants.LineType lineType,
                                   int shift)
      Draws a simple, thick, or filled rectangle.

      Parameters:
      img - - The image that will be drawn.
      pt1 - - One of the rectangle's vertices.
      pt2 - - The vertex opposite to pt1.
      color - - Lines color.
      thickness - - Thickness of the rectangle lines. Negative values cause the function to draw a filled rectangle.
      lineType - - Type of the line segments.
      shift - - Number of fractional bits in the point coordinates.

      rectangle

      public static void rectangle(IplImage img,
                                   java.awt.Rectangle rect,
                                   Scalar color,
                                   int thickness,
                                   Constants.LineType lineType,
                                   int shift)
      Draws a simple, thick, or filled rectangle.

      Parameters:
      img - - The image that will be drawn.
      rect - - The rectangle.
      color - - Lines color.
      thickness - - Thickness of the rectangle lines. Negative values cause the function to draw a filled rectangle.
      lineType - - Type of the line segments.
      shift - - Number of fractional bits in the point coordinates.

      initFont

      public static Font initFont(Constants.FontType[] fontType,
                                  double hScale,
                                  double vScale,
                                  double shear,
                                  int thickness,
                                  Constants.LineType lineType)

      putText

      public static void putText(IplImage img,
                                 java.lang.String text,
                                 java.awt.Point pos,
                                 Font font,
                                 Scalar color)

      FLANNIndex

      public static FLANNIndex FLANNIndex(float[] features,
                                          int featureSize,
                                          int nFeatures,
                                          FLANNIndexParams params)

      knnSearch

      public static void knnSearch(FLANNIndex index,
                                   float[] queries,
                                   int querySize,
                                   int nQueries,
                                   int[] indices,
                                   float[] dists,
                                   int knn,
                                   FLANNSearchParams params)

      remap

      public static void remap(IplImage src,
                               IplImage dst,
                               IplImage mapx,
                               IplImage mapy,
                               Constants.InterpolationMode mode,
                               boolean fillOutliers,
                               Scalar fillValue)
      Transforms the source image using the specified map:

      dst(x,y) = src(mapx(x,y), mapy(x,y))

      The specified interpolation method is used to extract pixels with non-integer coordinates. Those pixels in the destination image, for which there is no correspondent pixels in the source image, are filled with the specified fill value.

      Parameters:
      src - - The source image.
      dst - - The destination image.
      mapx - - The map of x-coordinates (must be a 32-bit float image).
      mapy - - The map of y-coordinated (must be a 32-bit float image).
      mode - - The interpolation mode.
      fillOutliers - - A boolean value indicating if destination pixels that correspond to outliers in the source image should be set to fillValue.
      - - A pixel value to fill outliers.

      resize

      public static void resize(IplImage src,
                                IplImage dst)
      Resizes the source image to the destination image's dimensions using linear interpolation.

      Parameters:
      src - - The source image.
      dst - - The destination image.

      resize

      public static void resize(IplImage src,
                                IplImage dst,
                                Constants.InterpolationMode mode)
      Resizes the source image to the destination image's dimensions using the specified linear interpolation.

      Parameters:
      src - - The source image.
      dst - - The destination image.
      mode - - The interpolation mode.

      cvtColor

      public static void cvtColor(IplImage src,
                                  IplImage dst,
                                  Constants.ColorConversion conversion)
      Converts the colormode of src according to the conversion method provided.

      Parameters:
      src - source image
      dst - result is stored in this image
      conversion - color conversion method

      cvtColor

      public static void cvtColor(IplImage src,
                                  IplImage dst)
      Converts the colormode of src to the colormode of dst and stores the result in dst

      Parameters:
      src - source image
      dst - result will have the colormode of dst and stored in dst

      threshold

      public static void threshold(IplImage src,
                                   IplImage dst,
                                   double threshold,
                                   double maxValue,
                                   Constants.ThresholdType threshold_type)
      Applies a fixed-level threshold to array elements

      Parameters:
      src - – Source array (single-channel, 8-bit or 32-bit floating point)
      dst - – Destination array; must be either the same type as src or 8-bit
      threshold - – Threshold value
      maxValue - – Maximum value to use with CV_THRESH_BINARY and CV_THRESH_BINARY_INV thresholding types
      thresholdType - – Thresholding type (see the discussion)

      adaptiveThreshold

      public static void adaptiveThreshold(IplImage src,
                                           IplImage dst,
                                           double maxValue)
      Applies an adaptive threshold to an array with default values.

      Parameters:
      src - – Source image
      dst - – Destination image
      maxValue - – Maximum value that is used with CV_THRESH_BINARY and CV_THRESH_BINARY_INV

      adaptiveThreshold

      public static void adaptiveThreshold(IplImage src,
                                           IplImage dst,
                                           double maxValue,
                                           Constants.AdaptiveThreshAlg thresh_alg,
                                           Constants.AdaptiveThreshType thresh_type,
                                           int block_size,
                                           double param1)
      Applies an adaptive threshold to an array.

      Parameters:
      src - – Source image
      dst - – Destination image
      maxValue - – Maximum value that is used with CV_THRESH_BINARY and CV_THRESH_BINARY_INV
      adaptive_method - – Adaptive thresholding algorithm to use: CV_ADAPTIVE_THRESH_MEAN_C or CV_ADAPTIVE_THRESH_GAUSSIAN_C (see the discussion)
      thresholdType - –Thresholding type;
      blockSize - – The size of a pixel neighborhood that is used to calculate a threshold value for the pixel: 3, 5, 7, and so on
      param1 - – The method-dependent parameter. For the methods CV_ADAPTIVE_THRESH_MEAN_C and CV_ADAPTIVE_THRESH_GAUSSIAN_C it is a constant subtracted from the mean or weighted mean (see the discussion), though it may be negative

      floodFill

      public static void floodFill(IplImage src,
                                   java.awt.Point seed_point,
                                   Scalar lo_diff,
                                   Scalar up_diff,
                                   IplImage mask)
      Fills a connected component with the given color

      Parameters:
      image - – Input 1- or 3-channel, 8-bit or floating-point image. It is modified by the function unless the CV_FLOODFILL_MASK_ONLY flag is set (see below)
      seed_point - – The starting point
      lo_diff - – Maximal lower brightness/color difference between the currently observed pixel and one of its neighbors belonging to the component, or a seed pixel being added to the component. In the case of 8-bit color images it is a packed value
      up_diff - – Maximal upper brightness/color difference between the currently observed pixel and one of its neighbors belonging to the component, or a seed pixel being added to the component. In the case of 8-bit color images it is a packed value
      mask - – Operation mask, should be a single-channel 8-bit image, 2 pixels wider and 2 pixels taller than image . If not NULL, the function uses and updates the mask, so the user takes responsibility of initializing the mask content. Floodfilling can’t go across non-zero pixels in the mask, for example, an edge detector output can be used as a mask to stop filling at edges. It is possible to use the same mask in multiple calls to the function to make sure the filled area do not overlap. Note : because the mask is larger than the filled image, a pixel in mask that corresponds to (x,y) pixel in image will have coordinates

      floodFill

      public static void floodFill(IplImage src,
                                   java.awt.Point seed_point,
                                   Scalar new_val,
                                   Scalar lo_diff,
                                   Scalar up_diff,
                                   Constants.FloodFillConnectivity connectivity,
                                   Constants.FloodFillFlags flags,
                                   IplImage mask)
      Fills a connected component with the given color

      Parameters:
      image - – Input 1- or 3-channel, 8-bit or floating-point image. It is modified by the function unless the CV_FLOODFILL_MASK_ONLY flag is set (see below)
      seed_point - – The starting point
      new_val - – New value of the repainted domain pixels
      lo_diff - – Maximal lower brightness/color difference between the currently observed pixel and one of its neighbors belonging to the component, or a seed pixel being added to the component. In the case of 8-bit color images it is a packed value
      up_diff - – Maximal upper brightness/color difference between the currently observed pixel and one of its neighbors belonging to the component, or a seed pixel being added to the component. In the case of 8-bit color images it is a packed value
      flags - – The operation flags. Lower bits contain connectivity value, 4 (by default) or 8, used within the function. Connectivity determines which neighbors of a pixel are considered. Upper bits can be 0 or a combination of the following flags: - CV_FLOODFILL_FIXED_RANGE if set, the difference between the current pixel and seed pixel is considered, otherwise the difference between neighbor pixels is considered (the range is floating) - CV_FLOODFILL_MASK_ONLY if set, the function does not fill the image ( new_val is ignored), but fills the mask (that must be non-NULL in this case)
      mask - – Operation mask, should be a single-channel 8-bit image, 2 pixels wider and 2 pixels taller than image . If not NULL, the function uses and updates the mask, so the user takes responsibility of initializing the mask content. Floodfilling can’t go across non-zero pixels in the mask, for example, an edge detector output can be used as a mask to stop filling at edges. It is possible to use the same mask in multiple calls to the function to make sure the filled area do not overlap. Note : because the mask is larger than the filled image, a pixel in mask that corresponds to (x,y) pixel in image will have coordinates

      findContours

      public static Contour[] findContours(IplImage img,
                                           MemStorage storage,
                                           Constants.FindContoursMode mode,
                                           Constants.FindContoursMethod method,
                                           java.awt.Point offset)

      findContours

      public static Contour[] findContours(IplImage img,
                                           MemStorage storage)

      fitEllipse2

      public static Box2D fitEllipse2(java.util.List<java.awt.Point> points)

      fitEllipse2

      public static Box2D fitEllipse2(float[] points)

      extractSURF

      public static void extractSURF(IplImage img,
                                     IplImage mask,
                                     java.util.List<SURFPoint> keypoints,
                                     java.util.List<float[]> descriptors,
                                     MemStorage storage,
                                     SURFParams params)

      findCornerSubPix

      public static void findCornerSubPix(IplImage img,
                                          float[] corners,
                                          int cornerCount,
                                          java.awt.Dimension winSize,
                                          java.awt.Dimension zeroZoneSize,
                                          TermCriteria criteria)

      getStarKeypoints

      public static StarKeypoint[] getStarKeypoints(IplImage img,
                                                    MemStorage storage,
                                                    StarDetectorParams params)

      camshift

      public static int camshift(IplImage probImage,
                                 java.awt.Rectangle window,
                                 TermCriteria criteria,
                                 ConnectedComp comp,
                                 Box2D box)

      loadHaarClassifierCascade

      public static HaarClassifierCascade loadHaarClassifierCascade(java.lang.String filename)
      Loads a trained cascade of Haar classifiers from a file.

      Parameters:
      filename - - The name of the file containing the Haar classifier cascade.
      Returns:
      A HaarClassifierCascade object.

      releaseHaarClassifierCascade

      public static void releaseHaarClassifierCascade(HaarClassifierCascade cascade)
      Releases the Haar classifier cascade.

      Parameters:
      cascade - - The Haar classifier cascade object.

      haarDetectObjects

      public static java.awt.Rectangle[] haarDetectObjects(IplImage img,
                                                           HaarClassifierCascade cascade,
                                                           MemStorage storage)
      Default version of haarDetectObjects with parameters suited for object detection in video images.

      Parameters:
      img - - The image to detect objects in.
      cascade - - A Haar classifier cascade object.
      storage - - Memory storage to store the resultant sequence of the object candidate rectangles.
      Returns:
      An array with the rectangles containing the detected objects.

      haarDetectObjects

      public static java.awt.Rectangle[] haarDetectObjects(IplImage img,
                                                           HaarClassifierCascade cascade,
                                                           MemStorage storage,
                                                           double scaleFactor,
                                                           int minNeighbors,
                                                           Constants.HaarClassifierFlag[] flags,
                                                           java.awt.Dimension minSize)
      Detects objects the cascade has been trained for and returns those regions as a sequence of rectangles.

      Parameters:
      img - - The image to detect objects in.
      cascade - - A Haar classifier cascade object.
      storage - - Memory storage to store the resultant sequence of the object candidate rectangles.
      scaleFactor - - The factor by which the search window is scaled between the subsequent scans.
      minNeighbors - - Minimum number of neighbor rectangles that makes up an object.
      flags - - Mode of operation. Currently the only flag that may be specified is CV_HAAR_DO_CANNY_PRUNING.
      minSize - - Minimum window size.
      Returns:
      An array with the rectangles containing the detected objects.

      findChessboardCorners

      public static boolean findChessboardCorners(IplImage img,
                                                  java.awt.Dimension patternSize,
                                                  float[] corners,
                                                  int[] cornerCount,
                                                  Constants.CalibrationFlag[] flags)

      drawChessboardCorners

      public static void drawChessboardCorners(IplImage img,
                                               java.awt.Dimension patternSize,
                                               float[] corners,
                                               int cornerCount,
                                               boolean patternWasFound)

      calibrateCamera2

      public static void calibrateCamera2(float[] objectPoints,
                                          float[] imagePoints,
                                          int[] pointCounts,
                                          java.awt.Dimension imageSize,
                                          float[] cameraMatrix,
                                          float[] distortion,
                                          float[] rotations,
                                          float[] translations,
                                          Constants.CalibrationFlag[] flags)

      rodrigues2

      public static void rodrigues2(float[] src,
                                    float[] dst)
      This function performs the Rodrigues transform. It computes a rotation matrix from a rotation vector, and vice versa. To convert from vector to matrix, set src to be the 3-by-1 vector, dst to be the 3-by-3 matrix, and mode to be CV_RODRIGUES_V2M. To convert from matrix to vector, set src to be the 3-by-3 matrix, dst to be the 3-by-1 vector, and mode to be CV_RODRIGUES_M2V.

      Parameters:
      src - - Either a 3-by-1 vector or a 3-by-3 matrix.
      dst - - Either a 3-by-3 matrix or a 3-by-1 vector.
      mode - - And integer indicating the operation mode, i.e. either RODRIGUES_VECTOR_TO_MATRIX or RODRIGUES_MATRIX_TO_VECTOR.

      initUndistortMap

      public static void initUndistortMap(float[] cameraMatrix,
                                          float[] distortion,
                                          IplImage mapx,
                                          IplImage mapy)
      Computes an undistortion map.

      Parameters:
      cameraMatrix - - A 3-by-3 matrix packed in row order containing the intrinsic parameters of the camera.
      distortion - - The distortion coefficients of the camera.
      mapx - - The output map of x-coordinates (must be a 32-bit float one channels image, or a 16-bit unsigned short one channel image).
      mapy - - The output map of y-coordinates (must be a 32-bit float one channels image, or a 16-bit unsigned short one channel image).

      undistort2

      public static void undistort2(IplImage src,
                                    IplImage dst,
                                    float[] cameraMatrix,
                                    float[] distortion)
      Transforms the image to compensate radial and tangential lens distortion. The function is simply a combination of initUndistortRectifyMap() (with unity R ) and remap (with bilinear interpolation). Those pixels in the destination image, for which there is no correspondent pixels in the source image, are filled with 0’s (black color).

      TODO: Add the newCameraMatrix parameter.

      Parameters:
      src - - The input (distorted) image.
      dst - - The output (corrected) image; will have the same size and the same type as src.
      cameraMatrix - - A 3-by-3 matrix packed in row order contaning the intrinsic camera parameters.
      distortion - - The distortion coefficients of the camera.

      getCaptureProperty

      public static double getCaptureProperty(Capture capture,
                                              Constants.CaptureProperty property)
      Gets video capturing properties.

      Parameters:
      capture -
      property -
      Returns:

      setCaptureProperty

      public static void setCaptureProperty(Capture capture,
                                            Constants.CaptureProperty property,
                                            double value)
      Sets video capture properties

      Parameters:
      capture -
      property -
      value -

      saveImage

      public static void saveImage(java.lang.String location,
                                   IplImage image)
      Saves an image to a specified file. The function cvSaveImage() saves the image to the specified file. The image format is chosen based on the filename extension, see LoadImage. Only 8-bit single-channel or 3-channel (with ‘BGR’ channel order) images can be saved using this function. If the format, depth or channel order is different, use cvCvtScale() and cvCvtColor() to convert it before saving, or use universal cvSave() to save the image to XML or YAML format.

      Parameters:
      location - – Name of the file.
      image - – Image to be saved.

      loadImage

      public static IplImage loadImage(java.lang.String location,
                                       Constants.ImageLoadColorMode color_mode)
      The function cvLoadImage() loads an image from the specified file and returns the pointer to the loaded image. Currently the following file formats are supported: - Windows bitmaps - BMP, DIB - JPEG files - JPEG, JPG, JPE - Portable Network Graphics - PNG - Portable image format - PBM, PGM, PPM - Sun rasters - SR, RAS - TIFF files - TIFF, TIF

      Parameters:
      filename - – Name of file to be loaded.
      color_mode - – Specific color type of the loaded image: if $ > 0 $, the loaded image is forced to be a 3-channel color image; if 0, the loaded image is forced to be grayscale; if $ < 0 $, the loaded image will be loaded as is (note that in the current implementation the alpha channel, if any, is stripped from the output image, e.g. 4-channel RGBA image will be loaded as RGB).
      Returns:
      an IPLImagem, note the pixel_depth will be assumed to be 8bit and color_mode will be generic

      captureFromFile

      public static Capture captureFromFile(java.lang.String filename)
      Initializes capturing a video from a file

      Parameters:
      String - absolute path and filename of movie
      Returns:

      captureFromCAM

      public static Capture captureFromCAM(int index)
      Initializes capturing a video from a camera

      Parameters:
      index - of camera
      Returns:

      queryFrame

      public static boolean queryFrame(Capture capture,
                                       IplImage dst)
      Grabs and retrieves a frame from a capture source The function provides a modifiable image dst with the image data

      Parameters:
      camera -
      dst -
      Returns:
      true if a frame was successfully copied

      releaseCapture

      public static void releaseCapture(Capture capture)
      Releases the capture object allocated by captureFromFile() or captureFromCAM().

      Parameters:
      capture - - the Capture object to be released

      createVideoWriter

      public static VideoWriter createVideoWriter(java.lang.String filename,
                                                  Constants.VideoCodec videoCodec,
                                                  double fps,
                                                  java.awt.Dimension frameSize,
                                                  boolean isColor)

      releaseVideoWriter

      public static void releaseVideoWriter(VideoWriter writer)

      writeFrame

      public static int writeFrame(VideoWriter writer,
                                   IplImage img)

      createHist

      public static Histogram createHist(int dims,
                                         int[] sizes,
                                         Constants.HistogramType type,
                                         float[] ranges,
                                         int uniform)

      releaseHist

      public static void releaseHist(Histogram hist)

      calcHist

      public static void calcHist(IplImage img,
                                  Histogram hist,
                                  int accumulate,
                                  IplImage mask)

      calcHist

      public static void calcHist(java.util.List<IplImage> images,
                                  Histogram hist,
                                  int accumulate,
                                  IplImage mask)

      clearHist

      public static void clearHist(Histogram hist)

      getMinHistValue

      public static float getMinHistValue(Histogram hist)

      getMaxHistValue

      public static float getMaxHistValue(Histogram hist)

      scaleHist

      public static void scaleHist(Histogram hist,
                                   double scale,
                                   double shift)

      calcBackProject

      public static void calcBackProject(IplImage img,
                                         IplImage backProject,
                                         Histogram hist)

      calcBackProject

      public static void calcBackProject(java.util.List<IplImage> images,
                                         IplImage backProject,
                                         Histogram hist)

      detectBlobs

      public static Blob[] detectBlobs(IplImage im,
                                       int minArea,
                                       int maxArea,
                                       int maxBlobs,
                                       boolean findHoles,
                                       int maxVertices)
      This method finds blobs in image, calculates their centroids, areas and moments and returns their contours

      Parameters:
      src - this array will get clobbered
      minArea -
      maxArea -
      maxBlobs -
      findHoles -
      maxVertices -
      Returns:

      findOutliers

      public static void findOutliers(float[] points,
                                      int pointSize,
                                      int nPoints,
                                      int[] outliers,
                                      int kdTrees,
                                      int knn,
                                      int searchChecks,
                                      double stdDevFactor)