From b28677bd90cbb7679ae97dc0d05e89675bbf67aa Mon Sep 17 00:00:00 2001 From: Vladislav Vinogradov Date: Mon, 1 Apr 2013 11:16:47 +0400 Subject: [PATCH 01/11] fixed misprint in MatOp::augAssignXor --- modules/core/src/matop.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/core/src/matop.cpp b/modules/core/src/matop.cpp index 736984e85..5c518146c 100644 --- a/modules/core/src/matop.cpp +++ b/modules/core/src/matop.cpp @@ -319,7 +319,7 @@ void MatOp::augAssignXor(const MatExpr& expr, Mat& m) const { Mat temp; expr.op->assign(expr, temp); - m /= temp; + m ^= temp; } From 10774ff068e701eb1ee378d9a1171c2b0e8e4d6a Mon Sep 17 00:00:00 2001 From: Vladislav Vinogradov Date: Mon, 1 Apr 2013 11:18:30 +0400 Subject: [PATCH 02/11] removed unnecessary tmp variable (convertTo can work in-place) --- modules/calib3d/test/test_stereomatching.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/calib3d/test/test_stereomatching.cpp b/modules/calib3d/test/test_stereomatching.cpp index 4b35dad99..2be50a017 100644 --- a/modules/calib3d/test/test_stereomatching.cpp +++ b/modules/calib3d/test/test_stereomatching.cpp @@ -459,14 +459,14 @@ void CV_StereoMatchingTest::run(int) continue; } int dispScaleFactor = datasetsParams[datasetName].dispScaleFactor; - Mat tmp; trueLeftDisp.convertTo( tmp, CV_32FC1, 1.f/dispScaleFactor ); trueLeftDisp = tmp; tmp.release(); + trueLeftDisp.convertTo( trueLeftDisp, CV_32FC1, 1.f/dispScaleFactor ); if( !trueRightDisp.empty() ) - trueRightDisp.convertTo( tmp, CV_32FC1, 1.f/dispScaleFactor ); trueRightDisp = tmp; tmp.release(); + trueRightDisp.convertTo( trueRightDisp, CV_32FC1, 1.f/dispScaleFactor ); Mat leftDisp, rightDisp; int ignBorder = max(runStereoMatchingAlgorithm(leftImg, rightImg, leftDisp, rightDisp, ci), EVAL_IGNORE_BORDER); - leftDisp.convertTo( tmp, CV_32FC1 ); leftDisp = tmp; tmp.release(); - rightDisp.convertTo( tmp, CV_32FC1 ); rightDisp = tmp; tmp.release(); + leftDisp.convertTo( leftDisp, CV_32FC1 ); + rightDisp.convertTo( rightDisp, CV_32FC1 ); int tempCode = processStereoMatchingResults( resFS, ci, isWrite, leftImg, rightImg, trueLeftDisp, trueRightDisp, leftDisp, rightDisp, QualityEvalParams(ignBorder)); From ae47b8f06c9d9a7fe607b4c7ba34d15d52582c5c Mon Sep 17 00:00:00 2001 From: Vladislav Vinogradov Date: Mon, 1 Apr 2013 11:23:27 +0400 Subject: [PATCH 03/11] fixed misprint in icvCreateIsometricImage --- modules/legacy/src/epilines.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/legacy/src/epilines.cpp b/modules/legacy/src/epilines.cpp index 309ca0b1d..7d952111d 100644 --- a/modules/legacy/src/epilines.cpp +++ b/modules/legacy/src/epilines.cpp @@ -2115,7 +2115,7 @@ CV_IMPL IplImage* icvCreateIsometricImage( IplImage* src, IplImage* dst, if( !dst || dst->depth != desired_depth || dst->nChannels != desired_num_channels || dst_size.width != src_size.width || - dst_size.height != dst_size.height ) + dst_size.height != src_size.height ) { cvReleaseImage( &dst ); dst = cvCreateImage( src_size, desired_depth, desired_num_channels ); From 5a4fa4607b417bd152f168eaa425da60600f4d3c Mon Sep 17 00:00:00 2001 From: Vladislav Vinogradov Date: Mon, 1 Apr 2013 11:26:49 +0400 Subject: [PATCH 04/11] fixed misprint in imgwarp.cpp --- modules/imgproc/src/imgwarp.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/imgproc/src/imgwarp.cpp b/modules/imgproc/src/imgwarp.cpp index c2506590d..2fe80616a 100644 --- a/modules/imgproc/src/imgwarp.cpp +++ b/modules/imgproc/src/imgwarp.cpp @@ -3669,7 +3669,7 @@ cv2DRotationMatrix( CvPoint2D32f center, double angle, double scale, CvMat* matrix ) { cv::Mat M0 = cv::cvarrToMat(matrix), M = cv::getRotationMatrix2D(center, angle, scale); - CV_Assert( M.size() == M.size() ); + CV_Assert( M.size() == M0.size() ); M.convertTo(M0, M0.type()); return matrix; } @@ -3682,7 +3682,7 @@ cvGetPerspectiveTransform( const CvPoint2D32f* src, { cv::Mat M0 = cv::cvarrToMat(matrix), M = cv::getPerspectiveTransform((const cv::Point2f*)src, (const cv::Point2f*)dst); - CV_Assert( M.size() == M.size() ); + CV_Assert( M.size() == M0.size() ); M.convertTo(M0, M0.type()); return matrix; } From ce2284e2e6e624c1fea54c2470deab90fc35511d Mon Sep 17 00:00:00 2001 From: Vladislav Vinogradov Date: Mon, 1 Apr 2013 11:29:13 +0400 Subject: [PATCH 05/11] removed duplication --- modules/core/include/opencv2/core/mat.hpp | 2 +- modules/core/src/matrix.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/core/include/opencv2/core/mat.hpp b/modules/core/include/opencv2/core/mat.hpp index 92301cf3b..c19caf902 100644 --- a/modules/core/include/opencv2/core/mat.hpp +++ b/modules/core/include/opencv2/core/mat.hpp @@ -431,7 +431,7 @@ template inline _Tp* Mat::ptr(int y) template inline const _Tp* Mat::ptr(int y) const { - CV_DbgAssert( y == 0 || (data && dims >= 1 && data && (unsigned)y < (unsigned)size.p[0]) ); + CV_DbgAssert( y == 0 || (data && dims >= 1 && (unsigned)y < (unsigned)size.p[0]) ); return (const _Tp*)(data + step.p[0]*y); } diff --git a/modules/core/src/matrix.cpp b/modules/core/src/matrix.cpp index 11a4b0266..7560c2e59 100644 --- a/modules/core/src/matrix.cpp +++ b/modules/core/src/matrix.cpp @@ -184,7 +184,7 @@ static void finalizeHdr(Mat& m) void Mat::create(int d, const int* _sizes, int _type) { int i; - CV_Assert(0 <= d && _sizes && d <= CV_MAX_DIM && _sizes); + CV_Assert(0 <= d && d <= CV_MAX_DIM && _sizes); _type = CV_MAT_TYPE(_type); if( data && (d == dims || (d == 1 && dims <= 2)) && _type == type() ) From d2b093d809bb170020ac7f1f88f95999ce9c2948 Mon Sep 17 00:00:00 2001 From: Vladislav Vinogradov Date: Mon, 1 Apr 2013 11:31:56 +0400 Subject: [PATCH 06/11] fixed potential dereference of null pointer --- modules/legacy/src/blobtrackingauto.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/legacy/src/blobtrackingauto.cpp b/modules/legacy/src/blobtrackingauto.cpp index fab0503bd..59e0ee60f 100644 --- a/modules/legacy/src/blobtrackingauto.cpp +++ b/modules/legacy/src/blobtrackingauto.cpp @@ -429,10 +429,11 @@ void CvBlobTrackerAuto1::Process(IplImage* pImg, IplImage* pMask) for(i=0; iID = m_NextBlobID; if(pBN && pBN->w >= CV_BLOB_MINW && pBN->h >= CV_BLOB_MINH) { + pBN->ID = m_NextBlobID; + CvBlob* pB = m_pBT->AddBlob(pBN, pImg, pmask ); if(pB) { From 3c86788b1f424acd30bf0ea491b23408d9d07bb7 Mon Sep 17 00:00:00 2001 From: Vladislav Vinogradov Date: Mon, 1 Apr 2013 11:35:33 +0400 Subject: [PATCH 07/11] fixed incorrect sizeof() expression in CvCaptureCAM_VFW::open --- modules/highgui/src/cap_vfw.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/highgui/src/cap_vfw.cpp b/modules/highgui/src/cap_vfw.cpp index 4e6ff5e13..d419a4891 100644 --- a/modules/highgui/src/cap_vfw.cpp +++ b/modules/highgui/src/cap_vfw.cpp @@ -406,7 +406,7 @@ bool CvCaptureCAM_VFW::open( int wIndex ) fourcc = (DWORD)-1; memset( &caps, 0, sizeof(caps)); - capDriverGetCaps( hWndC, &caps, sizeof(&caps)); + capDriverGetCaps( hWndC, &caps, sizeof(caps)); ::MoveWindow( hWndC, 0, 0, 320, 240, TRUE ); capSetUserData( hWndC, (size_t)this ); capSetCallbackOnFrame( hWndC, frameCallback ); From 43f38df1d26ad91c912145d6d2169f7108120e88 Mon Sep 17 00:00:00 2001 From: Vladislav Vinogradov Date: Mon, 1 Apr 2013 11:37:48 +0400 Subject: [PATCH 08/11] fixed incorrect sizeof() expression in CvCalibFilter::SetCameraCount --- modules/legacy/src/calibfilter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/legacy/src/calibfilter.cpp b/modules/legacy/src/calibfilter.cpp index f1a4d7cd2..99cc04ce8 100644 --- a/modules/legacy/src/calibfilter.cpp +++ b/modules/legacy/src/calibfilter.cpp @@ -235,7 +235,7 @@ void CvCalibFilter::SetCameraCount( int count ) cvReleaseMat( &rectMap[i][1] ); } - memset( latestCounts, 0, sizeof(latestPoints) ); + memset( latestCounts, 0, sizeof(latestCounts) ); maxPoints = 0; cameraCount = count; } From d27d091e59c1a9143dd01caf3f7c644807610c0b Mon Sep 17 00:00:00 2001 From: Vladislav Vinogradov Date: Mon, 1 Apr 2013 11:53:05 +0400 Subject: [PATCH 09/11] fixed mind/maxd search in CvFuzzyMeanShiftTracker::SearchWindow::initDepthValues --- modules/contrib/src/fuzzymeanshifttracker.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/contrib/src/fuzzymeanshifttracker.cpp b/modules/contrib/src/fuzzymeanshifttracker.cpp index 443b961ed..c83f915b0 100644 --- a/modules/contrib/src/fuzzymeanshifttracker.cpp +++ b/modules/contrib/src/fuzzymeanshifttracker.cpp @@ -380,6 +380,7 @@ void CvFuzzyMeanShiftTracker::SearchWindow::initDepthValues(IplImage *maskImage, { if (*depthData) { + d = *depthData; m1 += d; if (d < mind) mind = d; From 3d095ccc825b305d08e77284c2d4eae6e3dc202a Mon Sep 17 00:00:00 2001 From: Vladislav Vinogradov Date: Mon, 1 Apr 2013 11:53:43 +0400 Subject: [PATCH 10/11] fixed condition in KeyPointsFilter::retainBest --- modules/features2d/src/keypoint.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/features2d/src/keypoint.cpp b/modules/features2d/src/keypoint.cpp index 9b85fd39c..b19cfbfd3 100644 --- a/modules/features2d/src/keypoint.cpp +++ b/modules/features2d/src/keypoint.cpp @@ -192,7 +192,7 @@ struct KeypointResponseGreater void KeyPointsFilter::retainBest(vector& keypoints, int n_points) { //this is only necessary if the keypoints size is greater than the number of desired points. - if( n_points > 0 && keypoints.size() > (size_t)n_points ) + if( n_points >= 0 && keypoints.size() > (size_t)n_points ) { if (n_points==0) { From b62cf65b917e43db154dd6b0377b1a5deced2890 Mon Sep 17 00:00:00 2001 From: Vladislav Vinogradov Date: Mon, 1 Apr 2013 11:55:02 +0400 Subject: [PATCH 11/11] fixed inconsistent new/delete operators --- modules/objdetect/src/hog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/objdetect/src/hog.cpp b/modules/objdetect/src/hog.cpp index f1a32c434..1eab434f6 100644 --- a/modules/objdetect/src/hog.cpp +++ b/modules/objdetect/src/hog.cpp @@ -2627,7 +2627,7 @@ void HOGDescriptor::readALTModel(std::string modelfile) detector.push_back((float)-linearbias); setSVMDetector(detector); - delete linearwt; + delete [] linearwt; } else { throw Exception(); }