This commit is contained in:
@@ -30,11 +30,11 @@ Finds edges in an image using the [Canny86]_ algorithm.
|
||||
The function finds edges in the input image ``image`` and marks them in the output map ``edges`` using the Canny algorithm. The smallest value between ``threshold1`` and ``threshold2`` is used for edge linking. The largest value is used to find initial segments of strong edges. See
|
||||
http://en.wikipedia.org/wiki/Canny_edge_detector
|
||||
|
||||
.. Sample code::
|
||||
.. note::
|
||||
|
||||
* : An example on using the canny edge detector can be found at opencv_source_code/samples/cpp/edge.cpp
|
||||
* An example on using the canny edge detector can be found at opencv_source_code/samples/cpp/edge.cpp
|
||||
|
||||
* : PYTHON : An example on using the canny edge detector can be found at opencv_source_code/samples/cpp/edge.py
|
||||
* (Python) An example on using the canny edge detector can be found at opencv_source_code/samples/cpp/edge.py
|
||||
|
||||
cornerEigenValsAndVecs
|
||||
----------------------
|
||||
@@ -85,9 +85,9 @@ The output of the function can be used for robust edge or corner detection.
|
||||
:ocv:func:`cornerHarris`,
|
||||
:ocv:func:`preCornerDetect`
|
||||
|
||||
.. Sample code::
|
||||
.. note::
|
||||
|
||||
* : PYTHON : An example on how to use eigenvectors and eigenvalues to estimate image texture flow direction can be found at opencv_source_code/samples/python2/texture_flow.py
|
||||
* (Python) An example on how to use eigenvectors and eigenvalues to estimate image texture flow direction can be found at opencv_source_code/samples/python2/texture_flow.py
|
||||
|
||||
cornerHarris
|
||||
------------
|
||||
@@ -350,9 +350,9 @@ Example: ::
|
||||
:ocv:func:`fitEllipse`,
|
||||
:ocv:func:`minEnclosingCircle`
|
||||
|
||||
.. Sample code::
|
||||
.. note::
|
||||
|
||||
* : An example using the Hough circle detector can be found at opencv_source_code/samples/cpp/houghcircles.cpp
|
||||
* An example using the Hough circle detector can be found at opencv_source_code/samples/cpp/houghcircles.cpp
|
||||
|
||||
HoughLines
|
||||
----------
|
||||
@@ -407,9 +407,9 @@ Finds lines in a binary image using the standard Hough transform.
|
||||
The function implements the standard or standard multi-scale Hough transform algorithm for line detection. See http://homepages.inf.ed.ac.uk/rbf/HIPR2/hough.htm for a good explanation of Hough transform.
|
||||
See also the example in :ocv:func:`HoughLinesP` description.
|
||||
|
||||
.. Sample code::
|
||||
.. note::
|
||||
|
||||
* : An example using the Hough line detector can be found at opencv_source_code/samples/cpp/houghlines.cpp
|
||||
* An example using the Hough line detector can be found at opencv_source_code/samples/cpp/houghlines.cpp
|
||||
|
||||
HoughLinesP
|
||||
-----------
|
||||
|
||||
@@ -22,9 +22,9 @@ OpenCV enables you to specify the extrapolation method. For details, see the fun
|
||||
* BORDER_CONSTANT: iiiiii|abcdefgh|iiiiiii with some specified 'i'
|
||||
*/
|
||||
|
||||
.. Sample code::
|
||||
.. note::
|
||||
|
||||
* : PYTHON : A complete example illustrating different morphological operations like erode/dilate, open/close, blackhat/tophat ... can be found at opencv_source_code/samples/python2/morphology.py
|
||||
* (Python) A complete example illustrating different morphological operations like erode/dilate, open/close, blackhat/tophat ... can be found at opencv_source_code/samples/python2/morphology.py
|
||||
|
||||
BaseColumnFilter
|
||||
----------------
|
||||
@@ -785,9 +785,9 @@ The function supports the in-place mode. Dilation can be applied several ( ``ite
|
||||
:ocv:func:`getStructuringElement`
|
||||
|
||||
|
||||
.. Sample code::
|
||||
.. note::
|
||||
|
||||
* : An example using the morphological dilate operation can be found at opencv_source_code/samples/cpp/morphology2.cpp
|
||||
* An example using the morphological dilate operation can be found at opencv_source_code/samples/cpp/morphology2.cpp
|
||||
|
||||
|
||||
|
||||
@@ -831,9 +831,9 @@ The function supports the in-place mode. Erosion can be applied several ( ``iter
|
||||
:ocv:func:`createMorphologyFilter`,
|
||||
:ocv:func:`getStructuringElement`
|
||||
|
||||
.. Sample code::
|
||||
.. note::
|
||||
|
||||
* : An example using the morphological erode operation can be found at opencv_source_code/samples/cpp/morphology2.cpp
|
||||
* An example using the morphological erode operation can be found at opencv_source_code/samples/cpp/morphology2.cpp
|
||||
|
||||
filter2D
|
||||
--------
|
||||
@@ -1194,9 +1194,9 @@ Any of the operations can be done in-place. In case of multi-channel images, eac
|
||||
:ocv:func:`createMorphologyFilter`,
|
||||
:ocv:func:`getStructuringElement`
|
||||
|
||||
.. Sample code::
|
||||
.. note::
|
||||
|
||||
* : An example using the morphologyEx function for the morphological opening and closing operations can be found at opencv_source_code/samples/cpp/morphology2.cpp
|
||||
* An example using the morphologyEx function for the morphological opening and closing operations can be found at opencv_source_code/samples/cpp/morphology2.cpp
|
||||
|
||||
Laplacian
|
||||
---------
|
||||
@@ -1240,9 +1240,9 @@ This is done when ``ksize > 1`` . When ``ksize == 1`` , the Laplacian is compute
|
||||
:ocv:func:`Sobel`,
|
||||
:ocv:func:`Scharr`
|
||||
|
||||
.. Sample code::
|
||||
.. note::
|
||||
|
||||
* : An example using the Laplace transformation for edge detection can be found at opencv_source_code/samples/cpp/laplace.cpp
|
||||
* An example using the Laplace transformation for edge detection can be found at opencv_source_code/samples/cpp/laplace.cpp
|
||||
|
||||
pyrDown
|
||||
-------
|
||||
@@ -1299,9 +1299,9 @@ Upsamples an image and then blurs it.
|
||||
The function performs the upsampling step of the Gaussian pyramid construction, though it can actually be used to construct the Laplacian pyramid. First, it upsamples the source image by injecting even zero rows and columns and then convolves the result with the same kernel as in
|
||||
:ocv:func:`pyrDown` multiplied by 4.
|
||||
|
||||
.. Sample code::
|
||||
.. note::
|
||||
|
||||
* : PYTHON : An example of Laplacian Pyramid construction and merging can be found at opencv_source_code/samples/python2/lappyr.py
|
||||
* (Python) An example of Laplacian Pyramid construction and merging can be found at opencv_source_code/samples/python2/lappyr.py
|
||||
|
||||
|
||||
pyrMeanShiftFiltering
|
||||
@@ -1350,9 +1350,9 @@ After the iterations over, the color components of the initial pixel (that is, t
|
||||
|
||||
When ``maxLevel > 0``, the gaussian pyramid of ``maxLevel+1`` levels is built, and the above procedure is run on the smallest layer first. After that, the results are propagated to the larger layer and the iterations are run again only on those pixels where the layer colors differ by more than ``sr`` from the lower-resolution layer of the pyramid. That makes boundaries of color regions sharper. Note that the results will be actually different from the ones obtained by running the meanshift procedure on the whole original image (i.e. when ``maxLevel==0``).
|
||||
|
||||
.. Sample code::
|
||||
.. note::
|
||||
|
||||
* : An example using mean-shift image segmentation can be found at opencv_source_code/samples/cpp/meanshift_segmentation.cpp
|
||||
* An example using mean-shift image segmentation can be found at opencv_source_code/samples/cpp/meanshift_segmentation.cpp
|
||||
|
||||
sepFilter2D
|
||||
-----------
|
||||
|
||||
@@ -298,9 +298,9 @@ where
|
||||
|
||||
The function emulates the human "foveal" vision and can be used for fast scale and rotation-invariant template matching, for object tracking and so forth. The function can not operate in-place.
|
||||
|
||||
.. Sample code::
|
||||
.. note::
|
||||
|
||||
* : An example using the geometric logpolar operation in 4 applications can be found at opencv_source_code/samples/cpp/logpolar_bsm.cpp
|
||||
* An example using the geometric logpolar operation in 4 applications can be found at opencv_source_code/samples/cpp/logpolar_bsm.cpp
|
||||
|
||||
remap
|
||||
-----
|
||||
|
||||
@@ -98,12 +98,12 @@ input arrays at the same location. The sample below shows how to compute a 2D Hu
|
||||
waitKey();
|
||||
}
|
||||
|
||||
.. Sample code::
|
||||
.. note::
|
||||
|
||||
* : An example for creating histograms of an image can be found at opencv_source_code/samples/cpp/demhist.cpp
|
||||
* An example for creating histograms of an image can be found at opencv_source_code/samples/cpp/demhist.cpp
|
||||
|
||||
* : PYTHON : An example for creating color histograms can be found at opencv_source/samples/python2/color_histogram.py
|
||||
* : PYTHON : An example illustrating RGB and grayscale histogram plotting can be found at opencv_source/samples/python2/hist.py
|
||||
* (Python) An example for creating color histograms can be found at opencv_source/samples/python2/color_histogram.py
|
||||
* (Python) An example illustrating RGB and grayscale histogram plotting can be found at opencv_source/samples/python2/hist.py
|
||||
|
||||
|
||||
calcBackProject
|
||||
|
||||
@@ -476,11 +476,11 @@ In this mode, the complexity is still linear.
|
||||
That is, the function provides a very fast way to compute the Voronoi diagram for a binary image.
|
||||
Currently, the second variant can use only the approximate distance transform algorithm, i.e. ``maskSize=CV_DIST_MASK_PRECISE`` is not supported yet.
|
||||
|
||||
.. Sample code::
|
||||
.. note::
|
||||
|
||||
* : An example on using the distance transform can be found at opencv_source_code/samples/cpp/distrans.cpp
|
||||
* An example on using the distance transform can be found at opencv_source_code/samples/cpp/distrans.cpp
|
||||
|
||||
* : PYTHON : An example on using the distance transform can be found at opencv_source/samples/python2/distrans.py
|
||||
* (Python) An example on using the distance transform can be found at opencv_source/samples/python2/distrans.py
|
||||
|
||||
floodFill
|
||||
---------
|
||||
@@ -584,11 +584,11 @@ Use these functions to either mark a connected component with the specified colo
|
||||
|
||||
.. seealso:: :ocv:func:`findContours`
|
||||
|
||||
.. Sample code::
|
||||
.. note::
|
||||
|
||||
* : An example using the FloodFill technique can be found at opencv_source_code/samples/cpp/ffilldemo.cpp
|
||||
* An example using the FloodFill technique can be found at opencv_source_code/samples/cpp/ffilldemo.cpp
|
||||
|
||||
* : PYTHON : An example using the FloodFill technique can be found at opencv_source_code/samples/python2/floodfill.cpp
|
||||
* (Python) An example using the FloodFill technique can be found at opencv_source_code/samples/python2/floodfill.cpp
|
||||
|
||||
integral
|
||||
--------
|
||||
@@ -748,11 +748,11 @@ Visual demonstration and usage example of the function can be found in the OpenC
|
||||
|
||||
.. seealso:: :ocv:func:`findContours`
|
||||
|
||||
.. Sample code::
|
||||
.. note::
|
||||
|
||||
* : An example using the watershed algorithm can be found at opencv_source_code/samples/cpp/watershed.cpp
|
||||
* An example using the watershed algorithm can be found at opencv_source_code/samples/cpp/watershed.cpp
|
||||
|
||||
* : PYTHON : An example using the watershed algorithm can be found at opencv_source_code/samples/python2/watershed.py
|
||||
* (Python) An example using the watershed algorithm can be found at opencv_source_code/samples/python2/watershed.py
|
||||
|
||||
grabCut
|
||||
-------
|
||||
@@ -800,8 +800,8 @@ See the sample ``grabcut.cpp`` to learn how to use the function.
|
||||
.. [Meyer92] Meyer, F. *Color Image Segmentation*, ICIP92, 1992
|
||||
|
||||
|
||||
.. Sample code::
|
||||
.. note::
|
||||
|
||||
* : An example using the GrabCut algorithm can be found at opencv_source_code/samples/cpp/grabcut.cpp
|
||||
* An example using the GrabCut algorithm can be found at opencv_source_code/samples/cpp/grabcut.cpp
|
||||
|
||||
* : PYTHON : An example using the GrabCut algorithm can be found at opencv_source_code/samples/python2/grabcut.py
|
||||
* (Python) An example using the GrabCut algorithm can be found at opencv_source_code/samples/python2/grabcut.py
|
||||
|
||||
@@ -73,6 +73,6 @@ image patch:
|
||||
After the function finishes the comparison, the best matches can be found as global minimums (when ``CV_TM_SQDIFF`` was used) or maximums (when ``CV_TM_CCORR`` or ``CV_TM_CCOEFF`` was used) using the
|
||||
:ocv:func:`minMaxLoc` function. In case of a color image, template summation in the numerator and each sum in the denominator is done over all of the channels and separate mean values are used for each channel. That is, the function can take a color template and a color image. The result will still be a single-channel image, which is easier to analyze.
|
||||
|
||||
.. Sample code::
|
||||
.. note::
|
||||
|
||||
* : PYTHON : An example on how to match mouse selected regions in an image can be found at opencv_source_code/samples/python2/mouse_and_match.py
|
||||
* (Python) An example on how to match mouse selected regions in an image can be found at opencv_source_code/samples/python2/mouse_and_match.py
|
||||
|
||||
@@ -192,13 +192,13 @@ The function retrieves contours from the binary image using the algorithm
|
||||
|
||||
.. note:: If you use the new Python interface then the ``CV_`` prefix has to be omitted in contour retrieval mode and contour approximation method parameters (for example, use ``cv2.RETR_LIST`` and ``cv2.CHAIN_APPROX_NONE`` parameters). If you use the old Python interface then these parameters have the ``CV_`` prefix (for example, use ``cv.CV_RETR_LIST`` and ``cv.CV_CHAIN_APPROX_NONE``).
|
||||
|
||||
.. Sample code::
|
||||
.. note::
|
||||
|
||||
* : An example using the findContour functionality can be found at opencv_source_code/samples/cpp/contours2.cpp
|
||||
* : An example using findContours to clean up a background segmentation result at opencv_source_code/samples/cpp/segment_objects.cpp
|
||||
* An example using the findContour functionality can be found at opencv_source_code/samples/cpp/contours2.cpp
|
||||
* An example using findContours to clean up a background segmentation result at opencv_source_code/samples/cpp/segment_objects.cpp
|
||||
|
||||
* : PYTHON : An example using the findContour functionality can be found at opencv_source/samples/python2/contours.py
|
||||
* : PYTHON : An example of detecting squares in an image can be found at opencv_source/samples/python2/squares.py
|
||||
* (Python) An example using the findContour functionality can be found at opencv_source/samples/python2/contours.py
|
||||
* (Python) An example of detecting squares in an image can be found at opencv_source/samples/python2/squares.py
|
||||
|
||||
|
||||
approxPolyDP
|
||||
@@ -361,9 +361,9 @@ The functions find the convex hull of a 2D point set using the Sklansky's algori
|
||||
that has
|
||||
*O(N logN)* complexity in the current implementation. See the OpenCV sample ``convexhull.cpp`` that demonstrates the usage of different function variants.
|
||||
|
||||
.. Sample code::
|
||||
.. note::
|
||||
|
||||
* : An example using the convexHull functionality can be found at opencv_source_code/samples/cpp/convexhull.cpp
|
||||
* An example using the convexHull functionality can be found at opencv_source_code/samples/cpp/convexhull.cpp
|
||||
|
||||
|
||||
convexityDefects
|
||||
@@ -418,9 +418,9 @@ Fits an ellipse around a set of 2D points.
|
||||
|
||||
The function calculates the ellipse that fits (in a least-squares sense) a set of 2D points best of all. It returns the rotated rectangle in which the ellipse is inscribed. The algorithm [Fitzgibbon95]_ is used.
|
||||
|
||||
.. Sample code::
|
||||
.. note::
|
||||
|
||||
* : An example using the fitEllipse technique can be found at opencv_source_code/samples/cpp/fitellipse.cpp
|
||||
* An example using the fitEllipse technique can be found at opencv_source_code/samples/cpp/fitellipse.cpp
|
||||
|
||||
|
||||
fitLine
|
||||
@@ -495,7 +495,7 @@ http://en.wikipedia.org/wiki/M-estimator
|
||||
|
||||
.. Sample code:
|
||||
|
||||
* : PYTHON : An example of robust line fitting can be found at opencv_source_code/samples/python2/fitline.py
|
||||
* (Python) An example of robust line fitting can be found at opencv_source_code/samples/python2/fitline.py
|
||||
|
||||
|
||||
isContourConvex
|
||||
|
||||
@@ -1136,11 +1136,151 @@ private:
|
||||
Scalar borderValue;
|
||||
};
|
||||
|
||||
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
||||
static bool IPPMorphReplicate(int op, const Mat &src, Mat &dst, const Mat &kernel, const Point &anchor)
|
||||
{
|
||||
int type = src.type();
|
||||
const Mat* _src = &src;
|
||||
Mat temp;
|
||||
if( src.data == dst.data )
|
||||
{
|
||||
src.copyTo(temp);
|
||||
_src = &temp;
|
||||
}
|
||||
//DEPRECATED. Allocates and initializes morphology state structure for erosion or dilation operation.
|
||||
typedef IppStatus (CV_STDCALL* ippiMorphologyInitAllocFunc)(int, const void*, IppiSize, IppiPoint, IppiMorphState **);
|
||||
ippiMorphologyInitAllocFunc ippInitAllocFunc =
|
||||
type == CV_8UC1 ? (ippiMorphologyInitAllocFunc)ippiMorphologyInitAlloc_8u_C1R :
|
||||
type == CV_8UC3 ? (ippiMorphologyInitAllocFunc)ippiMorphologyInitAlloc_8u_C3R :
|
||||
type == CV_8UC4 ? (ippiMorphologyInitAllocFunc)ippiMorphologyInitAlloc_8u_C4R :
|
||||
type == CV_32FC1 ? (ippiMorphologyInitAllocFunc)ippiMorphologyInitAlloc_32f_C1R :
|
||||
type == CV_32FC3 ? (ippiMorphologyInitAllocFunc)ippiMorphologyInitAlloc_32f_C3R :
|
||||
type == CV_32FC4 ? (ippiMorphologyInitAllocFunc)ippiMorphologyInitAlloc_32f_C4R :
|
||||
0;
|
||||
typedef IppStatus (CV_STDCALL* ippiMorphologyBorderReplicateFunc)(const void*, int, void *, int, IppiSize, IppiBorderType, IppiMorphState *);
|
||||
ippiMorphologyBorderReplicateFunc ippFunc = 0;
|
||||
switch( op )
|
||||
{
|
||||
case MORPH_DILATE:
|
||||
{
|
||||
ippFunc =
|
||||
type == CV_8UC1 ? (ippiMorphologyBorderReplicateFunc)ippiDilateBorderReplicate_8u_C1R :
|
||||
type == CV_8UC3 ? (ippiMorphologyBorderReplicateFunc)ippiDilateBorderReplicate_8u_C3R :
|
||||
type == CV_8UC4 ? (ippiMorphologyBorderReplicateFunc)ippiDilateBorderReplicate_8u_C4R :
|
||||
type == CV_32FC1 ? (ippiMorphologyBorderReplicateFunc)ippiDilateBorderReplicate_32f_C1R :
|
||||
type == CV_32FC3 ? (ippiMorphologyBorderReplicateFunc)ippiDilateBorderReplicate_32f_C3R :
|
||||
type == CV_32FC4 ? (ippiMorphologyBorderReplicateFunc)ippiDilateBorderReplicate_32f_C4R :
|
||||
0;
|
||||
break;
|
||||
}
|
||||
case MORPH_ERODE:
|
||||
{
|
||||
ippFunc =
|
||||
type == CV_8UC1 ? (ippiMorphologyBorderReplicateFunc)ippiErodeBorderReplicate_8u_C1R :
|
||||
type == CV_8UC3 ? (ippiMorphologyBorderReplicateFunc)ippiErodeBorderReplicate_8u_C3R :
|
||||
type == CV_8UC4 ? (ippiMorphologyBorderReplicateFunc)ippiErodeBorderReplicate_8u_C4R :
|
||||
type == CV_32FC1 ? (ippiMorphologyBorderReplicateFunc)ippiErodeBorderReplicate_32f_C1R :
|
||||
type == CV_32FC3 ? (ippiMorphologyBorderReplicateFunc)ippiErodeBorderReplicate_32f_C3R :
|
||||
type == CV_32FC4 ? (ippiMorphologyBorderReplicateFunc)ippiErodeBorderReplicate_32f_C4R :
|
||||
0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if( ippFunc && ippInitAllocFunc)
|
||||
{
|
||||
IppiMorphState* pState;
|
||||
IppiSize roiSize = {src.cols, src.rows};
|
||||
IppiSize kernelSize = {kernel.cols, kernel.rows};
|
||||
IppiPoint point = {anchor.x, anchor.y};
|
||||
if( ippInitAllocFunc( roiSize.width, kernel.data, kernelSize, point, &pState ) < 0 )
|
||||
return false;
|
||||
bool is_ok = ippFunc( _src->data, _src->step[0], dst.data, dst.step[0], roiSize, ippBorderRepl, pState ) >= 0;
|
||||
ippiMorphologyFree(pState);
|
||||
return is_ok;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool IPPMorphOp(int op, InputArray _src, OutputArray _dst,
|
||||
InputArray _kernel,
|
||||
const Point &anchor, int iterations,
|
||||
int borderType, const Scalar &borderValue)
|
||||
{
|
||||
Mat src = _src.getMat(), kernel = _kernel.getMat();
|
||||
if( !( src.depth() == CV_8U || src.depth() == CV_32F ) || ( iterations > 1 ) ||
|
||||
!( borderType == cv::BORDER_REPLICATE || (borderType == cv::BORDER_CONSTANT && borderValue == morphologyDefaultBorderValue()) )
|
||||
|| !( op == MORPH_DILATE || op == MORPH_ERODE) )
|
||||
return false;
|
||||
if( borderType == cv::BORDER_CONSTANT )
|
||||
{
|
||||
int x, y;
|
||||
for( y = 0; y < kernel.rows; y++ )
|
||||
{
|
||||
if( kernel.at<uchar>(y, anchor.x) != 0 )
|
||||
continue;
|
||||
for( x = 0; x < kernel.cols; x++ )
|
||||
{
|
||||
if( kernel.at<uchar>(y,x) != 0 )
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for( x = 0; y < kernel.cols; x++ )
|
||||
{
|
||||
if( kernel.at<uchar>(anchor.y, x) != 0 )
|
||||
continue;
|
||||
for( y = 0; y < kernel.rows; y++ )
|
||||
{
|
||||
if( kernel.at<uchar>(y,x) != 0 )
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Size ksize = kernel.data ? kernel.size() : Size(3,3);
|
||||
Point normanchor = normalizeAnchor(anchor, ksize);
|
||||
|
||||
CV_Assert( normanchor.inside(Rect(0, 0, ksize.width, ksize.height)) );
|
||||
|
||||
_dst.create( src.size(), src.type() );
|
||||
Mat dst = _dst.getMat();
|
||||
|
||||
if( iterations == 0 || kernel.rows*kernel.cols == 1 )
|
||||
{
|
||||
src.copyTo(dst);
|
||||
return true;
|
||||
}
|
||||
|
||||
if( !kernel.data )
|
||||
{
|
||||
kernel = getStructuringElement(MORPH_RECT, Size(1+iterations*2,1+iterations*2));
|
||||
normanchor = Point(iterations, iterations);
|
||||
iterations = 1;
|
||||
}
|
||||
else if( iterations > 1 && countNonZero(kernel) == kernel.rows*kernel.cols )
|
||||
{
|
||||
normanchor = Point(normanchor.x*iterations, normanchor.y*iterations);
|
||||
kernel = getStructuringElement(MORPH_RECT,
|
||||
Size(ksize.width + (iterations-1)*(ksize.width-1),
|
||||
ksize.height + (iterations-1)*(ksize.height-1)),
|
||||
normanchor);
|
||||
iterations = 1;
|
||||
}
|
||||
|
||||
return IPPMorphReplicate( op, src, dst, kernel, normanchor );
|
||||
}
|
||||
#endif
|
||||
|
||||
static void morphOp( int op, InputArray _src, OutputArray _dst,
|
||||
InputArray _kernel,
|
||||
Point anchor, int iterations,
|
||||
int borderType, const Scalar& borderValue )
|
||||
{
|
||||
|
||||
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
||||
if( IPPMorphOp(op, _src, _dst, _kernel, anchor, iterations, borderType, borderValue) )
|
||||
return;
|
||||
#endif
|
||||
|
||||
Mat src = _src.getMat(), kernel = _kernel.getMat();
|
||||
Size ksize = kernel.data ? kernel.size() : Size(3,3);
|
||||
anchor = normalizeAnchor(anchor, ksize);
|
||||
|
||||
@@ -267,6 +267,11 @@ static void getRectSubPix_8u32f
|
||||
}
|
||||
}
|
||||
|
||||
typedef CvStatus (CV_STDCALL *CvIPPGetRectSubPixFunc)( const void* src, int src_step,
|
||||
CvSize src_size, void* dst,
|
||||
int dst_step, CvSize win_size,
|
||||
CvPoint2D32f center,
|
||||
CvPoint* minpt, CvPoint* maxpt );
|
||||
|
||||
static void
|
||||
getQuadrangleSubPix_8u32f_CnR( const uchar* src, size_t src_step, Size src_size,
|
||||
@@ -336,12 +341,12 @@ getQuadrangleSubPix_8u32f_CnR( const uchar* src, size_t src_step, Size src_size,
|
||||
float w00 = a1*b1, w01 = a*b1, w10 = a1*b, w11 = a*b;
|
||||
const uchar *ptr0, *ptr1;
|
||||
xs += A11; ys += A21;
|
||||
|
||||
|
||||
if( (unsigned)iys < (unsigned)(src_size.height-1) )
|
||||
ptr0 = src + src_step*iys, ptr1 = ptr0 + src_step;
|
||||
else
|
||||
ptr0 = ptr1 = src + (iys < 0 ? 0 : src_size.height-1)*src_step;
|
||||
|
||||
|
||||
if( (unsigned)ixs < (unsigned)(src_size.width-1) )
|
||||
{
|
||||
ptr0 += ixs*cn; ptr1 += ixs*cn;
|
||||
@@ -374,6 +379,19 @@ void cv::getRectSubPix( InputArray _image, Size patchSize, Point2f center,
|
||||
_patch.create(patchSize, CV_MAKETYPE(ddepth, cn));
|
||||
Mat patch = _patch.getMat();
|
||||
|
||||
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
||||
CvPoint minpt, maxpt;
|
||||
int srctype = CV_MAT_TYPE(src->type), dsttype = CV_MAT_TYPE(dst->type);
|
||||
CvIPPGetRectSubPixFunc ippfunc =
|
||||
srctype == CV_8UC1 && dsttype == CV_8UC1 ? (CvIPPGetRectSubPixFunc)ippiCopySubpixIntersect_8u_C1R :
|
||||
srctype == CV_8UC1 && dsttype == CV_32FC1 ? (CvIPPGetRectSubPixFunc)ippiCopySubpixIntersect_8u32f_C1R :
|
||||
srctype == CV_32FC1 && dsttype == CV_32FC1 ? (CvIPPGetRectSubPixFunc)ippiCopySubpixIntersect_32f_C1R : 0;
|
||||
|
||||
if( ippfunc && ippfunc(src->data.ptr, src->step, src_size, dst->data.ptr,
|
||||
dst->step, dst_size, center, &minpt, &maxpt) >= 0 )
|
||||
return;
|
||||
#endif
|
||||
|
||||
if( depth == CV_8U && ddepth == CV_8U )
|
||||
getRectSubPix_Cn_<uchar, uchar, int, scale_fixpt, cast_8u>
|
||||
(image.data, image.step, image.size(), patch.data, patch.step, patch.size(), center, cn);
|
||||
@@ -438,7 +456,7 @@ cvSampleLine( const void* _img, CvPoint pt1, CvPoint pt2,
|
||||
cv::LineIterator li(img, pt1, pt2, connectivity, false);
|
||||
uchar* buffer = (uchar*)_buffer;
|
||||
size_t pixsize = img.elemSize();
|
||||
|
||||
|
||||
if( !buffer )
|
||||
CV_Error( CV_StsNullPtr, "" );
|
||||
|
||||
|
||||
@@ -856,6 +856,22 @@ void cv::GaussianBlur( InputArray _src, OutputArray _dst, Size ksize,
|
||||
return;
|
||||
#endif
|
||||
|
||||
#if defined HAVE_IPP && (IPP_VERSION_MAJOR >= 7)
|
||||
if(src.type() == CV_32FC1 && sigma1 == sigma2 && ksize.width == ksize.height && sigma1 != 0.0 )
|
||||
{
|
||||
IppiSize roi = {src.cols, src.rows};
|
||||
int bufSize = 0;
|
||||
ippiFilterGaussGetBufferSize_32f_C1R(roi, ksize.width, &bufSize);
|
||||
AutoBuffer<uchar> buf(bufSize+128);
|
||||
if( ippiFilterGaussBorder_32f_C1R((const Ipp32f *)src.data, (int)src.step,
|
||||
(Ipp32f *)dst.data, (int)dst.step,
|
||||
roi, ksize.width, (Ipp32f)sigma1,
|
||||
(IppiBorderType)borderType, 0.0,
|
||||
alignPtr(&buf[0],32)) >= 0 )
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
Ptr<FilterEngine> f = createGaussianFilter( src.type(), ksize, sigma1, sigma2, borderType );
|
||||
f->apply( src, dst );
|
||||
}
|
||||
@@ -1892,6 +1908,29 @@ bilateralFilter_8u( const Mat& src, Mat& dst, int d,
|
||||
radius = MAX(radius, 1);
|
||||
d = radius*2 + 1;
|
||||
|
||||
#if 0 && defined HAVE_IPP && (IPP_VERSION_MAJOR >= 7)
|
||||
if(cn == 1)
|
||||
{
|
||||
IppiSize kernel = {d, d};
|
||||
IppiSize roi={src.cols, src.rows};
|
||||
int bufsize=0;
|
||||
ippiFilterBilateralGetBufSize_8u_C1R( ippiFilterBilateralGauss, roi, kernel, &bufsize);
|
||||
AutoBuffer<uchar> buf(bufsize+128);
|
||||
IppiFilterBilateralSpec *pSpec = (IppiFilterBilateralSpec *)alignPtr(&buf[0], 32);
|
||||
ippiFilterBilateralInit_8u_C1R( ippiFilterBilateralGauss, kernel, sigma_color*sigma_color, sigma_space*sigma_space, 1, pSpec );
|
||||
Mat tsrc;
|
||||
const Mat* psrc = &src;
|
||||
if( src.data == dst.data )
|
||||
{
|
||||
src.copyTo(tsrc);
|
||||
psrc = &tsrc;
|
||||
}
|
||||
if( ippiFilterBilateral_8u_C1R(psrc->data, (int)psrc->step[0],
|
||||
dst.data, (int)dst.step[0],
|
||||
roi, kernel, pSpec) >= 0 )
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
Mat temp;
|
||||
copyMakeBorder( src, temp, radius, radius, radius, radius, borderType );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user