Merge remote-tracking branch 'origin/2.4' into merge-2.4

Conflicts:
	modules/calib3d/doc/camera_calibration_and_3d_reconstruction.rst
	modules/features2d/doc/common_interfaces_of_descriptor_extractors.rst
	modules/features2d/doc/object_categorization.rst
	modules/gpu/doc/camera_calibration_and_3d_reconstruction.rst
	modules/gpu/doc/image_filtering.rst
	modules/gpu/doc/image_processing.rst
	modules/gpu/doc/video.rst
	modules/imgproc/doc/miscellaneous_transformations.rst
	modules/imgproc/doc/object_detection.rst
	modules/imgproc/doc/structural_analysis_and_shape_descriptors.rst
	modules/imgproc/src/samplers.cpp
	modules/ml/doc/k_nearest_neighbors.rst
	modules/nonfree/doc/feature_detection.rst
	modules/ocl/include/opencv2/ocl/ocl.hpp
	modules/photo/doc/inpainting.rst
	modules/ts/include/opencv2/ts.hpp
	platforms/scripts/camera_build.conf
	samples/android/camera-calibration/AndroidManifest.xml
This commit is contained in:
Roman Donchenko
2013-08-13 12:56:39 +04:00
98 changed files with 2216 additions and 371 deletions

View File

@@ -884,9 +884,9 @@ Finally, there are STL-style iterators that are smart enough to skip gaps betwee
The matrix iterators are random-access iterators, so they can be passed to any STL algorithm, including ``std::sort()`` .
.. Sample code::
.. note::
* : An example demonstrating the serial out capabilities of cv::Mat can be found at opencv_source_code/samples/cpp/cout_mat.cpp
* An example demonstrating the serial out capabilities of cv::Mat can be found at opencv_source_code/samples/cpp/cout_mat.cpp
.. _MatrixExpressions:

View File

@@ -64,11 +64,11 @@ Basically, you can use only the core of the function, set the number of
attempts to 1, initialize labels each time using a custom algorithm, pass them with the
( ``flags`` = ``KMEANS_USE_INITIAL_LABELS`` ) flag, and then choose the best (most-compact) clustering.
.. Sample code::
.. note::
* : An example on K-means clustering can be found at opencv_source_code/samples/cpp/kmeans.cpp
* An example on K-means clustering can be found at opencv_source_code/samples/cpp/kmeans.cpp
* : PYTHON : An example on K-means clustering can be found at opencv_source_code/samples/python2/kmeans.py
* (Python) An example on K-means clustering can be found at opencv_source_code/samples/python2/kmeans.py
partition
-------------

View File

@@ -26,9 +26,9 @@ If a drawn figure is partially or completely outside the image, the drawing func
.. note:: The functions do not support alpha-transparency when the target image is 4-channel. In this case, the ``color[3]`` is simply copied to the repainted pixels. Thus, if you want to paint semi-transparent shapes, you can paint them in a separate buffer and then blend it with the main image.
.. Sample code::
.. note::
* : An example on using variate drawing functions like line, rectangle, ... can be found at opencv_source_code/samples/cpp/drawing.cpp
* An example on using variate drawing functions like line, rectangle, ... can be found at opencv_source_code/samples/cpp/drawing.cpp
circle
----------
@@ -559,12 +559,12 @@ The function draws contour outlines in the image if
waitKey(0);
}
.. Sample code::
.. note::
* : An example using the drawContour functionality can be found at opencv_source_code/samples/cpp/contours2.cpp
* : An example using drawContours to clean up a background segmentation result at opencv_source_code/samples/cpp/segment_objects.cpp
* An example using the drawContour functionality can be found at opencv_source_code/samples/cpp/contours2.cpp
* An example using drawContours to clean up a background segmentation result at opencv_source_code/samples/cpp/segment_objects.cpp
* : PYTHON : An example using the drawContour functionality can be found at opencv_source/samples/python2/contours.py
* (Python) An example using the drawContour functionality can be found at opencv_source/samples/python2/contours.py
putText

View File

@@ -971,12 +971,12 @@ All of the above improvements have been implemented in :ocv:func:`matchTemplate`
.. seealso:: :ocv:func:`dct` , :ocv:func:`getOptimalDFTSize` , :ocv:func:`mulSpectrums`, :ocv:func:`filter2D` , :ocv:func:`matchTemplate` , :ocv:func:`flip` , :ocv:func:`cartToPolar` , :ocv:func:`magnitude` , :ocv:func:`phase`
.. Sample code::
.. note::
* : An example using the discrete fourier transform can be found at opencv_source_code/samples/cpp/dft.cpp
* An example using the discrete fourier transform can be found at opencv_source_code/samples/cpp/dft.cpp
* : PYTHON : An example using the dft functionality to perform Wiener deconvolution can be found at opencv_source/samples/python2/deconvolution.py
* : PYTHON : An example rearranging the quadrants of a Fourier image can be found at opencv_source/samples/python2/dft.py
* (Python) An example using the dft functionality to perform Wiener deconvolution can be found at opencv_source/samples/python2/deconvolution.py
* (Python) An example rearranging the quadrants of a Fourier image can be found at opencv_source/samples/python2/dft.py
divide
@@ -2167,9 +2167,9 @@ The sample below is the function that takes two matrices. The first function sto
:ocv:func:`dft`,
:ocv:func:`dct`
.. Sample code::
.. note::
* : An example using PCA for dimensionality reduction while maintaining an amount of variance can be found at opencv_source_code/samples/cpp/pca.cpp
* An example using PCA for dimensionality reduction while maintaining an amount of variance can be found at opencv_source_code/samples/cpp/pca.cpp
PCA::PCA
--------

View File

@@ -91,9 +91,9 @@ Several things can be noted by looking at the sample code and the output:
*
In YAML (but not XML), mappings and sequences can be written in a compact Python-like inline form. In the sample above matrix elements, as well as each feature, including its lbp value, is stored in such inline form. To store a mapping/sequence in a compact form, put ":" after the opening character, e.g. use **"{:"** instead of **"{"** and **"[:"** instead of **"["**. When the data is written to XML, those extra ":" are ignored.
.. Sample code::
.. note::
* : A complete example using the FileStorage interface can be found at opencv_source_code/samples/cpp/filestorage.cpp
* A complete example using the FileStorage interface can be found at opencv_source_code/samples/cpp/filestorage.cpp
Reading data from a file storage.

View File

@@ -33,7 +33,7 @@ PERF_TEST_P(Size_MatType, mean, TYPICAL_MATS)
TEST_CYCLE() s = mean(src);
SANITY_CHECK(s, 1e-6);
SANITY_CHECK(s, 1e-5);
}
PERF_TEST_P(Size_MatType, mean_mask, TYPICAL_MATS)
@@ -49,7 +49,7 @@ PERF_TEST_P(Size_MatType, mean_mask, TYPICAL_MATS)
TEST_CYCLE() s = mean(src, mask);
SANITY_CHECK(s, 1e-6);
SANITY_CHECK(s, 5e-5);
}
PERF_TEST_P(Size_MatType, meanStdDev, TYPICAL_MATS)

View File

@@ -1458,6 +1458,10 @@ static void CCSIDFT_64f( const double* src, double* dst, int n, int nf, int* fac
}
#ifdef HAVE_IPP
typedef IppStatus (CV_STDCALL* IppDFTGetSizeFunc)(int, int, IppHintAlgorithm, int*, int*, int*);
typedef IppStatus (CV_STDCALL* IppDFTInitFunc)(int, int, IppHintAlgorithm, void*, uchar*);
#endif
void cv::dft( InputArray _src0, OutputArray _dst, int flags, int nonzero_rows )
{
@@ -1483,7 +1487,7 @@ void cv::dft( InputArray _src0, OutputArray _dst, int flags, int nonzero_rows )
int factors[34];
bool inplace_transform = false;
#ifdef HAVE_IPP
void *spec_r = 0, *spec_c = 0;
AutoBuffer<uchar> ippbuf;
int ipp_norm_flag = !(flags & DFT_SCALE) ? 8 : inv ? 2 : 1;
#endif
@@ -1543,52 +1547,51 @@ void cv::dft( InputArray _src0, OutputArray _dst, int flags, int nonzero_rows )
spec = 0;
#ifdef HAVE_IPP
if( len*count >= 64 ) // use IPP DFT if available
if(
#if IPP_VERSION_MAJOR >= 7
depth == CV_32F && // IPP 7.x and 8.0 have bug somewhere in double-precision DFT
#endif
len*count >= 64 ) // use IPP DFT if available
{
int ipp_sz = 0;
int specsize=0, initsize=0, worksize=0;
IppDFTGetSizeFunc getSizeFunc = 0;
IppDFTInitFunc initFunc = 0;
if( real_transform && stage == 0 )
{
if( depth == CV_32F )
{
if( spec_r )
IPPI_CALL( ippsDFTFree_R_32f( (IppsDFTSpec_R_32f*)spec_r ));
IPPI_CALL( ippsDFTInitAlloc_R_32f(
(IppsDFTSpec_R_32f**)&spec_r, len, ipp_norm_flag, ippAlgHintNone ));
IPPI_CALL( ippsDFTGetBufSize_R_32f( (IppsDFTSpec_R_32f*)spec_r, &ipp_sz ));
getSizeFunc = ippsDFTGetSize_R_32f;
initFunc = (IppDFTInitFunc)ippsDFTInit_R_32f;
}
else
{
if( spec_r )
IPPI_CALL( ippsDFTFree_R_64f( (IppsDFTSpec_R_64f*)spec_r ));
IPPI_CALL( ippsDFTInitAlloc_R_64f(
(IppsDFTSpec_R_64f**)&spec_r, len, ipp_norm_flag, ippAlgHintNone ));
IPPI_CALL( ippsDFTGetBufSize_R_64f( (IppsDFTSpec_R_64f*)spec_r, &ipp_sz ));
getSizeFunc = ippsDFTGetSize_R_64f;
initFunc = (IppDFTInitFunc)ippsDFTInit_R_64f;
}
spec = spec_r;
}
else
{
if( depth == CV_32F )
{
if( spec_c )
IPPI_CALL( ippsDFTFree_C_32fc( (IppsDFTSpec_C_32fc*)spec_c ));
IPPI_CALL( ippsDFTInitAlloc_C_32fc(
(IppsDFTSpec_C_32fc**)&spec_c, len, ipp_norm_flag, ippAlgHintNone ));
IPPI_CALL( ippsDFTGetBufSize_C_32fc( (IppsDFTSpec_C_32fc*)spec_c, &ipp_sz ));
getSizeFunc = ippsDFTGetSize_C_32fc;
initFunc = (IppDFTInitFunc)ippsDFTInit_C_32fc;
}
else
{
if( spec_c )
IPPI_CALL( ippsDFTFree_C_64fc( (IppsDFTSpec_C_64fc*)spec_c ));
IPPI_CALL( ippsDFTInitAlloc_C_64fc(
(IppsDFTSpec_C_64fc**)&spec_c, len, ipp_norm_flag, ippAlgHintNone ));
IPPI_CALL( ippsDFTGetBufSize_C_64fc( (IppsDFTSpec_C_64fc*)spec_c, &ipp_sz ));
getSizeFunc = ippsDFTGetSize_C_64fc;
initFunc = (IppDFTInitFunc)ippsDFTInit_C_64fc;
}
spec = spec_c;
}
sz += ipp_sz;
if( getSizeFunc(len, ipp_norm_flag, ippAlgHintNone, &specsize, &initsize, &worksize) >= 0 )
{
ippbuf.allocate(specsize + initsize + 64);
spec = alignPtr(&ippbuf[0], 32);
uchar* initbuf = alignPtr((uchar*)spec + specsize, 32);
if( initFunc(len, ipp_norm_flag, ippAlgHintNone, spec, initbuf) < 0 )
spec = 0;
sz += worksize;
}
}
else
#endif
@@ -1862,24 +1865,6 @@ void cv::dft( InputArray _src0, OutputArray _dst, int flags, int nonzero_rows )
src = dst;
}
}
#ifdef HAVE_IPP
if( spec_c )
{
if( depth == CV_32F )
ippsDFTFree_C_32fc( (IppsDFTSpec_C_32fc*)spec_c );
else
ippsDFTFree_C_64fc( (IppsDFTSpec_C_64fc*)spec_c );
}
if( spec_r )
{
if( depth == CV_32F )
ippsDFTFree_R_32f( (IppsDFTSpec_R_32f*)spec_r );
else
ippsDFTFree_R_64f( (IppsDFTSpec_R_64f*)spec_r );
}
#endif
}

View File

@@ -440,6 +440,45 @@ cv::Scalar cv::sum( InputArray _src )
{
Mat src = _src.getMat();
int k, cn = src.channels(), depth = src.depth();
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
size_t total_size = src.total();
int rows = src.size[0], cols = (int)(total_size/rows);
if( src.dims == 2 || (src.isContinuous() && cols > 0 && (size_t)rows*cols == total_size) )
{
IppiSize sz = { cols, rows };
int type = src.type();
typedef IppStatus (CV_STDCALL* ippiSumFunc)(const void*, int, IppiSize, double *, int);
ippiSumFunc ippFunc =
type == CV_8UC1 ? (ippiSumFunc)ippiSum_8u_C1R :
type == CV_8UC3 ? (ippiSumFunc)ippiSum_8u_C3R :
type == CV_8UC4 ? (ippiSumFunc)ippiSum_8u_C4R :
type == CV_16UC1 ? (ippiSumFunc)ippiSum_16u_C1R :
type == CV_16UC3 ? (ippiSumFunc)ippiSum_16u_C3R :
type == CV_16UC4 ? (ippiSumFunc)ippiSum_16u_C4R :
type == CV_16SC1 ? (ippiSumFunc)ippiSum_16s_C1R :
type == CV_16SC3 ? (ippiSumFunc)ippiSum_16s_C3R :
type == CV_16SC4 ? (ippiSumFunc)ippiSum_16s_C4R :
type == CV_32FC1 ? (ippiSumFunc)ippiSum_32f_C1R :
type == CV_32FC3 ? (ippiSumFunc)ippiSum_32f_C3R :
type == CV_32FC4 ? (ippiSumFunc)ippiSum_32f_C4R :
0;
if( ippFunc )
{
Ipp64f res[4];
if( ippFunc(src.data, src.step[0], sz, res, ippAlgHintAccurate) >= 0 )
{
Scalar sc;
for( int i = 0; i < cn; i++ )
{
sc[i] = res[i];
}
return sc;
}
}
}
#endif
SumFunc func = sumTab[depth];
CV_Assert( cn <= 4 && func != 0 );
@@ -513,6 +552,81 @@ cv::Scalar cv::mean( InputArray _src, InputArray _mask )
CV_Assert( mask.empty() || mask.type() == CV_8U );
int k, cn = src.channels(), depth = src.depth();
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
size_t total_size = src.total();
int rows = src.size[0], cols = (int)(total_size/rows);
if( src.dims == 2 || (src.isContinuous() && mask.isContinuous() && cols > 0 && (size_t)rows*cols == total_size) )
{
IppiSize sz = { cols, rows };
int type = src.type();
if( !mask.empty() )
{
typedef IppStatus (CV_STDCALL* ippiMaskMeanFuncC1)(const void *, int, void *, int, IppiSize, Ipp64f *);
ippiMaskMeanFuncC1 ippFuncC1 =
type == CV_8UC1 ? (ippiMaskMeanFuncC1)ippiMean_8u_C1MR :
type == CV_16UC1 ? (ippiMaskMeanFuncC1)ippiMean_16u_C1MR :
type == CV_32FC1 ? (ippiMaskMeanFuncC1)ippiMean_32f_C1MR :
0;
if( ippFuncC1 )
{
Ipp64f res;
if( ippFuncC1(src.data, src.step[0], mask.data, mask.step[0], sz, &res) >= 0 )
{
return Scalar(res);
}
}
typedef IppStatus (CV_STDCALL* ippiMaskMeanFuncC3)(const void *, int, void *, int, IppiSize, int, Ipp64f *);
ippiMaskMeanFuncC3 ippFuncC3 =
type == CV_8UC3 ? (ippiMaskMeanFuncC3)ippiMean_8u_C3CMR :
type == CV_16UC3 ? (ippiMaskMeanFuncC3)ippiMean_16u_C3CMR :
type == CV_32FC3 ? (ippiMaskMeanFuncC3)ippiMean_32f_C3CMR :
0;
if( ippFuncC3 )
{
Ipp64f res1, res2, res3;
if( ippFuncC3(src.data, src.step[0], mask.data, mask.step[0], sz, 1, &res1) >= 0 &&
ippFuncC3(src.data, src.step[0], mask.data, mask.step[0], sz, 2, &res2) >= 0 &&
ippFuncC3(src.data, src.step[0], mask.data, mask.step[0], sz, 3, &res3) >= 0 )
{
return Scalar(res1, res2, res3);
}
}
}
else
{
typedef IppStatus (CV_STDCALL* ippiMeanFunc)(const void*, int, IppiSize, double *, int);
ippiMeanFunc ippFunc =
type == CV_8UC1 ? (ippiMeanFunc)ippiMean_8u_C1R :
type == CV_8UC3 ? (ippiMeanFunc)ippiMean_8u_C3R :
type == CV_8UC4 ? (ippiMeanFunc)ippiMean_8u_C4R :
type == CV_16UC1 ? (ippiMeanFunc)ippiMean_16u_C1R :
type == CV_16UC3 ? (ippiMeanFunc)ippiMean_16u_C3R :
type == CV_16UC4 ? (ippiMeanFunc)ippiMean_16u_C4R :
type == CV_16SC1 ? (ippiMeanFunc)ippiMean_16s_C1R :
type == CV_16SC3 ? (ippiMeanFunc)ippiMean_16s_C3R :
type == CV_16SC4 ? (ippiMeanFunc)ippiMean_16s_C4R :
type == CV_32FC1 ? (ippiMeanFunc)ippiMean_32f_C1R :
type == CV_32FC3 ? (ippiMeanFunc)ippiMean_32f_C3R :
type == CV_32FC4 ? (ippiMeanFunc)ippiMean_32f_C4R :
0;
if( ippFunc )
{
Ipp64f res[4];
if( ippFunc(src.data, src.step[0], sz, res, ippAlgHintAccurate) >= 0 )
{
Scalar sc;
for( int i = 0; i < cn; i++ )
{
sc[i] = res[i];
}
return sc;
}
}
}
}
#endif
SumFunc func = sumTab[depth];
CV_Assert( cn <= 4 && func != 0 );

View File

@@ -1123,7 +1123,7 @@ struct MeanOp : public BaseElemWiseOp
}
double getMaxErr(int)
{
return 1e-6;
return 1e-5;
}
};