merged 2.4 into trunk

This commit is contained in:
Vadim Pisarevsky
2012-04-30 14:33:52 +00:00
parent 3f1c6d7357
commit d5a0088bbe
194 changed files with 10158 additions and 8225 deletions

View File

@@ -2,10 +2,8 @@ Geometric Image Transformations
===============================
.. highlight:: cpp
The functions in this section perform various geometrical transformations of 2D images. They do not change the image content but deform the pixel grid and map this deformed grid to the destination image. In fact, to avoid sampling artifacts, the mapping is done in the reverse order, from destination to the source. That is, for each pixel
:math:`(x, y)` of the destination image, the functions compute coordinates of the corresponding "donor" pixel in the source image and copy the pixel value:
The functions in this section perform various geometrical transformations of 2D images. They do not change the image content but deform the pixel grid and map this deformed grid to the destination image. In fact, to avoid sampling artifacts, the mapping is done in the reverse order, from destination to the source. That is, for each pixel :math:`(x, y)` of the destination image, the functions compute coordinates of the corresponding "donor" pixel in the source image and copy the pixel value:
.. math::
\texttt{dst} (x,y)= \texttt{src} (f_x(x,y), f_y(x,y))

View File

@@ -12,7 +12,6 @@ imgproc. Image Processing
miscellaneous_transformations
histograms
structural_analysis_and_shape_descriptors
planar_subdivisions
motion_analysis_and_object_tracking
feature_detection
object_detection

View File

@@ -632,7 +632,7 @@ Compares two shapes.
:param object2: Second contour or grayscale image.
:param method: Comparison method: ``CV_CONTOUR_MATCH_I1`` , \ ``CV_CONTOURS_MATCH_I2`` \
:param method: Comparison method: ``CV_CONTOURS_MATCH_I1`` , \ ``CV_CONTOURS_MATCH_I2`` \
or ``CV_CONTOURS_MATCH_I3`` (see the details below).
:param parameter: Method-specific parameter (not supported now).
@@ -641,23 +641,23 @@ The function compares two shapes. All three implemented methods use the Hu invar
:ocv:func:`HuMoments` ) as follows (
:math:`A` denotes ``object1``,:math:`B` denotes ``object2`` ):
* method=CV\_CONTOUR\_MATCH\_I1
* method=CV_CONTOURS_MATCH_I1
.. math::
I_1(A,B) = \sum _{i=1...7} \left | \frac{1}{m^A_i} - \frac{1}{m^B_i} \right |
* method=CV\_CONTOUR\_MATCH\_I2
* method=CV_CONTOURS_MATCH_I2
.. math::
I_2(A,B) = \sum _{i=1...7} \left | m^A_i - m^B_i \right |
* method=CV\_CONTOUR\_MATCH\_I3
* method=CV_CONTOURS_MATCH_I3
.. math::
I_3(A,B) = \sum _{i=1...7} \frac{ \left| m^A_i - m^B_i \right| }{ \left| m^A_i \right| }
I_3(A,B) = \max _{i=1...7} \frac{ \left| m^A_i - m^B_i \right| }{ \left| m^A_i \right| }
where

View File

@@ -597,6 +597,9 @@ CV_EXPORTS_W void accumulateProduct( InputArray src1, InputArray src2,
CV_EXPORTS_W void accumulateWeighted( InputArray src, InputOutputArray dst,
double alpha, InputArray mask=noArray() );
//! computes PSNR image/video quality metric
CV_EXPORTS_W double PSNR(InputArray src1, InputArray src2);
CV_EXPORTS_W Point2d phaseCorrelate(InputArray src1, InputArray src2, InputArray window = noArray());
CV_EXPORTS_W void createHanningWindow(OutputArray dst, Size winSize, int type);

View File

@@ -89,7 +89,7 @@ PERF_TEST_P(Size_MatType_BorderType3x3, blur3x3,
TEST_CYCLE() blur(src, dst, Size(3,3), Point(-1,-1), btype);
SANITY_CHECK(dst);
SANITY_CHECK(dst, 1e-3);
}
PERF_TEST_P(Size_MatType_BorderType, gaussianBlur5x5,
@@ -133,5 +133,5 @@ PERF_TEST_P(Size_MatType_BorderType, blur5x5,
TEST_CYCLE() blur(src, dst, Size(5,5), Point(-1,-1), btype);
SANITY_CHECK(dst);
SANITY_CHECK(dst, 1e-3);
}

View File

@@ -33,5 +33,5 @@ PERF_TEST_P(Img_BlockSize_ApertureSize_BorderType, cornerEigenValsAndVecs,
TEST_CYCLE() cornerEigenValsAndVecs(src, dst, blockSize, apertureSize, borderType);
SANITY_CHECK(dst);
SANITY_CHECK(dst, 2e-5);
}

View File

@@ -78,5 +78,5 @@ PERF_TEST_P( Size_MatType_OutMatDepth, integral_sqsum_tilted,
SANITY_CHECK(sum, 1e-6);
SANITY_CHECK(sqsum, 1e-6);
SANITY_CHECK(tilted, 1e-6);
SANITY_CHECK(tilted, 1e-6, tilted.depth() > CV_32S ? ERROR_RELATIVE : ERROR_ABSOLUTE);
}

View File

@@ -1965,12 +1965,14 @@ void cv::convexHull( InputArray _points, OutputArray _hull, bool clockwise, bool
void cv::convexityDefects( InputArray _points, InputArray _hull, OutputArray _defects )
{
Mat points = _points.getMat();
CV_Assert( points.isContinuous() && points.type() == CV_32SC2 );
int ptnum = points.checkVector(2, CV_32S);
CV_Assert( ptnum > 3 );
Mat hull = _hull.getMat();
CV_Assert( hull.checkVector(1, CV_32S) > 2 );
Ptr<CvMemStorage> storage = cvCreateMemStorage();
CvMat c_points = points, c_hull = hull;
CvSeq* seq = cvConvexityDefects(&c_points, &c_hull);
CvSeq* seq = cvConvexityDefects(&c_points, &c_hull, storage);
int i, n = seq->total;
if( n == 0 )
@@ -1991,9 +1993,9 @@ void cv::convexityDefects( InputArray _points, InputArray _hull, OutputArray _de
int idx0 = (int)(d.start - ptorg);
int idx1 = (int)(d.end - ptorg);
int idx2 = (int)(d.depth_point - ptorg);
CV_Assert( 0 <= idx0 && idx0 < n );
CV_Assert( 0 <= idx1 && idx1 < n );
CV_Assert( 0 <= idx2 && idx2 < n );
CV_Assert( 0 <= idx0 && idx0 < ptnum );
CV_Assert( 0 <= idx1 && idx1 < ptnum );
CV_Assert( 0 <= idx2 && idx2 < ptnum );
CV_Assert( d.depth >= 0 );
int idepth = cvRound(d.depth*256);
defects.at<Vec4i>(i) = Vec4i(idx0, idx1, idx2, idepth);

View File

@@ -312,9 +312,7 @@ void cv::boxFilter( InputArray _src, OutputArray _dst, int ddepth,
ksize.width = 1;
}
#ifdef HAVE_TEGRA_OPTIMIZATION
if(tegra::box(src, dst, ksize, borderType))
return;
if ( tegra::boxFilter(src, dst, ksize, anchor, normalize, borderType) )
if ( tegra::box(src, dst, ksize, anchor, normalize, borderType) )
return;
#endif
@@ -1441,6 +1439,7 @@ bilateralFilter_32f( const Mat& src, Mat& dst, int d,
// temporary copy of the image with borders for easy processing
Mat temp;
copyMakeBorder( src, temp, radius, radius, radius, radius, borderType );
patchNaNs(temp);
// allocate lookup tables
vector<float> _space_weight(d*d);

View File

@@ -245,6 +245,15 @@ void cv::copyMakeBorder( InputArray _src, OutputArray _dst, int top, int bottom,
}
double cv::PSNR(InputArray _src1, InputArray _src2)
{
Mat src1 = _src1.getMat(), src2 = _src2.getMat();
CV_Assert( src1.depth() == CV_8U );
double diff = std::sqrt(norm(src1, src2, NORM_L2SQR)/(src1.total()*src1.channels()));
return 20*log10(255./(diff+DBL_EPSILON));
}
CV_IMPL void
cvCopyMakeBorder( const CvArr* srcarr, CvArr* dstarr, CvPoint offset,
int borderType, CvScalar value )