2010-05-25 23:59:48 +08:00
|
|
|
/*! \file imgproc.hpp
|
|
|
|
\brief The Image Processing
|
|
|
|
*/
|
|
|
|
|
2010-05-12 01:44:00 +08:00
|
|
|
/*M///////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
|
|
|
//
|
|
|
|
// By downloading, copying, installing or using the software you agree to this license.
|
|
|
|
// If you do not agree to this license, do not download, install,
|
|
|
|
// copy or use the software.
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// License Agreement
|
|
|
|
// For Open Source Computer Vision Library
|
|
|
|
//
|
|
|
|
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
|
|
|
|
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
|
|
|
|
// Third party copyrights are property of their respective owners.
|
|
|
|
//
|
|
|
|
// Redistribution and use in source and binary forms, with or without modification,
|
|
|
|
// are permitted provided that the following conditions are met:
|
|
|
|
//
|
|
|
|
// * Redistribution's of source code must retain the above copyright notice,
|
|
|
|
// this list of conditions and the following disclaimer.
|
|
|
|
//
|
|
|
|
// * Redistribution's in binary form must reproduce the above copyright notice,
|
|
|
|
// this list of conditions and the following disclaimer in the documentation
|
|
|
|
// and/or other materials provided with the distribution.
|
|
|
|
//
|
|
|
|
// * The name of the copyright holders may not be used to endorse or promote products
|
|
|
|
// derived from this software without specific prior written permission.
|
|
|
|
//
|
|
|
|
// This software is provided by the copyright holders and contributors "as is" and
|
|
|
|
// any express or implied warranties, including, but not limited to, the implied
|
|
|
|
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
|
|
|
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
|
|
|
// indirect, incidental, special, exemplary, or consequential damages
|
|
|
|
// (including, but not limited to, procurement of substitute goods or services;
|
|
|
|
// loss of use, data, or profits; or business interruption) however caused
|
|
|
|
// and on any theory of liability, whether in contract, strict liability,
|
|
|
|
// or tort (including negligence or otherwise) arising in any way out of
|
|
|
|
// the use of this software, even if advised of the possibility of such damage.
|
|
|
|
//
|
|
|
|
//M*/
|
|
|
|
|
|
|
|
#ifndef __OPENCV_IMGPROC_HPP__
|
|
|
|
#define __OPENCV_IMGPROC_HPP__
|
|
|
|
|
|
|
|
#include "opencv2/core/core.hpp"
|
|
|
|
#include "opencv2/imgproc/types_c.h"
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
2010-05-25 23:59:48 +08:00
|
|
|
/*! \namespace cv
|
|
|
|
Namespace where all the C++ OpenCV functionality resides
|
|
|
|
*/
|
2010-05-12 01:44:00 +08:00
|
|
|
namespace cv
|
|
|
|
{
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! various border interpolation methods
|
2010-05-12 01:44:00 +08:00
|
|
|
enum { BORDER_REPLICATE=IPL_BORDER_REPLICATE, BORDER_CONSTANT=IPL_BORDER_CONSTANT,
|
2010-11-11 05:14:57 +08:00
|
|
|
BORDER_REFLECT=IPL_BORDER_REFLECT, BORDER_WRAP=IPL_BORDER_WRAP,
|
|
|
|
BORDER_REFLECT_101=IPL_BORDER_REFLECT_101, BORDER_REFLECT101=BORDER_REFLECT_101,
|
|
|
|
BORDER_TRANSPARENT=IPL_BORDER_TRANSPARENT,
|
|
|
|
BORDER_DEFAULT=BORDER_REFLECT_101, BORDER_ISOLATED=16 };
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! 1D interpolation function: returns coordinate of the "donor" pixel for the specified location p.
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS_W int borderInterpolate( int p, int len, int borderType );
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
/*!
|
|
|
|
The Base Class for 1D or Row-wise Filters
|
|
|
|
|
|
|
|
This is the base class for linear or non-linear filters that process 1D data.
|
|
|
|
In particular, such filters are used for the "horizontal" filtering parts in separable filters.
|
|
|
|
|
|
|
|
Several functions in OpenCV return Ptr<BaseRowFilter> for the specific types of filters,
|
|
|
|
and those pointers can be used directly or within cv::FilterEngine.
|
|
|
|
*/
|
2010-05-12 01:44:00 +08:00
|
|
|
class CV_EXPORTS BaseRowFilter
|
|
|
|
{
|
|
|
|
public:
|
2010-05-25 22:57:10 +08:00
|
|
|
//! the default constructor
|
2010-05-12 01:44:00 +08:00
|
|
|
BaseRowFilter();
|
2010-05-25 22:57:10 +08:00
|
|
|
//! the destructor
|
2010-05-12 01:44:00 +08:00
|
|
|
virtual ~BaseRowFilter();
|
2010-05-25 22:57:10 +08:00
|
|
|
//! the filtering operator. Must be overrided in the derived classes. The horizontal border interpolation is done outside of the class.
|
2010-05-12 01:44:00 +08:00
|
|
|
virtual void operator()(const uchar* src, uchar* dst,
|
|
|
|
int width, int cn) = 0;
|
|
|
|
int ksize, anchor;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
/*!
|
|
|
|
The Base Class for Column-wise Filters
|
|
|
|
|
|
|
|
This is the base class for linear or non-linear filters that process columns of 2D arrays.
|
|
|
|
Such filters are used for the "vertical" filtering parts in separable filters.
|
|
|
|
|
|
|
|
Several functions in OpenCV return Ptr<BaseColumnFilter> for the specific types of filters,
|
|
|
|
and those pointers can be used directly or within cv::FilterEngine.
|
|
|
|
|
|
|
|
Unlike cv::BaseRowFilter, cv::BaseColumnFilter may have some context information,
|
|
|
|
i.e. box filter keeps the sliding sum of elements. To reset the state BaseColumnFilter::reset()
|
|
|
|
must be called (e.g. the method is called by cv::FilterEngine)
|
|
|
|
*/
|
2010-05-12 01:44:00 +08:00
|
|
|
class CV_EXPORTS BaseColumnFilter
|
|
|
|
{
|
|
|
|
public:
|
2010-05-25 22:57:10 +08:00
|
|
|
//! the default constructor
|
2010-05-12 01:44:00 +08:00
|
|
|
BaseColumnFilter();
|
2010-05-25 22:57:10 +08:00
|
|
|
//! the destructor
|
2010-05-12 01:44:00 +08:00
|
|
|
virtual ~BaseColumnFilter();
|
2010-05-25 22:57:10 +08:00
|
|
|
//! the filtering operator. Must be overrided in the derived classes. The vertical border interpolation is done outside of the class.
|
2010-05-12 01:44:00 +08:00
|
|
|
virtual void operator()(const uchar** src, uchar* dst, int dststep,
|
|
|
|
int dstcount, int width) = 0;
|
2010-05-25 22:57:10 +08:00
|
|
|
//! resets the internal buffers, if any
|
2010-05-12 01:44:00 +08:00
|
|
|
virtual void reset();
|
|
|
|
int ksize, anchor;
|
|
|
|
};
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
/*!
|
|
|
|
The Base Class for Non-Separable 2D Filters.
|
|
|
|
|
|
|
|
This is the base class for linear or non-linear 2D filters.
|
|
|
|
|
|
|
|
Several functions in OpenCV return Ptr<BaseFilter> for the specific types of filters,
|
|
|
|
and those pointers can be used directly or within cv::FilterEngine.
|
|
|
|
|
|
|
|
Similar to cv::BaseColumnFilter, the class may have some context information,
|
|
|
|
that should be reset using BaseFilter::reset() method before processing the new array.
|
|
|
|
*/
|
2010-05-12 01:44:00 +08:00
|
|
|
class CV_EXPORTS BaseFilter
|
|
|
|
{
|
|
|
|
public:
|
2010-05-25 22:57:10 +08:00
|
|
|
//! the default constructor
|
2010-05-12 01:44:00 +08:00
|
|
|
BaseFilter();
|
2010-05-25 22:57:10 +08:00
|
|
|
//! the destructor
|
2010-05-12 01:44:00 +08:00
|
|
|
virtual ~BaseFilter();
|
2010-05-25 22:57:10 +08:00
|
|
|
//! the filtering operator. The horizontal and the vertical border interpolation is done outside of the class.
|
2010-05-12 01:44:00 +08:00
|
|
|
virtual void operator()(const uchar** src, uchar* dst, int dststep,
|
|
|
|
int dstcount, int width, int cn) = 0;
|
2010-05-25 22:57:10 +08:00
|
|
|
//! resets the internal buffers, if any
|
2010-05-12 01:44:00 +08:00
|
|
|
virtual void reset();
|
|
|
|
Size ksize;
|
|
|
|
Point anchor;
|
|
|
|
};
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
/*!
|
|
|
|
The Main Class for Image Filtering.
|
|
|
|
|
|
|
|
The class can be used to apply an arbitrary filtering operation to an image.
|
|
|
|
It contains all the necessary intermediate buffers, it computes extrapolated values
|
|
|
|
of the "virtual" pixels outside of the image etc.
|
|
|
|
Pointers to the initialized cv::FilterEngine instances
|
|
|
|
are returned by various OpenCV functions, such as cv::createSeparableLinearFilter(),
|
|
|
|
cv::createLinearFilter(), cv::createGaussianFilter(), cv::createDerivFilter(),
|
|
|
|
cv::createBoxFilter() and cv::createMorphologyFilter().
|
|
|
|
|
|
|
|
Using the class you can process large images by parts and build complex pipelines
|
|
|
|
that include filtering as some of the stages. If all you need is to apply some pre-defined
|
|
|
|
filtering operation, you may use cv::filter2D(), cv::erode(), cv::dilate() etc.
|
|
|
|
functions that create FilterEngine internally.
|
|
|
|
|
|
|
|
Here is the example on how to use the class to implement Laplacian operator, which is the sum of
|
|
|
|
second-order derivatives. More complex variant for different types is implemented in cv::Laplacian().
|
|
|
|
|
|
|
|
\code
|
|
|
|
void laplace_f(const Mat& src, Mat& dst)
|
|
|
|
{
|
|
|
|
CV_Assert( src.type() == CV_32F );
|
|
|
|
// make sure the destination array has the proper size and type
|
|
|
|
dst.create(src.size(), src.type());
|
|
|
|
|
|
|
|
// get the derivative and smooth kernels for d2I/dx2.
|
|
|
|
// for d2I/dy2 we could use the same kernels, just swapped
|
|
|
|
Mat kd, ks;
|
|
|
|
getSobelKernels( kd, ks, 2, 0, ksize, false, ktype );
|
|
|
|
|
|
|
|
// let's process 10 source rows at once
|
|
|
|
int DELTA = std::min(10, src.rows);
|
|
|
|
Ptr<FilterEngine> Fxx = createSeparableLinearFilter(src.type(),
|
|
|
|
dst.type(), kd, ks, Point(-1,-1), 0, borderType, borderType, Scalar() );
|
|
|
|
Ptr<FilterEngine> Fyy = createSeparableLinearFilter(src.type(),
|
|
|
|
dst.type(), ks, kd, Point(-1,-1), 0, borderType, borderType, Scalar() );
|
|
|
|
|
|
|
|
int y = Fxx->start(src), dsty = 0, dy = 0;
|
|
|
|
Fyy->start(src);
|
|
|
|
const uchar* sptr = src.data + y*src.step;
|
|
|
|
|
|
|
|
// allocate the buffers for the spatial image derivatives;
|
|
|
|
// the buffers need to have more than DELTA rows, because at the
|
|
|
|
// last iteration the output may take max(kd.rows-1,ks.rows-1)
|
|
|
|
// rows more than the input.
|
|
|
|
Mat Ixx( DELTA + kd.rows - 1, src.cols, dst.type() );
|
|
|
|
Mat Iyy( DELTA + kd.rows - 1, src.cols, dst.type() );
|
|
|
|
|
|
|
|
// inside the loop we always pass DELTA rows to the filter
|
|
|
|
// (note that the "proceed" method takes care of possibe overflow, since
|
|
|
|
// it was given the actual image height in the "start" method)
|
|
|
|
// on output we can get:
|
|
|
|
// * < DELTA rows (the initial buffer accumulation stage)
|
|
|
|
// * = DELTA rows (settled state in the middle)
|
|
|
|
// * > DELTA rows (then the input image is over, but we generate
|
|
|
|
// "virtual" rows using the border mode and filter them)
|
|
|
|
// this variable number of output rows is dy.
|
|
|
|
// dsty is the current output row.
|
|
|
|
// sptr is the pointer to the first input row in the portion to process
|
|
|
|
for( ; dsty < dst.rows; sptr += DELTA*src.step, dsty += dy )
|
|
|
|
{
|
|
|
|
Fxx->proceed( sptr, (int)src.step, DELTA, Ixx.data, (int)Ixx.step );
|
|
|
|
dy = Fyy->proceed( sptr, (int)src.step, DELTA, d2y.data, (int)Iyy.step );
|
|
|
|
if( dy > 0 )
|
|
|
|
{
|
|
|
|
Mat dstripe = dst.rowRange(dsty, dsty + dy);
|
|
|
|
add(Ixx.rowRange(0, dy), Iyy.rowRange(0, dy), dstripe);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
\endcode
|
|
|
|
*/
|
2010-05-12 01:44:00 +08:00
|
|
|
class CV_EXPORTS FilterEngine
|
|
|
|
{
|
|
|
|
public:
|
2010-05-25 22:57:10 +08:00
|
|
|
//! the default constructor
|
2010-05-12 01:44:00 +08:00
|
|
|
FilterEngine();
|
2010-05-25 22:57:10 +08:00
|
|
|
//! the full constructor. Either _filter2D or both _rowFilter and _columnFilter must be non-empty.
|
2010-05-12 01:44:00 +08:00
|
|
|
FilterEngine(const Ptr<BaseFilter>& _filter2D,
|
|
|
|
const Ptr<BaseRowFilter>& _rowFilter,
|
|
|
|
const Ptr<BaseColumnFilter>& _columnFilter,
|
|
|
|
int srcType, int dstType, int bufType,
|
|
|
|
int _rowBorderType=BORDER_REPLICATE,
|
|
|
|
int _columnBorderType=-1,
|
|
|
|
const Scalar& _borderValue=Scalar());
|
2010-05-25 22:57:10 +08:00
|
|
|
//! the destructor
|
2010-05-12 01:44:00 +08:00
|
|
|
virtual ~FilterEngine();
|
2010-05-25 22:57:10 +08:00
|
|
|
//! reinitializes the engine. The previously assigned filters are released.
|
2010-05-12 01:44:00 +08:00
|
|
|
void init(const Ptr<BaseFilter>& _filter2D,
|
|
|
|
const Ptr<BaseRowFilter>& _rowFilter,
|
|
|
|
const Ptr<BaseColumnFilter>& _columnFilter,
|
|
|
|
int srcType, int dstType, int bufType,
|
|
|
|
int _rowBorderType=BORDER_REPLICATE, int _columnBorderType=-1,
|
|
|
|
const Scalar& _borderValue=Scalar());
|
2010-05-25 22:57:10 +08:00
|
|
|
//! starts filtering of the specified ROI of an image of size wholeSize.
|
2010-05-12 01:44:00 +08:00
|
|
|
virtual int start(Size wholeSize, Rect roi, int maxBufRows=-1);
|
2010-05-25 22:57:10 +08:00
|
|
|
//! starts filtering of the specified ROI of the specified image.
|
2010-05-12 01:44:00 +08:00
|
|
|
virtual int start(const Mat& src, const Rect& srcRoi=Rect(0,0,-1,-1),
|
|
|
|
bool isolated=false, int maxBufRows=-1);
|
2010-05-25 22:57:10 +08:00
|
|
|
//! processes the next srcCount rows of the image.
|
2010-05-12 01:44:00 +08:00
|
|
|
virtual int proceed(const uchar* src, int srcStep, int srcCount,
|
|
|
|
uchar* dst, int dstStep);
|
2010-05-25 22:57:10 +08:00
|
|
|
//! applies filter to the specified ROI of the image. if srcRoi=(0,0,-1,-1), the whole image is filtered.
|
2010-05-12 01:44:00 +08:00
|
|
|
virtual void apply( const Mat& src, Mat& dst,
|
|
|
|
const Rect& srcRoi=Rect(0,0,-1,-1),
|
|
|
|
Point dstOfs=Point(0,0),
|
|
|
|
bool isolated=false);
|
2010-05-25 22:57:10 +08:00
|
|
|
//! returns true if the filter is separable
|
2010-05-12 01:44:00 +08:00
|
|
|
bool isSeparable() const { return (const BaseFilter*)filter2D == 0; }
|
2010-05-25 22:57:10 +08:00
|
|
|
//! returns the number
|
2010-05-12 01:44:00 +08:00
|
|
|
int remainingInputRows() const;
|
|
|
|
int remainingOutputRows() const;
|
|
|
|
|
|
|
|
int srcType, dstType, bufType;
|
|
|
|
Size ksize;
|
|
|
|
Point anchor;
|
|
|
|
int maxWidth;
|
|
|
|
Size wholeSize;
|
|
|
|
Rect roi;
|
|
|
|
int dx1, dx2;
|
|
|
|
int rowBorderType, columnBorderType;
|
|
|
|
vector<int> borderTab;
|
|
|
|
int borderElemSize;
|
|
|
|
vector<uchar> ringBuf;
|
|
|
|
vector<uchar> srcRow;
|
|
|
|
vector<uchar> constBorderValue;
|
|
|
|
vector<uchar> constBorderRow;
|
|
|
|
int bufStep, startY, startY0, endY, rowCount, dstY;
|
|
|
|
vector<uchar*> rows;
|
|
|
|
|
|
|
|
Ptr<BaseFilter> filter2D;
|
|
|
|
Ptr<BaseRowFilter> rowFilter;
|
|
|
|
Ptr<BaseColumnFilter> columnFilter;
|
|
|
|
};
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! type of the kernel
|
2010-05-12 01:44:00 +08:00
|
|
|
enum { KERNEL_GENERAL=0, KERNEL_SYMMETRICAL=1, KERNEL_ASYMMETRICAL=2,
|
|
|
|
KERNEL_SMOOTH=4, KERNEL_INTEGER=8 };
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! returns type (one of KERNEL_*) of 1D or 2D kernel specified by its coefficients.
|
2010-05-12 01:44:00 +08:00
|
|
|
CV_EXPORTS int getKernelType(const Mat& kernel, Point anchor);
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! returns the primitive row filter with the specified kernel
|
2010-05-12 01:44:00 +08:00
|
|
|
CV_EXPORTS Ptr<BaseRowFilter> getLinearRowFilter(int srcType, int bufType,
|
|
|
|
const Mat& kernel, int anchor,
|
|
|
|
int symmetryType);
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! returns the primitive column filter with the specified kernel
|
2010-05-12 01:44:00 +08:00
|
|
|
CV_EXPORTS Ptr<BaseColumnFilter> getLinearColumnFilter(int bufType, int dstType,
|
|
|
|
const Mat& kernel, int anchor,
|
|
|
|
int symmetryType, double delta=0,
|
|
|
|
int bits=0);
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! returns 2D filter with the specified kernel
|
2010-05-12 01:44:00 +08:00
|
|
|
CV_EXPORTS Ptr<BaseFilter> getLinearFilter(int srcType, int dstType,
|
|
|
|
const Mat& kernel,
|
|
|
|
Point anchor=Point(-1,-1),
|
|
|
|
double delta=0, int bits=0);
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! returns the separable linear filter engine
|
2010-05-12 01:44:00 +08:00
|
|
|
CV_EXPORTS Ptr<FilterEngine> createSeparableLinearFilter(int srcType, int dstType,
|
|
|
|
const Mat& rowKernel, const Mat& columnKernel,
|
|
|
|
Point _anchor=Point(-1,-1), double delta=0,
|
|
|
|
int _rowBorderType=BORDER_DEFAULT,
|
|
|
|
int _columnBorderType=-1,
|
|
|
|
const Scalar& _borderValue=Scalar());
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! returns the non-separable linear filter engine
|
2010-05-12 01:44:00 +08:00
|
|
|
CV_EXPORTS Ptr<FilterEngine> createLinearFilter(int srcType, int dstType,
|
|
|
|
const Mat& kernel, Point _anchor=Point(-1,-1),
|
|
|
|
double delta=0, int _rowBorderType=BORDER_DEFAULT,
|
|
|
|
int _columnBorderType=-1, const Scalar& _borderValue=Scalar());
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! returns the Gaussian kernel with the specified parameters
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS_W Mat getGaussianKernel( int ksize, double sigma, int ktype=CV_64F );
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! returns the Gaussian filter engine
|
2010-05-12 01:44:00 +08:00
|
|
|
CV_EXPORTS Ptr<FilterEngine> createGaussianFilter( int type, Size ksize,
|
|
|
|
double sigma1, double sigma2=0,
|
|
|
|
int borderType=BORDER_DEFAULT);
|
2010-05-25 22:57:10 +08:00
|
|
|
//! initializes kernels of the generalized Sobel operator
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS_W void getDerivKernels( CV_OUT Mat& kx, CV_OUT Mat& ky,
|
2010-10-17 04:34:34 +08:00
|
|
|
int dx, int dy, int ksize,
|
2010-05-12 01:44:00 +08:00
|
|
|
bool normalize=false, int ktype=CV_32F );
|
2010-05-25 22:57:10 +08:00
|
|
|
//! returns filter engine for the generalized Sobel operator
|
2010-05-12 01:44:00 +08:00
|
|
|
CV_EXPORTS Ptr<FilterEngine> createDerivFilter( int srcType, int dstType,
|
|
|
|
int dx, int dy, int ksize,
|
|
|
|
int borderType=BORDER_DEFAULT );
|
2010-05-25 22:57:10 +08:00
|
|
|
//! returns horizontal 1D box filter
|
2010-05-12 01:44:00 +08:00
|
|
|
CV_EXPORTS Ptr<BaseRowFilter> getRowSumFilter(int srcType, int sumType,
|
2010-10-17 04:34:34 +08:00
|
|
|
int ksize, int anchor=-1);
|
2010-05-25 22:57:10 +08:00
|
|
|
//! returns vertical 1D box filter
|
2010-10-17 04:34:34 +08:00
|
|
|
CV_EXPORTS Ptr<BaseColumnFilter> getColumnSumFilter( int sumType, int dstType,
|
|
|
|
int ksize, int anchor=-1,
|
|
|
|
double scale=1);
|
2010-05-25 22:57:10 +08:00
|
|
|
//! returns box filter engine
|
2010-05-12 01:44:00 +08:00
|
|
|
CV_EXPORTS Ptr<FilterEngine> createBoxFilter( int srcType, int dstType, Size ksize,
|
2010-10-17 04:34:34 +08:00
|
|
|
Point anchor=Point(-1,-1),
|
|
|
|
bool normalize=true,
|
|
|
|
int borderType=BORDER_DEFAULT);
|
2010-05-25 22:57:10 +08:00
|
|
|
//! type of morphological operation
|
2010-05-12 01:44:00 +08:00
|
|
|
enum { MORPH_ERODE=0, MORPH_DILATE=1, MORPH_OPEN=2, MORPH_CLOSE=3,
|
|
|
|
MORPH_GRADIENT=4, MORPH_TOPHAT=5, MORPH_BLACKHAT=6 };
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! returns horizontal 1D morphological filter
|
2010-05-12 01:44:00 +08:00
|
|
|
CV_EXPORTS Ptr<BaseRowFilter> getMorphologyRowFilter(int op, int type, int ksize, int anchor=-1);
|
2010-05-25 22:57:10 +08:00
|
|
|
//! returns vertical 1D morphological filter
|
2010-05-12 01:44:00 +08:00
|
|
|
CV_EXPORTS Ptr<BaseColumnFilter> getMorphologyColumnFilter(int op, int type, int ksize, int anchor=-1);
|
2010-05-25 22:57:10 +08:00
|
|
|
//! returns 2D morphological filter
|
2010-05-12 01:44:00 +08:00
|
|
|
CV_EXPORTS Ptr<BaseFilter> getMorphologyFilter(int op, int type, const Mat& kernel,
|
|
|
|
Point anchor=Point(-1,-1));
|
2010-05-25 22:57:10 +08:00
|
|
|
|
|
|
|
//! returns "magic" border value for erosion and dilation. It is automatically transformed to Scalar::all(-DBL_MAX) for dilation.
|
2010-05-12 01:44:00 +08:00
|
|
|
static inline Scalar morphologyDefaultBorderValue() { return Scalar::all(DBL_MAX); }
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! returns morphological filter engine. Only MORPH_ERODE and MORPH_DILATE are supported.
|
2010-05-12 01:44:00 +08:00
|
|
|
CV_EXPORTS Ptr<FilterEngine> createMorphologyFilter(int op, int type, const Mat& kernel,
|
|
|
|
Point anchor=Point(-1,-1), int _rowBorderType=BORDER_CONSTANT,
|
|
|
|
int _columnBorderType=-1,
|
|
|
|
const Scalar& _borderValue=morphologyDefaultBorderValue());
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! shape of the structuring element
|
2010-05-12 01:44:00 +08:00
|
|
|
enum { MORPH_RECT=0, MORPH_CROSS=1, MORPH_ELLIPSE=2 };
|
2010-05-25 22:57:10 +08:00
|
|
|
//! returns structuring element of the specified shape and size
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS_W Mat getStructuringElement(int shape, Size ksize, Point anchor=Point(-1,-1));
|
2010-05-12 01:44:00 +08:00
|
|
|
|
|
|
|
template<> CV_EXPORTS void Ptr<IplConvKernel>::delete_obj();
|
2010-05-25 22:57:10 +08:00
|
|
|
|
|
|
|
//! copies 2D array to a larger destination array with extrapolation of the outer part of src using the specified border mode
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS_W void copyMakeBorder( const Mat& src, CV_OUT Mat& dst,
|
2010-05-12 01:44:00 +08:00
|
|
|
int top, int bottom, int left, int right,
|
|
|
|
int borderType, const Scalar& value=Scalar() );
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! smooths the image using median filter.
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS_W void medianBlur( const Mat& src, CV_OUT Mat& dst, int ksize );
|
2010-05-25 22:57:10 +08:00
|
|
|
//! smooths the image using Gaussian filter.
|
2010-11-26 07:16:32 +08:00
|
|
|
CV_EXPORTS_AS(gaussianBlur) void GaussianBlur( const Mat& src, CV_OUT Mat& dst, Size ksize,
|
2010-05-12 01:44:00 +08:00
|
|
|
double sigma1, double sigma2=0,
|
|
|
|
int borderType=BORDER_DEFAULT );
|
2010-05-25 22:57:10 +08:00
|
|
|
//! smooths the image using bilateral filter
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS_W void bilateralFilter( const Mat& src, CV_OUT Mat& dst, int d,
|
2010-05-12 01:44:00 +08:00
|
|
|
double sigmaColor, double sigmaSpace,
|
|
|
|
int borderType=BORDER_DEFAULT );
|
2010-05-25 22:57:10 +08:00
|
|
|
//! smooths the image using the box filter. Each pixel is processed in O(1) time
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS_W void boxFilter( const Mat& src, CV_OUT Mat& dst, int ddepth,
|
2010-05-12 01:44:00 +08:00
|
|
|
Size ksize, Point anchor=Point(-1,-1),
|
|
|
|
bool normalize=true,
|
|
|
|
int borderType=BORDER_DEFAULT );
|
2010-05-25 22:57:10 +08:00
|
|
|
//! a synonym for normalized box filter
|
2010-11-24 00:39:20 +08:00
|
|
|
CV_EXPORTS_W void blur( const Mat& src, CV_OUT Mat& dst,
|
|
|
|
Size ksize, Point anchor=Point(-1,-1),
|
|
|
|
int borderType=BORDER_DEFAULT );
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! applies non-separable 2D linear filter to the image
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS_W void filter2D( const Mat& src, CV_OUT Mat& dst, int ddepth,
|
2010-05-12 01:44:00 +08:00
|
|
|
const Mat& kernel, Point anchor=Point(-1,-1),
|
|
|
|
double delta=0, int borderType=BORDER_DEFAULT );
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! applies separable 2D linear filter to the image
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS_W void sepFilter2D( const Mat& src, CV_OUT Mat& dst, int ddepth,
|
2010-05-12 01:44:00 +08:00
|
|
|
const Mat& kernelX, const Mat& kernelY,
|
|
|
|
Point anchor=Point(-1,-1),
|
|
|
|
double delta=0, int borderType=BORDER_DEFAULT );
|
2010-05-25 22:57:10 +08:00
|
|
|
|
|
|
|
//! applies generalized Sobel operator to the image
|
2010-11-26 07:16:32 +08:00
|
|
|
CV_EXPORTS_AS(sobel) void Sobel( const Mat& src, CV_OUT Mat& dst, int ddepth,
|
2010-05-12 01:44:00 +08:00
|
|
|
int dx, int dy, int ksize=3,
|
|
|
|
double scale=1, double delta=0,
|
|
|
|
int borderType=BORDER_DEFAULT );
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! applies the vertical or horizontal Scharr operator to the image
|
2010-11-26 07:16:32 +08:00
|
|
|
CV_EXPORTS_AS(scharr) void Scharr( const Mat& src, CV_OUT Mat& dst, int ddepth,
|
2010-05-12 01:44:00 +08:00
|
|
|
int dx, int dy, double scale=1, double delta=0,
|
|
|
|
int borderType=BORDER_DEFAULT );
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! applies Laplacian operator to the image
|
2010-11-26 07:16:32 +08:00
|
|
|
CV_EXPORTS_AS(laplacian) void Laplacian( const Mat& src, CV_OUT Mat& dst, int ddepth,
|
2010-05-12 01:44:00 +08:00
|
|
|
int ksize=1, double scale=1, double delta=0,
|
|
|
|
int borderType=BORDER_DEFAULT );
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! applies Canny edge detector and produces the edge map.
|
2010-11-26 07:16:32 +08:00
|
|
|
CV_EXPORTS_AS(canny) void Canny( const Mat& image, CV_OUT Mat& edges,
|
2010-05-12 01:44:00 +08:00
|
|
|
double threshold1, double threshold2,
|
|
|
|
int apertureSize=3, bool L2gradient=false );
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! computes minimum eigen value of 2x2 derivative covariation matrix at each pixel - the cornerness criteria
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS_W void cornerMinEigenVal( const Mat& src, CV_OUT Mat& dst,
|
2010-05-12 01:44:00 +08:00
|
|
|
int blockSize, int ksize=3,
|
|
|
|
int borderType=BORDER_DEFAULT );
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! computes Harris cornerness criteria at each image pixel
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS_W void cornerHarris( const Mat& src, CV_OUT Mat& dst, int blockSize,
|
2010-05-12 01:44:00 +08:00
|
|
|
int ksize, double k,
|
|
|
|
int borderType=BORDER_DEFAULT );
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! computes both eigenvalues and the eigenvectors of 2x2 derivative covariation matrix at each pixel. The output is stored as 6-channel matrix.
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS_W void cornerEigenValsAndVecs( const Mat& src, CV_OUT Mat& dst,
|
2010-05-12 01:44:00 +08:00
|
|
|
int blockSize, int ksize,
|
|
|
|
int borderType=BORDER_DEFAULT );
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! computes another complex cornerness criteria at each pixel
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS_W void preCornerDetect( const Mat& src, CV_OUT Mat& dst, int ksize,
|
2010-05-12 01:44:00 +08:00
|
|
|
int borderType=BORDER_DEFAULT );
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! adjusts the corner locations with sub-pixel accuracy to maximize the certain cornerness criteria
|
2010-05-12 01:44:00 +08:00
|
|
|
CV_EXPORTS void cornerSubPix( const Mat& image, vector<Point2f>& corners,
|
|
|
|
Size winSize, Size zeroZone,
|
|
|
|
TermCriteria criteria );
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! finds the strong enough corners where the cornerMinEigenVal() or cornerHarris() report the local maxima
|
2010-11-03 01:58:22 +08:00
|
|
|
CV_EXPORTS_W void goodFeaturesToTrack( const Mat& image, CV_OUT vector<Point2f>& corners,
|
2010-05-12 01:44:00 +08:00
|
|
|
int maxCorners, double qualityLevel, double minDistance,
|
|
|
|
const Mat& mask=Mat(), int blockSize=3,
|
|
|
|
bool useHarrisDetector=false, double k=0.04 );
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! finds lines in the black-n-white image using the standard or pyramid Hough transform
|
2010-11-26 07:16:32 +08:00
|
|
|
CV_EXPORTS_AS(houghLines) void HoughLines( const Mat& image, CV_OUT vector<Vec2f>& lines,
|
2010-05-12 01:44:00 +08:00
|
|
|
double rho, double theta, int threshold,
|
|
|
|
double srn=0, double stn=0 );
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! finds line segments in the black-n-white image using probabalistic Hough transform
|
2010-11-26 07:16:32 +08:00
|
|
|
CV_EXPORTS_AS(houghLinesP) void HoughLinesP( Mat& image, CV_OUT vector<Vec4i>& lines,
|
2010-05-12 01:44:00 +08:00
|
|
|
double rho, double theta, int threshold,
|
|
|
|
double minLineLength=0, double maxLineGap=0 );
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! finds circles in the grayscale image using 2+1 gradient Hough transform
|
2010-11-26 07:16:32 +08:00
|
|
|
CV_EXPORTS_AS(houghCircles) void HoughCircles( const Mat& image, CV_OUT vector<Vec3f>& circles,
|
2010-05-12 01:44:00 +08:00
|
|
|
int method, double dp, double minDist,
|
|
|
|
double param1=100, double param2=100,
|
|
|
|
int minRadius=0, int maxRadius=0 );
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! erodes the image (applies the local minimum operator)
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS_W void erode( const Mat& src, CV_OUT Mat& dst, const Mat& kernel,
|
2010-05-12 01:44:00 +08:00
|
|
|
Point anchor=Point(-1,-1), int iterations=1,
|
|
|
|
int borderType=BORDER_CONSTANT,
|
|
|
|
const Scalar& borderValue=morphologyDefaultBorderValue() );
|
2010-05-25 22:57:10 +08:00
|
|
|
|
|
|
|
//! dilates the image (applies the local maximum operator)
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS_W void dilate( const Mat& src, CV_OUT Mat& dst, const Mat& kernel,
|
2010-05-12 01:44:00 +08:00
|
|
|
Point anchor=Point(-1,-1), int iterations=1,
|
|
|
|
int borderType=BORDER_CONSTANT,
|
|
|
|
const Scalar& borderValue=morphologyDefaultBorderValue() );
|
2010-05-25 22:57:10 +08:00
|
|
|
|
|
|
|
//! applies an advanced morphological operation to the image
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS_W void morphologyEx( const Mat& src, CV_OUT Mat& dst,
|
2010-10-17 04:34:34 +08:00
|
|
|
int op, const Mat& kernel,
|
2010-05-12 01:44:00 +08:00
|
|
|
Point anchor=Point(-1,-1), int iterations=1,
|
|
|
|
int borderType=BORDER_CONSTANT,
|
|
|
|
const Scalar& borderValue=morphologyDefaultBorderValue() );
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! interpolation algorithm
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
INTER_NEAREST=0, //!< nearest neighbor interpolation
|
|
|
|
INTER_LINEAR=1, //!< bilinear interpolation
|
|
|
|
INTER_CUBIC=2, //!< bicubic interpolation
|
|
|
|
INTER_AREA=3, //!< area-based (or super) interpolation
|
|
|
|
INTER_LANCZOS4=4, //!< Lanczos interpolation over 8x8 neighborhood
|
|
|
|
INTER_MAX=7,
|
|
|
|
WARP_INVERSE_MAP=16
|
|
|
|
};
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! resizes the image
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS_W void resize( const Mat& src, CV_OUT Mat& dst,
|
2010-05-12 01:44:00 +08:00
|
|
|
Size dsize, double fx=0, double fy=0,
|
|
|
|
int interpolation=INTER_LINEAR );
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! warps the image using affine transformation
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS_W void warpAffine( const Mat& src, CV_OUT Mat& dst,
|
2010-05-12 01:44:00 +08:00
|
|
|
const Mat& M, Size dsize,
|
|
|
|
int flags=INTER_LINEAR,
|
|
|
|
int borderMode=BORDER_CONSTANT,
|
|
|
|
const Scalar& borderValue=Scalar());
|
2010-05-25 22:57:10 +08:00
|
|
|
|
|
|
|
//! warps the image using perspective transformation
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS_W void warpPerspective( const Mat& src, CV_OUT Mat& dst,
|
2010-05-12 01:44:00 +08:00
|
|
|
const Mat& M, Size dsize,
|
|
|
|
int flags=INTER_LINEAR,
|
|
|
|
int borderMode=BORDER_CONSTANT,
|
|
|
|
const Scalar& borderValue=Scalar());
|
|
|
|
|
|
|
|
enum { INTER_BITS=5, INTER_BITS2=INTER_BITS*2,
|
|
|
|
INTER_TAB_SIZE=(1<<INTER_BITS),
|
|
|
|
INTER_TAB_SIZE2=INTER_TAB_SIZE*INTER_TAB_SIZE };
|
2010-05-25 22:57:10 +08:00
|
|
|
|
|
|
|
//! warps the image using the precomputed maps. The maps are stored in either floating-point or integer fixed-point format
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS_W void remap( const Mat& src, CV_OUT Mat& dst, const Mat& map1, const Mat& map2,
|
2010-05-12 01:44:00 +08:00
|
|
|
int interpolation, int borderMode=BORDER_CONSTANT,
|
|
|
|
const Scalar& borderValue=Scalar());
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! converts maps for remap from floating-point to fixed-point format or backwards
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS_W void convertMaps( const Mat& map1, const Mat& map2,
|
2010-10-17 04:34:34 +08:00
|
|
|
CV_OUT Mat& dstmap1, CV_OUT Mat& dstmap2,
|
2010-05-12 01:44:00 +08:00
|
|
|
int dstmap1type, bool nninterpolation=false );
|
2010-05-12 15:33:21 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! returns 2x3 affine transformation matrix for the planar rotation.
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS_W Mat getRotationMatrix2D( Point2f center, double angle, double scale );
|
2010-05-25 22:57:10 +08:00
|
|
|
//! returns 3x3 perspective transformation for the corresponding 4 point pairs.
|
2010-05-12 01:44:00 +08:00
|
|
|
CV_EXPORTS Mat getPerspectiveTransform( const Point2f src[], const Point2f dst[] );
|
2010-05-25 22:57:10 +08:00
|
|
|
//! returns 2x3 affine transformation for the corresponding 3 point pairs.
|
2010-05-12 01:44:00 +08:00
|
|
|
CV_EXPORTS Mat getAffineTransform( const Point2f src[], const Point2f dst[] );
|
2010-05-25 22:57:10 +08:00
|
|
|
//! computes 2x3 affine transformation matrix that is inverse to the specified 2x3 affine transformation.
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS_W void invertAffineTransform( const Mat& M, CV_OUT Mat& iM );
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! extracts rectangle from the image at sub-pixel location
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS_W void getRectSubPix( const Mat& image, Size patchSize,
|
2010-10-17 04:34:34 +08:00
|
|
|
Point2f center, CV_OUT Mat& patch, int patchType=-1 );
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! computes the integral image
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS_W void integral( const Mat& src, CV_OUT Mat& sum, int sdepth=-1 );
|
2010-05-25 22:57:10 +08:00
|
|
|
//! computes the integral image and integral for the squared image
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS_AS(integral2) void integral( const Mat& src, CV_OUT Mat& sum, CV_OUT Mat& sqsum, int sdepth=-1 );
|
2010-05-25 22:57:10 +08:00
|
|
|
//! computes the integral image, integral for the squared image and the tilted integral image
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS_AS(integral3) void integral( const Mat& src, CV_OUT Mat& sum, CV_OUT Mat& sqsum, CV_OUT Mat& tilted, int sdepth=-1 );
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! adds image to the accumulator (dst += src). Unlike cv::add, dst and src can have different types.
|
2010-10-29 21:09:49 +08:00
|
|
|
CV_EXPORTS_W void accumulate( const Mat& src, CV_IN_OUT Mat& dst, const Mat& mask=Mat() );
|
2010-05-25 22:57:10 +08:00
|
|
|
//! adds squared src image to the accumulator (dst += src*src).
|
2010-10-29 21:09:49 +08:00
|
|
|
CV_EXPORTS_W void accumulateSquare( const Mat& src, CV_IN_OUT Mat& dst, const Mat& mask=Mat() );
|
2010-05-25 22:57:10 +08:00
|
|
|
//! adds product of the 2 images to the accumulator (dst += src1*src2).
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS_W void accumulateProduct( const Mat& src1, const Mat& src2,
|
2010-10-29 21:09:49 +08:00
|
|
|
CV_IN_OUT Mat& dst, const Mat& mask=Mat() );
|
2010-05-25 22:57:10 +08:00
|
|
|
//! updates the running average (dst = dst*(1-alpha) + src*alpha)
|
2010-10-29 21:09:49 +08:00
|
|
|
CV_EXPORTS_W void accumulateWeighted( const Mat& src, CV_IN_OUT Mat& dst,
|
|
|
|
double alpha, const Mat& mask=Mat() );
|
2010-05-25 22:57:10 +08:00
|
|
|
|
|
|
|
//! type of the threshold operation
|
2010-05-12 01:44:00 +08:00
|
|
|
enum { THRESH_BINARY=0, THRESH_BINARY_INV=1, THRESH_TRUNC=2, THRESH_TOZERO=3,
|
|
|
|
THRESH_TOZERO_INV=4, THRESH_MASK=7, THRESH_OTSU=8 };
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! applies fixed threshold to the image
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS_W double threshold( const Mat& src, CV_OUT Mat& dst, double thresh, double maxval, int type );
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! adaptive threshold algorithm
|
2010-05-12 01:44:00 +08:00
|
|
|
enum { ADAPTIVE_THRESH_MEAN_C=0, ADAPTIVE_THRESH_GAUSSIAN_C=1 };
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! applies variable (adaptive) threshold to the image
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS_W void adaptiveThreshold( const Mat& src, CV_OUT Mat& dst, double maxValue,
|
2010-05-12 01:44:00 +08:00
|
|
|
int adaptiveMethod, int thresholdType,
|
|
|
|
int blockSize, double C );
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! smooths and downsamples the image
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS_W void pyrDown( const Mat& src, CV_OUT Mat& dst, const Size& dstsize=Size());
|
2010-05-25 22:57:10 +08:00
|
|
|
//! upsamples and smoothes the image
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS_W void pyrUp( const Mat& src, CV_OUT Mat& dst, const Size& dstsize=Size());
|
2010-05-25 22:57:10 +08:00
|
|
|
//! builds the gaussian pyramid using pyrDown() as a basic operation
|
2010-10-17 04:34:34 +08:00
|
|
|
CV_EXPORTS void buildPyramid( const Mat& src, CV_OUT vector<Mat>& dst, int maxlevel );
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! corrects lens distortion for the given camera matrix and distortion coefficients
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS_W void undistort( const Mat& src, CV_OUT Mat& dst, const Mat& cameraMatrix,
|
2010-05-12 01:44:00 +08:00
|
|
|
const Mat& distCoeffs, const Mat& newCameraMatrix=Mat() );
|
2010-05-25 22:57:10 +08:00
|
|
|
//! initializes maps for cv::remap() to correct lens distortion and optionally rectify the image
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS_W void initUndistortRectifyMap( const Mat& cameraMatrix, const Mat& distCoeffs,
|
2010-05-12 01:44:00 +08:00
|
|
|
const Mat& R, const Mat& newCameraMatrix,
|
2010-10-17 04:34:34 +08:00
|
|
|
Size size, int m1type, CV_OUT Mat& map1, CV_OUT Mat& map2 );
|
2010-08-06 18:20:49 +08:00
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROJ_SPHERICAL_ORTHO = 0,
|
|
|
|
PROJ_SPHERICAL_EQRECT = 1
|
|
|
|
};
|
|
|
|
|
|
|
|
//! initializes maps for cv::remap() for wide-angle
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS_W float initWideAngleProjMap( const Mat& cameraMatrix, const Mat& distCoeffs,
|
2010-08-06 18:20:49 +08:00
|
|
|
Size imageSize, int destImageWidth,
|
2010-10-17 04:34:34 +08:00
|
|
|
int m1type, CV_OUT Mat& map1, CV_OUT Mat& map2,
|
2010-08-06 18:20:49 +08:00
|
|
|
int projType=PROJ_SPHERICAL_EQRECT, double alpha=0);
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! returns the default new camera matrix (by default it is the same as cameraMatrix unless centerPricipalPoint=true)
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS_W Mat getDefaultNewCameraMatrix( const Mat& cameraMatrix, Size imgsize=Size(),
|
2010-05-12 01:44:00 +08:00
|
|
|
bool centerPrincipalPoint=false );
|
2010-05-25 22:57:10 +08:00
|
|
|
//! returns points' coordinates after lens distortion correction
|
2010-10-17 04:34:34 +08:00
|
|
|
CV_EXPORTS void undistortPoints( const Mat& src, CV_OUT vector<Point2f>& dst,
|
2010-05-12 15:33:21 +08:00
|
|
|
const Mat& cameraMatrix, const Mat& distCoeffs,
|
|
|
|
const Mat& R=Mat(), const Mat& P=Mat());
|
2010-05-25 22:57:10 +08:00
|
|
|
//! returns points' coordinates after lens distortion correction
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS_W void undistortPoints( const Mat& src, CV_OUT Mat& dst,
|
2010-05-12 15:33:21 +08:00
|
|
|
const Mat& cameraMatrix, const Mat& distCoeffs,
|
|
|
|
const Mat& R=Mat(), const Mat& P=Mat());
|
2010-05-12 01:44:00 +08:00
|
|
|
|
|
|
|
template<> CV_EXPORTS void Ptr<CvHistogram>::delete_obj();
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! computes the joint dense histogram for a set of images.
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS void calcHist( const Mat* images, int nimages,
|
|
|
|
const int* channels, const Mat& mask,
|
|
|
|
Mat& hist, int dims, const int* histSize,
|
|
|
|
const float** ranges, bool uniform=true, bool accumulate=false );
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! computes the joint sparse histogram for a set of images.
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS void calcHist( const Mat* images, int nimages,
|
|
|
|
const int* channels, const Mat& mask,
|
|
|
|
SparseMat& hist, int dims,
|
|
|
|
const int* histSize, const float** ranges,
|
2010-10-17 04:34:34 +08:00
|
|
|
bool uniform=true, bool accumulate=false );
|
2010-05-25 22:57:10 +08:00
|
|
|
|
|
|
|
//! computes back projection for the set of images
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS void calcBackProject( const Mat* images, int nimages,
|
|
|
|
const int* channels, const Mat& hist,
|
|
|
|
Mat& backProject, const float** ranges,
|
2010-05-12 01:44:00 +08:00
|
|
|
double scale=1, bool uniform=true );
|
2010-05-25 22:57:10 +08:00
|
|
|
|
|
|
|
//! computes back projection for the set of images
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS void calcBackProject( const Mat* images, int nimages,
|
|
|
|
const int* channels, const SparseMat& hist,
|
|
|
|
Mat& backProject, const float** ranges,
|
2010-05-12 01:44:00 +08:00
|
|
|
double scale=1, bool uniform=true );
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! compares two histograms stored in dense arrays
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS_W double compareHist( const Mat& H1, const Mat& H2, int method );
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! compares two histograms stored in sparse arrays
|
2010-05-12 01:44:00 +08:00
|
|
|
CV_EXPORTS double compareHist( const SparseMat& H1, const SparseMat& H2, int method );
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! normalizes the grayscale image brightness and contrast by normalizing its histogram
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS_W void equalizeHist( const Mat& src, CV_OUT Mat& dst );
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! segments the image using watershed algorithm
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS_W void watershed( const Mat& image, Mat& markers );
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-07-29 00:41:12 +08:00
|
|
|
//! filters image using meanshift algorithm
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS_W void pyrMeanShiftFiltering( const Mat& src, CV_OUT Mat& dst,
|
2010-07-29 00:41:12 +08:00
|
|
|
double sp, double sr, int maxLevel=1,
|
|
|
|
TermCriteria termcrit=TermCriteria(TermCriteria::MAX_ITER+TermCriteria::EPS,5,1) );
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! class of the pixel in GrabCut algorithm
|
|
|
|
enum { GC_BGD = 0, //!< background
|
|
|
|
GC_FGD = 1, //!< foreground
|
|
|
|
GC_PR_BGD = 2, //!< most probably background
|
|
|
|
GC_PR_FGD = 3 //!< most probably foreground
|
2010-05-12 01:44:00 +08:00
|
|
|
};
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! GrabCut algorithm flags
|
2010-05-12 01:44:00 +08:00
|
|
|
enum { GC_INIT_WITH_RECT = 0,
|
|
|
|
GC_INIT_WITH_MASK = 1,
|
|
|
|
GC_EVAL = 2
|
|
|
|
};
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! segments the image using GrabCut algorithm
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS_W void grabCut( const Mat& img, Mat& mask, Rect rect,
|
2010-05-12 01:44:00 +08:00
|
|
|
Mat& bgdModel, Mat& fgdModel,
|
|
|
|
int iterCount, int mode = GC_EVAL );
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! the inpainting algorithm
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
INPAINT_NS=0, // Navier-Stokes algorithm
|
|
|
|
INPAINT_TELEA=1 // A. Telea algorithm
|
|
|
|
};
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! restores the damaged image areas using one of the available intpainting algorithms
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS_W void inpaint( const Mat& src, const Mat& inpaintMask,
|
2010-10-17 04:34:34 +08:00
|
|
|
CV_OUT Mat& dst, double inpaintRange, int flags );
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! builds the discrete Voronoi diagram
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS_AS(distanceTransformWithLabels)
|
|
|
|
void distanceTransform( const Mat& src, CV_OUT Mat& dst, Mat& labels,
|
|
|
|
int distanceType, int maskSize );
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! computes the distance transform map
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS_W void distanceTransform( const Mat& src, CV_OUT Mat& dst,
|
2010-05-12 01:44:00 +08:00
|
|
|
int distanceType, int maskSize );
|
|
|
|
|
|
|
|
enum { FLOODFILL_FIXED_RANGE = 1 << 16,
|
|
|
|
FLOODFILL_MASK_ONLY = 1 << 17 };
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! fills the semi-uniform image region starting from the specified seed point
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS_W int floodFill( Mat& image,
|
2010-11-03 01:58:22 +08:00
|
|
|
Point seedPoint, Scalar newVal, CV_OUT Rect* rect=0,
|
2010-05-12 01:44:00 +08:00
|
|
|
Scalar loDiff=Scalar(), Scalar upDiff=Scalar(),
|
|
|
|
int flags=4 );
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! fills the semi-uniform image region and/or the mask starting from the specified seed point
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS_AS(floodFillMask) int floodFill( Mat& image, Mat& mask,
|
2010-11-03 01:58:22 +08:00
|
|
|
Point seedPoint, Scalar newVal, CV_OUT Rect* rect=0,
|
2010-05-12 01:44:00 +08:00
|
|
|
Scalar loDiff=Scalar(), Scalar upDiff=Scalar(),
|
|
|
|
int flags=4 );
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! converts image from one color space to another
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS_W void cvtColor( const Mat& src, CV_OUT Mat& dst, int code, int dstCn=0 );
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! raster image moments
|
2010-11-03 01:58:22 +08:00
|
|
|
class CV_EXPORTS_W_MAP Moments
|
2010-05-12 01:44:00 +08:00
|
|
|
{
|
|
|
|
public:
|
2010-05-25 22:57:10 +08:00
|
|
|
//! the default constructor
|
2010-05-12 01:44:00 +08:00
|
|
|
Moments();
|
2010-05-25 22:57:10 +08:00
|
|
|
//! the full constructor
|
2010-05-12 01:44:00 +08:00
|
|
|
Moments(double m00, double m10, double m01, double m20, double m11,
|
|
|
|
double m02, double m30, double m21, double m12, double m03 );
|
2010-05-25 22:57:10 +08:00
|
|
|
//! the conversion from CvMoments
|
2010-05-12 01:44:00 +08:00
|
|
|
Moments( const CvMoments& moments );
|
2010-05-25 22:57:10 +08:00
|
|
|
//! the conversion to CvMoments
|
2010-05-12 01:44:00 +08:00
|
|
|
operator CvMoments() const;
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! spatial moments
|
2010-11-03 01:58:22 +08:00
|
|
|
CV_PROP_RW double m00, m10, m01, m20, m11, m02, m30, m21, m12, m03;
|
2010-05-25 22:57:10 +08:00
|
|
|
//! central moments
|
2010-11-03 01:58:22 +08:00
|
|
|
CV_PROP_RW double mu20, mu11, mu02, mu30, mu21, mu12, mu03;
|
2010-05-25 22:57:10 +08:00
|
|
|
//! central normalized moments
|
2010-11-03 01:58:22 +08:00
|
|
|
CV_PROP_RW double nu20, nu11, nu02, nu30, nu21, nu12, nu03;
|
2010-05-12 01:44:00 +08:00
|
|
|
};
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! computes moments of the rasterized shape or a vector of points
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS_W Moments moments( const Mat& array, bool binaryImage=false );
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! computes 7 Hu invariants from the moments
|
2010-05-12 01:44:00 +08:00
|
|
|
CV_EXPORTS void HuMoments( const Moments& moments, double hu[7] );
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! type of the template matching operation
|
2010-05-12 01:44:00 +08:00
|
|
|
enum { TM_SQDIFF=0, TM_SQDIFF_NORMED=1, TM_CCORR=2, TM_CCORR_NORMED=3, TM_CCOEFF=4, TM_CCOEFF_NORMED=5 };
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! computes the proximity map for the raster template and the image where the template is searched for
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS_W void matchTemplate( const Mat& image, const Mat& templ, CV_OUT Mat& result, int method );
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! mode of the contour retrieval algorithm
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
RETR_EXTERNAL=0, //!< retrieve only the most external (top-level) contours
|
|
|
|
RETR_LIST=1, //!< retrieve all the contours without any hierarchical information
|
|
|
|
RETR_CCOMP=2, //!< retrieve the connected components (that can possibly be nested)
|
|
|
|
RETR_TREE=3 //!< retrieve all the contours and the whole hierarchy
|
|
|
|
};
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! the contour approximation algorithm
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
CHAIN_APPROX_NONE=0,
|
|
|
|
CHAIN_APPROX_SIMPLE=1,
|
|
|
|
CHAIN_APPROX_TC89_L1=2,
|
|
|
|
CHAIN_APPROX_TC89_KCOS=3
|
|
|
|
};
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! retrieves contours and the hierarchical information from black-n-white image.
|
2010-10-17 04:34:34 +08:00
|
|
|
CV_EXPORTS void findContours( Mat& image, CV_OUT vector<vector<Point> >& contours,
|
2010-05-12 01:44:00 +08:00
|
|
|
vector<Vec4i>& hierarchy, int mode,
|
|
|
|
int method, Point offset=Point());
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! retrieves contours from black-n-white image.
|
2010-10-17 04:34:34 +08:00
|
|
|
CV_EXPORTS void findContours( Mat& image, CV_OUT vector<vector<Point> >& contours,
|
2010-05-12 01:44:00 +08:00
|
|
|
int mode, int method, Point offset=Point());
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! draws contours in the image
|
2010-05-12 01:44:00 +08:00
|
|
|
CV_EXPORTS void drawContours( Mat& image, const vector<vector<Point> >& contours,
|
|
|
|
int contourIdx, const Scalar& color,
|
|
|
|
int thickness=1, int lineType=8,
|
|
|
|
const vector<Vec4i>& hierarchy=vector<Vec4i>(),
|
|
|
|
int maxLevel=INT_MAX, Point offset=Point() );
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! approximates contour or a curve using Douglas-Peucker algorithm
|
2010-05-12 01:44:00 +08:00
|
|
|
CV_EXPORTS void approxPolyDP( const Mat& curve,
|
2010-10-17 04:34:34 +08:00
|
|
|
CV_OUT vector<Point>& approxCurve,
|
2010-05-12 01:44:00 +08:00
|
|
|
double epsilon, bool closed );
|
2010-05-25 22:57:10 +08:00
|
|
|
//! approximates contour or a curve using Douglas-Peucker algorithm
|
2010-05-12 01:44:00 +08:00
|
|
|
CV_EXPORTS void approxPolyDP( const Mat& curve,
|
2010-10-17 04:34:34 +08:00
|
|
|
CV_OUT vector<Point2f>& approxCurve,
|
2010-05-12 01:44:00 +08:00
|
|
|
double epsilon, bool closed );
|
2010-05-25 22:57:10 +08:00
|
|
|
//! computes the contour perimeter (closed=true) or a curve length
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS_W double arcLength( const Mat& curve, bool closed );
|
2010-05-25 22:57:10 +08:00
|
|
|
//! computes the bounding rectangle for a contour
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS_W Rect boundingRect( const Mat& points );
|
2010-05-25 22:57:10 +08:00
|
|
|
//! computes the contour area
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS_W double contourArea( const Mat& contour, bool oriented=false );
|
2010-05-25 22:57:10 +08:00
|
|
|
//! computes the minimal rotated rectangle for a set of points
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS_W RotatedRect minAreaRect( const Mat& points );
|
2010-05-25 22:57:10 +08:00
|
|
|
//! computes the minimal enclosing circle for a set of points
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS_W void minEnclosingCircle( const Mat& points,
|
2010-05-12 01:44:00 +08:00
|
|
|
Point2f& center, float& radius );
|
2010-05-25 22:57:10 +08:00
|
|
|
//! matches two contours using one of the available algorithms
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS_W double matchShapes( const Mat& contour1,
|
2010-05-12 01:44:00 +08:00
|
|
|
const Mat& contour2,
|
|
|
|
int method, double parameter );
|
2010-05-25 22:57:10 +08:00
|
|
|
//! computes convex hull for a set of 2D points.
|
2010-10-17 04:34:34 +08:00
|
|
|
CV_EXPORTS void convexHull( const Mat& points, CV_OUT vector<int>& hull, bool clockwise=false );
|
2010-05-25 22:57:10 +08:00
|
|
|
//! computes convex hull for a set of 2D points.
|
2010-10-17 04:34:34 +08:00
|
|
|
CV_EXPORTS void convexHull( const Mat& points, CV_OUT vector<Point>& hull, bool clockwise=false );
|
2010-05-25 22:57:10 +08:00
|
|
|
//! computes convex hull for a set of 2D points.
|
2010-10-17 04:34:34 +08:00
|
|
|
CV_EXPORTS void convexHull( const Mat& points, CV_OUT vector<Point2f>& hull, bool clockwise=false );
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! returns true iff the contour is convex. Does not support contours with self-intersection
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS_W bool isContourConvex( const Mat& contour );
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! fits ellipse to the set of 2D points
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS_W RotatedRect fitEllipse( const Mat& points );
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! fits line to the set of 2D points using M-estimator algorithm
|
2010-10-17 04:34:34 +08:00
|
|
|
CV_EXPORTS void fitLine( const Mat& points, CV_OUT Vec4f& line, int distType,
|
2010-10-28 02:26:39 +08:00
|
|
|
double param, double reps, double aeps );
|
2010-05-25 22:57:10 +08:00
|
|
|
//! fits line to the set of 3D points using M-estimator algorithm
|
2010-10-17 04:34:34 +08:00
|
|
|
CV_EXPORTS void fitLine( const Mat& points, CV_OUT Vec6f& line, int distType,
|
2010-10-28 02:26:39 +08:00
|
|
|
double param, double reps, double aeps );
|
2010-05-25 22:57:10 +08:00
|
|
|
//! checks if the point is inside the contour. Optionally computes the signed distance from the point to the contour boundary
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS_W double pointPolygonTest( const Mat& contour,
|
2010-05-12 01:44:00 +08:00
|
|
|
Point2f pt, bool measureDist );
|
2010-05-25 22:57:10 +08:00
|
|
|
|
|
|
|
//! estimates the best-fit affine transformation that maps one 2D point set to another or one image to another.
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS_W Mat estimateRigidTransform( const Mat& A, const Mat& B,
|
2010-05-12 01:44:00 +08:00
|
|
|
bool fullAffine );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 2009-01-12, Xavier Delacour <xavier.delacour@gmail.com>
|
|
|
|
|
|
|
|
struct lsh_hash {
|
|
|
|
int h1, h2;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct CvLSHOperations
|
|
|
|
{
|
|
|
|
virtual ~CvLSHOperations() {}
|
|
|
|
|
|
|
|
virtual int vector_add(const void* data) = 0;
|
|
|
|
virtual void vector_remove(int i) = 0;
|
|
|
|
virtual const void* vector_lookup(int i) = 0;
|
|
|
|
virtual void vector_reserve(int n) = 0;
|
|
|
|
virtual unsigned int vector_count() = 0;
|
|
|
|
|
|
|
|
virtual void hash_insert(lsh_hash h, int l, int i) = 0;
|
|
|
|
virtual void hash_remove(lsh_hash h, int l, int i) = 0;
|
|
|
|
virtual int hash_lookup(lsh_hash h, int l, int* ret_i, int ret_i_max) = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* End of file. */
|