From: Anatoly Baksheev Date: Sat, 11 Jun 2011 17:24:09 +0000 (+0000) Subject: ~40 warnings under VS2008 X-Git-Tag: accepted/2.0/20130307.220821~2819 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8f4c7db3f67d12cd9101c6c9b4359f667c054cf6;p=profile%2Fivi%2Fopencv.git ~40 warnings under VS2008 HAVE_CONFIG_H -> HAVE_CVCONFIG_H --- diff --git a/3rdparty/libpng/pngconf.h b/3rdparty/libpng/pngconf.h index 0c1065c..6bbf318 100644 --- a/3rdparty/libpng/pngconf.h +++ b/3rdparty/libpng/pngconf.h @@ -32,7 +32,7 @@ * script. */ #ifdef PNG_CONFIGURE_LIBPNG -# ifdef HAVE_CONFIG_H +# ifdef HAVE_CVCONFIG_H # include "config.h" # endif #endif diff --git a/CMakeLists.txt b/CMakeLists.txt index 8466b06..0f07bb1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -683,7 +683,7 @@ if (WITH_TBB) endif() if (NOT HAVE_TBB) - set(TBB_DEFAULT_INCLUDE_DIRS "/opt/intel/tbb" "/usr/local/include" "/usr/include" "C:/Program Files/Intel/TBB" "C:/Program Files (x86)/Intel/TBB") + set(TBB_DEFAULT_INCLUDE_DIRS "/opt/intel/tbb" "/usr/local/include" "/usr/include" "C:/Program Files/Intel/TBB" "C:/Program Files (x86)/Intel/TBB" "C:/Program Files (x86)/TBB") find_path(TBB_INCLUDE_DIR "tbb/tbb.h" PATHS ${TBB_DEFAULT_INCLUDE_DIRS} DOC "The path to TBB headers") if (TBB_INCLUDE_DIR) @@ -913,7 +913,7 @@ set(BUILD_DOCS ON CACHE BOOL "Build OpenCV Reference Manual") # A directory will be created for each platform so the "cvconfig.h" file is # not overwritten if cmake generates code in the same path. # ---------------------------------------------------------------------------- -add_definitions(-DHAVE_CONFIG_H) +add_definitions(-DHAVE_CVCONFIG_H) set(OPENCV_CONFIG_FILE_INCLUDE_DIR "${CMAKE_BINARY_DIR}/" CACHE PATH "Where to create the platform-dependant cvconfig.h") diff --git a/modules/calib3d/src/calibinit.cpp b/modules/calib3d/src/calibinit.cpp index 1eb08a0..04392a2 100644 --- a/modules/calib3d/src/calibinit.cpp +++ b/modules/calib3d/src/calibinit.cpp @@ -1914,9 +1914,9 @@ bool cv::findChessboardCorners( InputArray _image, Size patternSize, namespace { -int quiet_error(int status, const char* func_name, - const char* err_msg, const char* file_name, - int line, void* userdata ) +int quiet_error(int /*status*/, const char* /*func_name*/, + const char* /*err_msg*/, const char* /*file_name*/, + int /*line*/, void* /*userdata*/ ) { return 0; } diff --git a/modules/calib3d/src/precomp.hpp b/modules/calib3d/src/precomp.hpp index 07e769c..2de1e3a 100644 --- a/modules/calib3d/src/precomp.hpp +++ b/modules/calib3d/src/precomp.hpp @@ -46,7 +46,7 @@ #pragma warning( disable: 4251 4710 4711 4514 4996 ) #endif -#ifdef HAVE_CONFIG_H +#ifdef HAVE_CVCONFIG_H #include "cvconfig.h" #endif diff --git a/modules/contrib/src/ba.cpp b/modules/contrib/src/ba.cpp index 69a03eb..0f4cf56 100644 --- a/modules/contrib/src/ba.cpp +++ b/modules/contrib/src/ba.cpp @@ -344,60 +344,65 @@ void LevMarqSparse::run( int num_points_, //number of points errNorm = cvNorm( err, 0, CV_L2 ); } -void LevMarqSparse::ask_for_proj(CvMat &_vis,bool once) { - //given parameter P, compute measurement hX - int ind = 0; - for (int i = 0; i < num_points; i++ ) { - CvMat point_mat; - cvGetSubRect( P, &point_mat, cvRect( 0, num_cams * num_cam_param + num_point_param * i, 1, num_point_param )); - for (int j = 0; j < num_cams; j++ ) { - //CvMat* Aij = ((CvMat**)(A->data.ptr + A->step * i))[j]; - CvMat* Aij = A[j+i*num_cams]; - if (Aij ) { //visible - CvMat cam_mat; - cvGetSubRect( P, &cam_mat, cvRect( 0, j * num_cam_param, 1, num_cam_param )); - CvMat measur_mat; - cvGetSubRect( hX, &measur_mat, cvRect( 0, ind * num_err_param, 1, num_err_param )); - Mat _point_mat(&point_mat), _cam_mat(&cam_mat), _measur_mat(&measur_mat); - func( i, j, _point_mat, _cam_mat, _measur_mat, data); - assert( ind*num_err_param == ((int*)(Vis_index->data.ptr + i * Vis_index->step))[j]); - ind+=1; - } - } - } +void LevMarqSparse::ask_for_proj(CvMat &/*_vis*/,bool once) { + (void)once; + //given parameter P, compute measurement hX + int ind = 0; + for (int i = 0; i < num_points; i++ ) { + CvMat point_mat; + cvGetSubRect( P, &point_mat, cvRect( 0, num_cams * num_cam_param + num_point_param * i, 1, num_point_param )); + for (int j = 0; j < num_cams; j++ ) { + //CvMat* Aij = ((CvMat**)(A->data.ptr + A->step * i))[j]; + CvMat* Aij = A[j+i*num_cams]; + if (Aij ) { //visible + CvMat cam_mat; + cvGetSubRect( P, &cam_mat, cvRect( 0, j * num_cam_param, 1, num_cam_param )); + CvMat measur_mat; + cvGetSubRect( hX, &measur_mat, cvRect( 0, ind * num_err_param, 1, num_err_param )); + Mat _point_mat(&point_mat), _cam_mat(&cam_mat), _measur_mat(&measur_mat); + func( i, j, _point_mat, _cam_mat, _measur_mat, data); + assert( ind*num_err_param == ((int*)(Vis_index->data.ptr + i * Vis_index->step))[j]); + ind+=1; + } + } + } } //iteratively asks for Jacobians for every camera_point pair -void LevMarqSparse::ask_for_projac(CvMat &_vis) { //should be evaluated at point prevP - // compute jacobians Aij and Bij - for (int i = 0; i < num_points; i++ ) { - CvMat point_mat; - cvGetSubRect( prevP, &point_mat, cvRect( 0, num_cams * num_cam_param + num_point_param * i, 1, num_point_param )); - - //CvMat** A_line = (CvMat**)(A->data.ptr + A->step * i); - //CvMat** B_line = (CvMat**)(B->data.ptr + B->step * i); - for( int j = 0; j < num_cams; j++ ) { - //CvMat* Aij = A_line[j]; - //if( Aij ) //Aij is not zero - CvMat* Aij = A[j+i*num_cams]; - CvMat* Bij = B[j+i*num_cams]; - if(Aij) { - //CvMat** A_line = (CvMat**)(A->data.ptr + A->step * i); - //CvMat** B_line = (CvMat**)(B->data.ptr + B->step * i); - - //CvMat* Aij = A_line[j]; - //CvMat* Aij = ((CvMat**)(A->data.ptr + A->step * i))[j]; - - CvMat cam_mat; - cvGetSubRect( prevP, &cam_mat, cvRect( 0, j * num_cam_param, 1, num_cam_param )); - - //CvMat* Bij = B_line[j]; - //CvMat* Bij = ((CvMat**)(B->data.ptr + B->step * i))[j]; - Mat _point_mat(&point_mat), _cam_mat(&cam_mat), _Aij(Aij), _Bij(Bij); - (*fjac)(i, j, _point_mat, _cam_mat, _Aij, _Bij, data); - } +void LevMarqSparse::ask_for_projac(CvMat &/*_vis*/) //should be evaluated at point prevP +{ + // compute jacobians Aij and Bij + for (int i = 0; i < num_points; i++ ) + { + CvMat point_mat; + cvGetSubRect( prevP, &point_mat, cvRect( 0, num_cams * num_cam_param + num_point_param * i, 1, num_point_param )); + + //CvMat** A_line = (CvMat**)(A->data.ptr + A->step * i); + //CvMat** B_line = (CvMat**)(B->data.ptr + B->step * i); + for( int j = 0; j < num_cams; j++ ) + { + //CvMat* Aij = A_line[j]; + //if( Aij ) //Aij is not zero + CvMat* Aij = A[j+i*num_cams]; + CvMat* Bij = B[j+i*num_cams]; + if(Aij) + { + //CvMat** A_line = (CvMat**)(A->data.ptr + A->step * i); + //CvMat** B_line = (CvMat**)(B->data.ptr + B->step * i); + + //CvMat* Aij = A_line[j]; + //CvMat* Aij = ((CvMat**)(A->data.ptr + A->step * i))[j]; + + CvMat cam_mat; + cvGetSubRect( prevP, &cam_mat, cvRect( 0, j * num_cam_param, 1, num_cam_param )); + + //CvMat* Bij = B_line[j]; + //CvMat* Bij = ((CvMat**)(B->data.ptr + B->step * i))[j]; + Mat _point_mat(&point_mat), _cam_mat(&cam_mat), _Aij(Aij), _Bij(Bij); + (*fjac)(i, j, _point_mat, _cam_mat, _Aij, _Bij, data); + } + } } - } } void LevMarqSparse::optimize(CvMat &_vis) { //main function that runs minimization @@ -1086,7 +1091,7 @@ void LevMarqSparse::bundleAdjust( vector& points, //positions of points CvMat point_mat; cvGetSubRect( levmar.P, &point_mat, cvRect( 0, levmar.num_cams * levmar.num_cam_param+ levmar.num_point_param * i, 1, levmar.num_point_param )); CvScalar x = cvGet2D(&point_mat,0,0); CvScalar y = cvGet2D(&point_mat,1,0); CvScalar z = cvGet2D(&point_mat,2,0); - points.push_back(Point3f(x.val[0],y.val[0],z.val[0])); + points.push_back(Point3d(x.val[0],y.val[0],z.val[0])); //std::cerr<<"point"< -bool CommandLineParser::get(const std::string& name, const bool& default_value) +bool CommandLineParser::get(const std::string& name, const bool& /*default_value*/) { if (!has(name)) return false; diff --git a/modules/core/src/precomp.hpp b/modules/core/src/precomp.hpp index 4eb5e25..fb3eba3 100644 --- a/modules/core/src/precomp.hpp +++ b/modules/core/src/precomp.hpp @@ -48,7 +48,7 @@ #pragma warning( disable: 4251 4711 4710 4514 ) #endif -#ifdef HAVE_CONFIG_H +#ifdef HAVE_CVCONFIG_H #include "cvconfig.h" #endif diff --git a/modules/core/test/test_ds.cpp b/modules/core/test/test_ds.cpp index 5627c9c..bd12fd5 100644 --- a/modules/core/test/test_ds.cpp +++ b/modules/core/test/test_ds.cpp @@ -2023,7 +2023,14 @@ void Core_GraphScanTest::run( int ) event = "End of procedure"; break; default: +#if _MSC_VER >= 1200 + #pragma warning( push ) + #pragma warning( disable : 4127 ) +#endif CV_TS_SEQ_CHECK_CONDITION( 0, "Invalid code appeared during graph scan" ); +#if _MSC_VER >= 1200 + #pragma warning( pop ) +#endif } ts->printf( cvtest::TS::LOG, "%s", event ); diff --git a/modules/features2d/src/blobdetector.cpp b/modules/features2d/src/blobdetector.cpp index 8a55449..1242507 100644 --- a/modules/features2d/src/blobdetector.cpp +++ b/modules/features2d/src/blobdetector.cpp @@ -1,44 +1,44 @@ /*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*/ +// +// 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*/ #include "precomp.hpp" #include @@ -52,241 +52,242 @@ using namespace cv; /* - * SimpleBlobDetector - */ +* SimpleBlobDetector +*/ SimpleBlobDetector::Params::Params() { - thresholdStep = 10; - minThreshold = 50; - maxThreshold = 220; - minRepeatability = 2; - minDistBetweenBlobs = 10; - - filterByColor = true; - blobColor = 0; - - filterByArea = true; - minArea = 25; - maxArea = 5000; - - filterByCircularity = false; - minCircularity = 0.8f; - maxCircularity = std::numeric_limits::max(); - - filterByInertia = true; - //minInertiaRatio = 0.6; - minInertiaRatio = 0.1f; - maxInertiaRatio = std::numeric_limits::max(); - - filterByConvexity = true; - //minConvexity = 0.8; - minConvexity = 0.95f; - maxConvexity = std::numeric_limits::max(); + thresholdStep = 10; + minThreshold = 50; + maxThreshold = 220; + minRepeatability = 2; + minDistBetweenBlobs = 10; + + filterByColor = true; + blobColor = 0; + + filterByArea = true; + minArea = 25; + maxArea = 5000; + + filterByCircularity = false; + minCircularity = 0.8f; + maxCircularity = std::numeric_limits::max(); + + filterByInertia = true; + //minInertiaRatio = 0.6; + minInertiaRatio = 0.1f; + maxInertiaRatio = std::numeric_limits::max(); + + filterByConvexity = true; + //minConvexity = 0.8; + minConvexity = 0.95f; + maxConvexity = std::numeric_limits::max(); } SimpleBlobDetector::SimpleBlobDetector(const SimpleBlobDetector::Params ¶meters) : - params(parameters) +params(parameters) { } void SimpleBlobDetector::findBlobs(const cv::Mat &image, const cv::Mat &binaryImage, vector
¢ers) const { - centers.clear(); + (void)image; + centers.clear(); - vector < vector > contours; - Mat tmpBinaryImage = binaryImage.clone(); - findContours(tmpBinaryImage, contours, CV_RETR_LIST, CV_CHAIN_APPROX_NONE); + vector < vector > contours; + Mat tmpBinaryImage = binaryImage.clone(); + findContours(tmpBinaryImage, contours, CV_RETR_LIST, CV_CHAIN_APPROX_NONE); #ifdef DEBUG_BLOB_DETECTOR -// Mat keypointsImage; -// cvtColor( binaryImage, keypointsImage, CV_GRAY2RGB ); -// -// Mat contoursImage; -// cvtColor( binaryImage, contoursImage, CV_GRAY2RGB ); -// drawContours( contoursImage, contours, -1, Scalar(0,255,0) ); -// imshow("contours", contoursImage ); + // Mat keypointsImage; + // cvtColor( binaryImage, keypointsImage, CV_GRAY2RGB ); + // + // Mat contoursImage; + // cvtColor( binaryImage, contoursImage, CV_GRAY2RGB ); + // drawContours( contoursImage, contours, -1, Scalar(0,255,0) ); + // imshow("contours", contoursImage ); #endif - for (size_t contourIdx = 0; contourIdx < contours.size(); contourIdx++) - { - Center center; - center.confidence = 1; - Moments moms = moments(Mat(contours[contourIdx])); - if (params.filterByArea) - { - double area = moms.m00; - if (area < params.minArea || area >= params.maxArea) - continue; - } - - if (params.filterByCircularity) - { - double area = moms.m00; - double perimeter = arcLength(Mat(contours[contourIdx]), true); - double ratio = 4 * CV_PI * area / (perimeter * perimeter); - if (ratio < params.minCircularity || ratio >= params.maxCircularity) - continue; - } - - if (params.filterByInertia) - { - double denominator = sqrt(pow(2 * moms.mu11, 2) + pow(moms.mu20 - moms.mu02, 2)); - const double eps = 1e-2; - double ratio; - if (denominator > eps) - { - double cosmin = (moms.mu20 - moms.mu02) / denominator; - double sinmin = 2 * moms.mu11 / denominator; - double cosmax = -cosmin; - double sinmax = -sinmin; - - double imin = 0.5 * (moms.mu20 + moms.mu02) - 0.5 * (moms.mu20 - moms.mu02) * cosmin - moms.mu11 * sinmin; - double imax = 0.5 * (moms.mu20 + moms.mu02) - 0.5 * (moms.mu20 - moms.mu02) * cosmax - moms.mu11 * sinmax; - ratio = imin / imax; - } - else - { - ratio = 1; - } - - if (ratio < params.minInertiaRatio || ratio >= params.maxInertiaRatio) - continue; - - center.confidence = ratio * ratio; - } - - if (params.filterByConvexity) - { - vector < Point > hull; - convexHull(Mat(contours[contourIdx]), hull); - double area = contourArea(Mat(contours[contourIdx])); - double hullArea = contourArea(Mat(hull)); - double ratio = area / hullArea; - if (ratio < params.minConvexity || ratio >= params.maxConvexity) - continue; - } - - center.location = Point2d(moms.m10 / moms.m00, moms.m01 / moms.m00); - - if (params.filterByColor) - { - if (binaryImage.at (cvRound(center.location.y), cvRound(center.location.x)) != params.blobColor) - continue; - } - - //compute blob radius - { - vector dists; - for (size_t pointIdx = 0; pointIdx < contours[contourIdx].size(); pointIdx++) - { - Point2d pt = contours[contourIdx][pointIdx]; - dists.push_back(norm(center.location - pt)); - } - std::sort(dists.begin(), dists.end()); - center.radius = (dists[(dists.size() - 1) / 2] + dists[dists.size() / 2]) / 2.; - } - - centers.push_back(center); + for (size_t contourIdx = 0; contourIdx < contours.size(); contourIdx++) + { + Center center; + center.confidence = 1; + Moments moms = moments(Mat(contours[contourIdx])); + if (params.filterByArea) + { + double area = moms.m00; + if (area < params.minArea || area >= params.maxArea) + continue; + } + + if (params.filterByCircularity) + { + double area = moms.m00; + double perimeter = arcLength(Mat(contours[contourIdx]), true); + double ratio = 4 * CV_PI * area / (perimeter * perimeter); + if (ratio < params.minCircularity || ratio >= params.maxCircularity) + continue; + } + + if (params.filterByInertia) + { + double denominator = sqrt(pow(2 * moms.mu11, 2) + pow(moms.mu20 - moms.mu02, 2)); + const double eps = 1e-2; + double ratio; + if (denominator > eps) + { + double cosmin = (moms.mu20 - moms.mu02) / denominator; + double sinmin = 2 * moms.mu11 / denominator; + double cosmax = -cosmin; + double sinmax = -sinmin; + + double imin = 0.5 * (moms.mu20 + moms.mu02) - 0.5 * (moms.mu20 - moms.mu02) * cosmin - moms.mu11 * sinmin; + double imax = 0.5 * (moms.mu20 + moms.mu02) - 0.5 * (moms.mu20 - moms.mu02) * cosmax - moms.mu11 * sinmax; + ratio = imin / imax; + } + else + { + ratio = 1; + } + + if (ratio < params.minInertiaRatio || ratio >= params.maxInertiaRatio) + continue; + + center.confidence = ratio * ratio; + } + + if (params.filterByConvexity) + { + vector < Point > hull; + convexHull(Mat(contours[contourIdx]), hull); + double area = contourArea(Mat(contours[contourIdx])); + double hullArea = contourArea(Mat(hull)); + double ratio = area / hullArea; + if (ratio < params.minConvexity || ratio >= params.maxConvexity) + continue; + } + + center.location = Point2d(moms.m10 / moms.m00, moms.m01 / moms.m00); + + if (params.filterByColor) + { + if (binaryImage.at (cvRound(center.location.y), cvRound(center.location.x)) != params.blobColor) + continue; + } + + //compute blob radius + { + vector dists; + for (size_t pointIdx = 0; pointIdx < contours[contourIdx].size(); pointIdx++) + { + Point2d pt = contours[contourIdx][pointIdx]; + dists.push_back(norm(center.location - pt)); + } + std::sort(dists.begin(), dists.end()); + center.radius = (dists[(dists.size() - 1) / 2] + dists[dists.size() / 2]) / 2.; + } + + centers.push_back(center); #ifdef DEBUG_BLOB_DETECTOR -// circle( keypointsImage, center.location, 1, Scalar(0,0,255), 1 ); + // circle( keypointsImage, center.location, 1, Scalar(0,0,255), 1 ); #endif - } + } #ifdef DEBUG_BLOB_DETECTOR -// imshow("bk", keypointsImage ); -// waitKey(); + // imshow("bk", keypointsImage ); + // waitKey(); #endif } void SimpleBlobDetector::detectImpl(const cv::Mat& image, std::vector& keypoints, const cv::Mat&) const { - //TODO: support mask - keypoints.clear(); - Mat grayscaleImage; - if (image.channels() == 3) - cvtColor(image, grayscaleImage, CV_BGR2GRAY); - else - grayscaleImage = image; - - vector < vector
> centers; - for (double thresh = params.minThreshold; thresh < params.maxThreshold; thresh += params.thresholdStep) - { - Mat binarizedImage; - threshold(grayscaleImage, binarizedImage, thresh, 255, THRESH_BINARY); + //TODO: support mask + keypoints.clear(); + Mat grayscaleImage; + if (image.channels() == 3) + cvtColor(image, grayscaleImage, CV_BGR2GRAY); + else + grayscaleImage = image; + + vector < vector
> centers; + for (double thresh = params.minThreshold; thresh < params.maxThreshold; thresh += params.thresholdStep) + { + Mat binarizedImage; + threshold(grayscaleImage, binarizedImage, thresh, 255, THRESH_BINARY); #ifdef DEBUG_BLOB_DETECTOR -// Mat keypointsImage; -// cvtColor( binarizedImage, keypointsImage, CV_GRAY2RGB ); + // Mat keypointsImage; + // cvtColor( binarizedImage, keypointsImage, CV_GRAY2RGB ); #endif - vector < Center > curCenters; - findBlobs(grayscaleImage, binarizedImage, curCenters); - vector < vector
> newCenters; - for (size_t i = 0; i < curCenters.size(); i++) - { + vector < Center > curCenters; + findBlobs(grayscaleImage, binarizedImage, curCenters); + vector < vector
> newCenters; + for (size_t i = 0; i < curCenters.size(); i++) + { #ifdef DEBUG_BLOB_DETECTOR -// circle(keypointsImage, curCenters[i].location, curCenters[i].radius, Scalar(0,0,255),-1); + // circle(keypointsImage, curCenters[i].location, curCenters[i].radius, Scalar(0,0,255),-1); #endif - bool isNew = true; - for (size_t j = 0; j < centers.size(); j++) - { - double dist = norm(centers[j][ centers[j].size() / 2 ].location - curCenters[i].location); - isNew = dist >= params.minDistBetweenBlobs && dist >= centers[j][ centers[j].size() / 2 ].radius && dist >= curCenters[i].radius; - if (!isNew) - { - centers[j].push_back(curCenters[i]); - - size_t k = centers[j].size() - 1; - while( k > 0 && centers[j][k].radius < centers[j][k-1].radius ) - { - centers[j][k] = centers[j][k-1]; - k--; - } - centers[j][k] = curCenters[i]; - - break; - } - } - if (isNew) - { - newCenters.push_back(vector
(1, curCenters[i])); - //centers.push_back(vector
(1, curCenters[i])); - } - } - std::copy(newCenters.begin(), newCenters.end(), std::back_inserter(centers)); + bool isNew = true; + for (size_t j = 0; j < centers.size(); j++) + { + double dist = norm(centers[j][ centers[j].size() / 2 ].location - curCenters[i].location); + isNew = dist >= params.minDistBetweenBlobs && dist >= centers[j][ centers[j].size() / 2 ].radius && dist >= curCenters[i].radius; + if (!isNew) + { + centers[j].push_back(curCenters[i]); + + size_t k = centers[j].size() - 1; + while( k > 0 && centers[j][k].radius < centers[j][k-1].radius ) + { + centers[j][k] = centers[j][k-1]; + k--; + } + centers[j][k] = curCenters[i]; + + break; + } + } + if (isNew) + { + newCenters.push_back(vector
(1, curCenters[i])); + //centers.push_back(vector
(1, curCenters[i])); + } + } + std::copy(newCenters.begin(), newCenters.end(), std::back_inserter(centers)); #ifdef DEBUG_BLOB_DETECTOR -// imshow("binarized", keypointsImage ); - //waitKey(); + // imshow("binarized", keypointsImage ); + //waitKey(); #endif - } - - for (size_t i = 0; i < centers.size(); i++) - { - if (centers[i].size() < params.minRepeatability) - continue; - Point2d sumPoint(0, 0); - double normalizer = 0; - for (size_t j = 0; j < centers[i].size(); j++) - { - sumPoint += centers[i][j].confidence * centers[i][j].location; - normalizer += centers[i][j].confidence; - } - sumPoint *= (1. / normalizer); - KeyPoint kpt(sumPoint, centers[i][centers[i].size() / 2].radius); - keypoints.push_back(kpt); - } + } + + for (size_t i = 0; i < centers.size(); i++) + { + if (centers[i].size() < params.minRepeatability) + continue; + Point2d sumPoint(0, 0); + double normalizer = 0; + for (size_t j = 0; j < centers[i].size(); j++) + { + sumPoint += centers[i][j].confidence * centers[i][j].location; + normalizer += centers[i][j].confidence; + } + sumPoint *= (1. / normalizer); + KeyPoint kpt(sumPoint, (float)(centers[i][centers[i].size() / 2].radius)); + keypoints.push_back(kpt); + } #ifdef DEBUG_BLOB_DETECTOR - namedWindow("keypoints", CV_WINDOW_NORMAL); - Mat outImg = image.clone(); - for(size_t i=0; idescr[i]; + int_val = (int)(SIFT_INT_DESCR_FCTR * feat->descr[i]); feat->descr[i] = MIN( 255, int_val ); } } @@ -1207,7 +1207,7 @@ static void hist_to_descr( double*** hist, int d, int n, struct feature* feat ) @return Returns 1 if feat1's scale is greater than feat2's, -1 if vice versa, and 0 if their scales are equal */ -static int feature_cmp( void* feat1, void* feat2, void* param ) +static int feature_cmp( void* feat1, void* feat2, void* /*param*/ ) { struct feature* f1 = (struct feature*) feat1; struct feature* f2 = (struct feature*) feat2; @@ -1478,9 +1478,9 @@ struct SiftParams inline KeyPoint featureToKeyPoint( const feature& feat ) { - float size = feat.scl * SIFT::DescriptorParams::GET_DEFAULT_MAGNIFICATION() * 4; // 4==NBP - float angle = feat.ori * a_180divPI; - return KeyPoint( feat.x, feat.y, size, angle, 0, feat.feature_data->octv, 0 ); + float size = (float)(feat.scl * SIFT::DescriptorParams::GET_DEFAULT_MAGNIFICATION() * 4); // 4==NBP + float angle = (float)(feat.ori * a_180divPI); + return KeyPoint( (float)feat.x, (float)feat.y, size, angle, 0, feat.feature_data->octv, 0 ); } static void fillFeatureData( feature& feat, const SiftParams& params ) @@ -1551,7 +1551,7 @@ static void fillFeatureData( feature& feat, const SiftParams& params ) float s, phi; phi = static_cast(log( sigma / params.sigma0 ) / log(2.0)); - o = std::floor( phi - (float(params.smin)+.5)/params.S ); + o = (int)std::floor( phi - (float(params.smin)+.5)/params.S ); o = std::min(o, params.omin+params.O-1); o = std::max(o, params.omin); s = params.S * (phi - o); @@ -1640,7 +1640,7 @@ void SIFT::operator()(const Mat& image, const Mat& mask, ImagePyrData pyrImages( &img, commParams.nOctaves, commParams.nOctaveLayers, SIFT_SIGMA, SIFT_IMG_DBL ); int feature_count = 0; - compute_features( &pyrImages, &features, feature_count, detectorParams.threshold, detectorParams.edgeThreshold ); + compute_features( &pyrImages, &features, feature_count, detectorParams.threshold, (int)detectorParams.edgeThreshold ); // convert to KeyPoint structure keypoints.resize( feature_count ); diff --git a/modules/features2d/test/test_features2d.cpp b/modules/features2d/test/test_features2d.cpp index a22873b..9328eae 100644 --- a/modules/features2d/test/test_features2d.cpp +++ b/modules/features2d/test/test_features2d.cpp @@ -1047,7 +1047,7 @@ TEST( Features2d_DescriptorExtractor_SURF, regression ) TEST( Features2d_DescriptorExtractor_ORB, regression ) { // TODO adjust the parameters below - CV_DescriptorExtractorTest test( "descriptor-orb", 1.0f, + CV_DescriptorExtractorTest test( "descriptor-orb", (CV_DescriptorExtractorTest::DistanceType)1.0f, DescriptorExtractor::create("ORB"), 0.010f ); test.safe_run(); } diff --git a/modules/gpu/include/opencv2/gpu/devmem2d.hpp b/modules/gpu/include/opencv2/gpu/devmem2d.hpp index b811371..2b9f393 100644 --- a/modules/gpu/include/opencv2/gpu/devmem2d.hpp +++ b/modules/gpu/include/opencv2/gpu/devmem2d.hpp @@ -87,6 +87,8 @@ namespace cv __CV_GPU_HOST_DEVICE__ T* ptr(int y = 0) { return (T*)( (char*)data + y * step ); } __CV_GPU_HOST_DEVICE__ const T* ptr(int y = 0) const { return (const T*)( (const char*)data + y * step ); } + __CV_GPU_HOST_DEVICE__ operator T*() const { return data; } + #if defined(__DEVCLASES_ADD_THRUST_BEGIN_END__) thrust::device_ptr begin() const { return thrust::device_ptr(data); } thrust::device_ptr end() const { return thrust::device_ptr(data) + cols * rows; } diff --git a/modules/gpu/include/opencv2/gpu/gpu.hpp b/modules/gpu/include/opencv2/gpu/gpu.hpp index 284d328..7c1ebb7 100644 --- a/modules/gpu/include/opencv2/gpu/gpu.hpp +++ b/modules/gpu/include/opencv2/gpu/gpu.hpp @@ -1176,7 +1176,7 @@ namespace cv /////////////////////////// DisparityBilateralFilter /////////////////////////// // Disparity map refinement using joint bilateral filtering given a single color image. - // Qingxiong Yang, Liang Wang�, Narendra Ahuja + // Qingxiong Yang, Liang Wang, Narendra Ahuja // http://vision.ai.uiuc.edu/~qyang6/ class CV_EXPORTS DisparityBilateralFilter diff --git a/modules/gpu/src/precomp.hpp b/modules/gpu/src/precomp.hpp index 022b26a..ed331cc 100644 --- a/modules/gpu/src/precomp.hpp +++ b/modules/gpu/src/precomp.hpp @@ -46,7 +46,7 @@ #pragma warning( disable: 4251 4710 4711 4514 4996 ) #endif -#ifdef HAVE_CONFIG_H +#ifdef HAVE_CVCONFIG_H #include "cvconfig.h" #endif diff --git a/modules/haartraining/cvboost.cpp b/modules/haartraining/cvboost.cpp index 472f36d..c32a313 100644 --- a/modules/haartraining/cvboost.cpp +++ b/modules/haartraining/cvboost.cpp @@ -39,7 +39,7 @@ // //M*/ -#ifdef HAVE_CONFIG_H +#ifdef HAVE_CVCONFIG_H #include "cvconfig.h" #endif diff --git a/modules/highgui/CMakeLists.txt b/modules/highgui/CMakeLists.txt index d216b60..cf65495 100644 --- a/modules/highgui/CMakeLists.txt +++ b/modules/highgui/CMakeLists.txt @@ -244,10 +244,6 @@ set(lib_srcs ${highgui_srcs} ${grfmt_srcs}) # ---------------------------------------------------------------------------------- set(the_target "opencv_highgui") -if (BUILD_SHARED_LIBS) - add_definitions(-DHIGHGUI_EXPORTS -DCVAPI_EXPORTS) -endif() - include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include" "${CMAKE_CURRENT_SOURCE_DIR}/../core/include" "${CMAKE_CURRENT_SOURCE_DIR}/../imgproc/include" @@ -260,6 +256,15 @@ endif() add_library(${the_target} ${lib_srcs} ${highgui_hdrs} ${grfmt_hdrs} ${highgui_ext_hdrs}) +if (BUILD_SHARED_LIBS) + add_definitions(-DHIGHGUI_EXPORTS) + if(MSVC) + set_target_properties(${the_target} PROPERTIES DEFINE_SYMBOL CVAPI_EXPORTS) + else() + add_definitions(-DCVAPI_EXPORTS) + endif() +endif() + if(PCHSupport_FOUND AND USE_PRECOMPILED_HEADERS) set(pch_header ${CMAKE_CURRENT_SOURCE_DIR}/src/precomp.hpp) if(${CMAKE_GENERATOR} MATCHES "Visual*" OR ${CMAKE_GENERATOR} MATCHES "Xcode*") diff --git a/modules/imgproc/src/contours.cpp b/modules/imgproc/src/contours.cpp index 2a729fa..d369f15 100644 --- a/modules/imgproc/src/contours.cpp +++ b/modules/imgproc/src/contours.cpp @@ -1469,7 +1469,7 @@ cvFindContours( void* img, CvMemStorage* storage, return count; } -void cv::findContours( const InputOutputArray _image, OutputArrayOfArrays _contours, +void cv::findContours( InputOutputArray _image, OutputArrayOfArrays _contours, OutputArray _hierarchy, int mode, int method, Point offset ) { Mat image = _image.getMat(); diff --git a/modules/imgproc/src/precomp.hpp b/modules/imgproc/src/precomp.hpp index 2c1c596..731addd 100644 --- a/modules/imgproc/src/precomp.hpp +++ b/modules/imgproc/src/precomp.hpp @@ -48,7 +48,7 @@ #pragma warning( disable: 4251 4711 4710 4514 ) #endif -#ifdef HAVE_CONFIG_H +#ifdef HAVE_CVCONFIG_H #include "cvconfig.h" #endif diff --git a/modules/legacy/src/precomp.hpp b/modules/legacy/src/precomp.hpp index cbfe060..7c1993b 100644 --- a/modules/legacy/src/precomp.hpp +++ b/modules/legacy/src/precomp.hpp @@ -45,7 +45,7 @@ #pragma warning( disable: 4251 4710 4711 4514 4996 ) #endif -#ifdef HAVE_CONFIG_H +#ifdef HAVE_CVCONFIG_H #include "cvconfig.h" #endif diff --git a/modules/ml/src/em.cpp b/modules/ml/src/em.cpp index 4843696..ac2a960 100644 --- a/modules/ml/src/em.cpp +++ b/modules/ml/src/em.cpp @@ -847,7 +847,7 @@ void CvEM::init_auto( const CvVectors& train_data ) void CvEM::kmeans( const CvVectors& train_data, int nclusters, CvMat* labels, - CvTermCriteria termcrit, const CvMat* centers0 ) + CvTermCriteria termcrit, const CvMat* /*centers0*/ ) { int i, nsamples = train_data.count, dims = train_data.dims; cv::Ptr temp_mat = cvCreateMat(nsamples, dims, CV_32F); diff --git a/modules/ml/src/precomp.hpp b/modules/ml/src/precomp.hpp index 821cefa..285abea 100644 --- a/modules/ml/src/precomp.hpp +++ b/modules/ml/src/precomp.hpp @@ -45,7 +45,7 @@ #pragma warning( disable: 4251 4514 4710 4711 4710 ) #endif -#ifdef HAVE_CONFIG_H +#ifdef HAVE_CVCONFIG_H #include "cvconfig.h" #endif diff --git a/modules/objdetect/src/datamatrix.cpp b/modules/objdetect/src/datamatrix.cpp index cafcf6e..4914898 100644 --- a/modules/objdetect/src/datamatrix.cpp +++ b/modules/objdetect/src/datamatrix.cpp @@ -532,6 +532,8 @@ namespace putText(image, code_text, code.corners[0], CV_FONT_HERSHEY_SIMPLEX, 0.8, c2, 1, CV_AA, false); } cv::Mat& image; + + DrawDataMatrixCode& operator=(const DrawDataMatrixCode&); }; } diff --git a/modules/objdetect/src/dotdetector.cpp b/modules/objdetect/src/dotdetector.cpp index 955f132..c963965 100644 --- a/modules/objdetect/src/dotdetector.cpp +++ b/modules/objdetect/src/dotdetector.cpp @@ -277,6 +277,8 @@ struct TrainImageQuantizer // Result matrix Mat* quantizedImage; + + TrainImageQuantizer& operator=(const TrainImageQuantizer&); }; static void quantizeToTrain( const Mat& _magnitudesExt, const Mat& _anglesExt, const Mat& maskExt, @@ -360,6 +362,8 @@ struct DetectImageQuantizer // Result matrix Mat* quantizedImage; + + DetectImageQuantizer& operator=(const DetectImageQuantizer&); }; static void quantizeToDetect( const Mat& _magnitudes, const Mat& angles, @@ -902,6 +906,8 @@ struct TemplateComparator vector* concurrRectsPtr; vector* concurrRatiosPtr; vector* concurrTemplateIndicesPtr; + + TemplateComparator& operator=(const TemplateComparator&); }; void DOTDetector::detectQuantized( const Mat& queryQuantizedImage, float minRatio, diff --git a/modules/objdetect/src/precomp.hpp b/modules/objdetect/src/precomp.hpp index e44632b..2ab8ba3 100644 --- a/modules/objdetect/src/precomp.hpp +++ b/modules/objdetect/src/precomp.hpp @@ -47,7 +47,7 @@ #pragma warning( disable: 4251 4710 4711 4514 4996 ) #endif -#ifdef HAVE_CONFIG_H +#ifdef HAVE_CVCONFIG_H #include "cvconfig.h" #endif diff --git a/modules/objdetect/test/test_latentsvmdetector.cpp b/modules/objdetect/test/test_latentsvmdetector.cpp index c82432f..1dfe756 100644 --- a/modules/objdetect/test/test_latentsvmdetector.cpp +++ b/modules/objdetect/test/test_latentsvmdetector.cpp @@ -44,7 +44,7 @@ #include -#ifdef HAVE_CONFIG_H +#ifdef HAVE_CVCONFIG_H #include "cvconfig.h" #endif diff --git a/modules/stitching/precomp.hpp b/modules/stitching/precomp.hpp index c0ce981..3403422 100644 --- a/modules/stitching/precomp.hpp +++ b/modules/stitching/precomp.hpp @@ -42,7 +42,7 @@ #ifndef __OPENCV_STITCHING_PRECOMP_H__ #define __OPENCV_STITCHING_PRECOMP_H__ -#ifdef HAVE_CONFIG_H +#ifdef HAVE_CVCONFIG_H #include "cvconfig.h" #endif diff --git a/modules/video/src/bgfg_gaussmix2.cpp b/modules/video/src/bgfg_gaussmix2.cpp index 9fcad23..1d1f0c8 100644 --- a/modules/video/src/bgfg_gaussmix2.cpp +++ b/modules/video/src/bgfg_gaussmix2.cpp @@ -1293,7 +1293,14 @@ void BackgroundSubtractorMOG2::operator()(InputArray _image, OutputArray _fgmask void BackgroundSubtractorMOG2::getBackgroundImage(OutputArray backgroundImage) const { +#if _MSC_VER >= 1200 + #pragma warning( push ) + #pragma warning( disable : 4127 ) +#endif CV_Assert(CV_BGFG_MOG2_NDMAX == 3); +#if _MSC_VER >= 1200 + #pragma warning( pop ) +#endif Mat meanBackground(frameSize, CV_8UC3, Scalar::all(0)); int firstGaussianIdx = 0; diff --git a/modules/video/src/precomp.hpp b/modules/video/src/precomp.hpp index 98e3c4d..454f5f0 100644 --- a/modules/video/src/precomp.hpp +++ b/modules/video/src/precomp.hpp @@ -47,7 +47,7 @@ #pragma warning( disable: 4251 4710 4711 4514 4996 ) #endif -#ifdef HAVE_CONFIG_H +#ifdef HAVE_CVCONFIG_H #include "cvconfig.h" #endif diff --git a/samples/c/latentsvmdetect.cpp b/samples/c/latentsvmdetect.cpp index 9f0ef9c..6067e2a 100644 --- a/samples/c/latentsvmdetect.cpp +++ b/samples/c/latentsvmdetect.cpp @@ -2,7 +2,7 @@ #include "opencv2/highgui/highgui.hpp" #include -#ifdef HAVE_CONFIG_H +#ifdef HAVE_CVCONFIG_H #include #endif #ifdef HAVE_TBB diff --git a/samples/cpp/detector_descriptor_evaluation.cpp b/samples/cpp/detector_descriptor_evaluation.cpp index b76bf3e..f75bef7 100644 --- a/samples/cpp/detector_descriptor_evaluation.cpp +++ b/samples/cpp/detector_descriptor_evaluation.cpp @@ -539,7 +539,7 @@ void DetectorQualityEvaluator::readAlgorithm () } } -int update_progress( const string& name, int progress, int test_case_idx, int count, double dt ) +int update_progress( const string& /*name*/, int progress, int test_case_idx, int count, double dt ) { int width = 60 /*- (int)name.length()*/; if( count > 0 ) diff --git a/samples/cpp/em.cpp b/samples/cpp/em.cpp index 468993f..c7a5c63 100644 --- a/samples/cpp/em.cpp +++ b/samples/cpp/em.cpp @@ -3,7 +3,7 @@ using namespace cv; -int main( int argc, char** argv ) +int main( int /*argc*/, char** /*argv*/ ) { const int N = 4; const int N1 = (int)sqrt((double)N);