diff --git a/modules/calib3d/src/circlesgrid.hpp b/modules/calib3d/src/circlesgrid.hpp index 3c6bdc7fa..892271ed1 100644 --- a/modules/calib3d/src/circlesgrid.hpp +++ b/modules/calib3d/src/circlesgrid.hpp @@ -132,7 +132,7 @@ public: private: void computeRNG(Graph &rng, std::vector &vectors, cv::Mat *drawImage = 0) const; void rng2gridGraph(Graph &rng, std::vector &vectors) const; - void eraseUsedGraph(vector &basisGraphs) const; + void eraseUsedGraph(std::vector &basisGraphs) const; void filterOutliersByDensity(const std::vector &samples, std::vector &filteredSamples); void findBasis(const std::vector &samples, std::vector &basis, std::vector &basisGraphs); @@ -164,12 +164,12 @@ private: //if endpoint is on a segment then function return false static bool areSegmentsIntersecting(Segment seg1, Segment seg2); - static bool doesIntersectionExist(const vector &corner, const vector > &segments); - void getCornerSegments(const vector > &points, vector > &segments, - vector &cornerIndices, vector &firstSteps, - vector &secondSteps) const; - size_t getFirstCorner(vector &largeCornerIndices, vector &smallCornerIndices, - vector &firstSteps, vector &secondSteps) const; + static bool doesIntersectionExist(const std::vector &corner, const std::vector > &segments); + void getCornerSegments(const std::vector > &points, std::vector > &segments, + std::vector &cornerIndices, std::vector &firstSteps, + std::vector &secondSteps) const; + size_t getFirstCorner(std::vector &largeCornerIndices, std::vector &smallCornerIndices, + std::vector &firstSteps, std::vector &secondSteps) const; static double getDirection(cv::Point2f p1, cv::Point2f p2, cv::Point2f p3); std::vector keypoints; diff --git a/modules/contrib/src/chamfermatching.cpp b/modules/contrib/src/chamfermatching.cpp index 0f6f8cefc..21c62f39a 100644 --- a/modules/contrib/src/chamfermatching.cpp +++ b/modules/contrib/src/chamfermatching.cpp @@ -53,11 +53,11 @@ namespace cv using std::queue; -typedef pair coordinate_t; -typedef float orientation_t;; -typedef vector template_coords_t; -typedef vector template_orientations_t; -typedef pair location_scale_t; +typedef std::pair coordinate_t; +typedef float orientation_t; +typedef std::vector template_coords_t; +typedef std::vector template_orientations_t; +typedef std::pair location_scale_t; class ChamferMatcher { @@ -106,7 +106,7 @@ private: class LocationImageRange : public ImageRange { - const vector& locations_; + const std::vector& locations_; int scales_; float min_scale_; @@ -116,7 +116,7 @@ private: LocationImageRange& operator=(const LocationImageRange&); public: - LocationImageRange(const vector& locations, int scales = 5, float min_scale = 0.6, float max_scale = 1.6) : + LocationImageRange(const std::vector& locations, int scales = 5, float min_scale = 0.6, float max_scale = 1.6) : locations_(locations), scales_(scales), min_scale_(min_scale), max_scale_(max_scale) { } @@ -130,13 +130,13 @@ private: class LocationScaleImageRange : public ImageRange { - const vector& locations_; - const vector& scales_; + const std::vector& locations_; + const std::vector& scales_; LocationScaleImageRange(const LocationScaleImageRange&); LocationScaleImageRange& operator=(const LocationScaleImageRange&); public: - LocationScaleImageRange(const vector& locations, const vector& scales) : + LocationScaleImageRange(const std::vector& locations, const std::vector& scales) : locations_(locations), scales_(scales) { assert(locations.size()==scales.size()); @@ -162,8 +162,8 @@ public: public: - vector scaled_templates; - vector addr; + std::vector scaled_templates; + std::vector addr; int addr_width; float scale; template_coords_t coords; @@ -200,7 +200,7 @@ public: */ Template* rescale(float scale); - vector& getTemplateAddresses(int width); + std::vector& getTemplateAddresses(int width); }; @@ -217,7 +217,7 @@ public: const Template* tpl; }; - typedef vector Matches; + typedef std::vector Matches; private: /** @@ -230,7 +230,7 @@ private: float truncate_; bool use_orientation_; - vector templates; + std::vector templates; public: Matching(bool use_orientation = true, float truncate = 10) : truncate_(truncate), use_orientation_(use_orientation) { @@ -347,7 +347,7 @@ private: class LocationImageIterator : public ImageIterator { - const vector& locations_; + const std::vector& locations_; size_t iter_; @@ -365,7 +365,7 @@ private: LocationImageIterator& operator=(const LocationImageIterator&); public: - LocationImageIterator(const vector& locations, int scales, float min_scale, float max_scale); + LocationImageIterator(const std::vector& locations, int scales, float min_scale, float max_scale); bool hasNext() const { return has_next_; @@ -376,8 +376,8 @@ private: class LocationScaleImageIterator : public ImageIterator { - const vector& locations_; - const vector& scales_; + const std::vector& locations_; + const std::vector& scales_; size_t iter_; @@ -387,7 +387,7 @@ private: LocationScaleImageIterator& operator=(const LocationScaleImageIterator&); public: - LocationScaleImageIterator(const vector& locations, const vector& scales) : + LocationScaleImageIterator(const std::vector& locations, const std::vector& scales) : locations_(locations), scales_(scales) { assert(locations.size()==scales.size()); @@ -511,7 +511,7 @@ ChamferMatcher::SlidingWindowImageIterator::SlidingWindowImageIterator( int widt location_scale_t ChamferMatcher::SlidingWindowImageIterator::next() { - location_scale_t next_val = make_pair(Point(x_,y_),scale_); + location_scale_t next_val = std::make_pair(Point(x_,y_),scale_); x_ += x_step_; @@ -544,7 +544,7 @@ ChamferMatcher::ImageIterator* ChamferMatcher::SlidingWindowImageRange::iterator -ChamferMatcher::LocationImageIterator::LocationImageIterator(const vector& locations, +ChamferMatcher::LocationImageIterator::LocationImageIterator(const std::vector& locations, int scales = 5, float min_scale = 0.6, float max_scale = 1.6) : @@ -562,7 +562,7 @@ ChamferMatcher::LocationImageIterator::LocationImageIterator(const vector location_scale_t ChamferMatcher::LocationImageIterator:: next() { - location_scale_t next_val = make_pair(locations_[iter_],scale_); + location_scale_t next_val = std::make_pair(locations_[iter_],scale_); iter_ ++; if (iter_==locations_.size()) { @@ -583,7 +583,7 @@ location_scale_t ChamferMatcher::LocationImageIterator:: next() location_scale_t ChamferMatcher::LocationScaleImageIterator::next() { - location_scale_t next_val = make_pair(locations_[iter_],scales_[iter_]); + location_scale_t next_val = std::make_pair(locations_[iter_],scales_[iter_]); iter_ ++; if (iter_==locations_.size()) { @@ -738,7 +738,7 @@ void ChamferMatcher::Matching::findContourOrientations(const template_coords_t& const int M = 5; int coords_size = coords.size(); - vector angles(2*M); + std::vector angles(2*M); orientations.insert(orientations.begin(), coords_size, float(-3*CV_PI)); // mark as invalid in the beginning if (coords_size<2*M+1) { // if contour not long enough to estimate orientations, abort @@ -948,7 +948,7 @@ void ChamferMatcher::Matching::computeDistanceTransform(Mat& edges_img, Mat& dis int w = s.width; int h = s.height; // set distance to the edge pixels to 0 and put them in the queue - queue > q; + std::queue > q; @@ -957,7 +957,7 @@ void ChamferMatcher::Matching::computeDistanceTransform(Mat& edges_img, Mat& dis unsigned char edge_val = edges_img.at(y,x); if ( (edge_val!=0) ) { - q.push(make_pair(x,y)); + q.push(std::make_pair(x,y)); dist_img.at(y,x)= 0; if (&annotate_img!=NULL) { @@ -972,7 +972,7 @@ void ChamferMatcher::Matching::computeDistanceTransform(Mat& edges_img, Mat& dis } // breadth first computation of distance transform - pair crt; + std::pair crt; while (!q.empty()) { crt = q.front(); q.pop(); @@ -1000,7 +1000,7 @@ void ChamferMatcher::Matching::computeDistanceTransform(Mat& edges_img, Mat& dis if (dt==-1 || dt>dist) { dist_img.at(ny,nx) = dist; - q.push(make_pair(nx,ny)); + q.push(std::make_pair(nx,ny)); if (&annotate_img!=NULL) { annotate_img.at(ny,nx)[0]=annotate_img.at(y,x)[0]; @@ -1082,7 +1082,7 @@ ChamferMatcher::Match* ChamferMatcher::Matching::localChamferDistance(Point offs float beta = 1-alpha; - vector& addr = tpl->getTemplateAddresses(dist_img.cols); + std::vector& addr = tpl->getTemplateAddresses(dist_img.cols); float* ptr = dist_img.ptr(y)+x; @@ -1271,7 +1271,7 @@ void ChamferMatcher::addMatch(float cost, Point offset, const Template* tpl) void ChamferMatcher::showMatch(Mat& img, int index) { if (index>=count) { - cout << "Index too big.\n" << endl; + std::cout << "Index too big.\n" << std::endl; } assert(img.channels()==3); @@ -1347,7 +1347,7 @@ const ChamferMatcher::Matches& ChamferMatcher::matching(Template& tpl, Mat& imag int chamerMatching( Mat& img, Mat& templ, - vector >& results, vector& costs, + std::vector >& results, std::vector& costs, double templScale, int maxMatches, double minMatchDistance, int padX, int padY, int scales, double minScale, double maxScale, double orientationWeight, double truncate ) @@ -1381,7 +1381,7 @@ int chamerMatching( Mat& img, Mat& templ, costs[i] = (float)cval; const template_coords_t& templ_coords = match.tpl->coords; - vector& templPoints = results[i]; + std::vector& templPoints = results[i]; size_t j, npoints = templ_coords.size(); templPoints.resize(npoints); diff --git a/modules/flann/include/opencv2/flann/autotuned_index.h b/modules/flann/include/opencv2/flann/autotuned_index.h index d5a7876b8..597a080ba 100644 --- a/modules/flann/include/opencv2/flann/autotuned_index.h +++ b/modules/flann/include/opencv2/flann/autotuned_index.h @@ -224,8 +224,8 @@ private: float totalCost; }; - typedef pair KDTreeCostData; - typedef pair KMeansCostData; + typedef std::pair KDTreeCostData; + typedef std::pair KMeansCostData; void evaluate_kmeans(CostData& cost, const KMeansIndexParams& kmeans_params) @@ -338,7 +338,7 @@ private: int kmeansParamSpaceSize = ARRAY_LEN(maxIterations)*ARRAY_LEN(branchingFactors); - vector kmeansCosts(kmeansParamSpaceSize); + std::vector kmeansCosts(kmeansParamSpaceSize); // CostData* kmeansCosts = new CostData[kmeansParamSpaceSize]; @@ -417,7 +417,7 @@ private: int testTrees[] = { 1, 4, 8, 16, 32 }; size_t kdtreeParamSpaceSize = ARRAY_LEN(testTrees); - vector kdtreeCosts(kdtreeParamSpaceSize); + std::vector kdtreeCosts(kdtreeParamSpaceSize); // evaluate kdtree for all parameter combinations int cnt = 0; @@ -484,7 +484,7 @@ private: IndexParams* estimateBuildParams() { int sampleSize = int(index_params.sample_fraction*dataset.rows); - int testSampleSize = min(sampleSize/10, 1000); + int testSampleSize = std::min(sampleSize/10, 1000); logger().info("Entering autotuning, dataset size: %d, sampleSize: %d, testSampleSize: %d\n",dataset.rows, sampleSize, testSampleSize); @@ -550,7 +550,7 @@ private: float speedup = 0; - int samples = (int)min(dataset.rows/10, SAMPLE_COUNT); + int samples = (int)std::min(dataset.rows/10, SAMPLE_COUNT); if (samples>0) { Matrix testDataset = random_sample(dataset,samples); diff --git a/modules/flann/include/opencv2/flann/dist.h b/modules/flann/include/opencv2/flann/dist.h index ef86ba62b..b10a01a7b 100644 --- a/modules/flann/include/opencv2/flann/dist.h +++ b/modules/flann/include/opencv2/flann/dist.h @@ -32,7 +32,6 @@ #define _OPENCV_DIST_H_ #include -using namespace std; #include "opencv2/flann/general.h" diff --git a/modules/flann/include/opencv2/flann/flann_base.hpp b/modules/flann/include/opencv2/flann/flann_base.hpp index 89acd3c55..227f94501 100644 --- a/modules/flann/include/opencv2/flann/flann_base.hpp +++ b/modules/flann/include/opencv2/flann/flann_base.hpp @@ -109,7 +109,7 @@ public: template -NNIndex* load_saved_index(const Matrix& dataset, const string& filename) +NNIndex* load_saved_index(const Matrix& dataset, const std::string& filename) { FILE* fin = fopen(filename.c_str(), "rb"); if (fin==NULL) { @@ -208,7 +208,7 @@ int Index::radiusSearch(const Matrix& query, Matrix& indices, Matrix< // TODO: optimise here int* neighbors = resultSet.getNeighbors(); float* distances = resultSet.getDistances(); - size_t count_nn = min(resultSet.size(), indices.cols); + size_t count_nn = std::min(resultSet.size(), indices.cols); assert (dists.cols>=count_nn); @@ -222,7 +222,7 @@ int Index::radiusSearch(const Matrix& query, Matrix& indices, Matrix< template -void Index::save(string filename) +void Index::save(std::string filename) { FILE* fout = fopen(filename.c_str(), "wb"); if (fout==NULL) { diff --git a/modules/flann/include/opencv2/flann/ground_truth.h b/modules/flann/include/opencv2/flann/ground_truth.h index c9326ba88..cb213246e 100644 --- a/modules/flann/include/opencv2/flann/ground_truth.h +++ b/modules/flann/include/opencv2/flann/ground_truth.h @@ -66,8 +66,8 @@ void find_nearest(const Matrix& dataset, T* query, int* matches, int nn, int int j = dcnt-1; // bubble up while (j>=1 && dists[j] -using namespace std; namespace cvflann { @@ -162,7 +161,7 @@ public: } /* Switch first node with last. */ - swap(heap[1],heap[count]); + std::swap(heap[1],heap[count]); count -= 1; heapify(1); /* Move new node 1 to right position. */ @@ -197,7 +196,7 @@ public: /* If a child was smaller, than swap parent with it and Heapify. */ if (minloc != parent) { - swap(heap[parent],heap[minloc]); + std::swap(heap[parent],heap[minloc]); heapify(minloc); } } diff --git a/modules/flann/include/opencv2/flann/index_testing.h b/modules/flann/include/opencv2/flann/index_testing.h index 5a8ad6ffa..476c2c2c6 100644 --- a/modules/flann/include/opencv2/flann/index_testing.h +++ b/modules/flann/include/opencv2/flann/index_testing.h @@ -41,7 +41,6 @@ #include "opencv2/flann/timer.h" -using namespace std; namespace cvflann { @@ -207,7 +206,7 @@ float test_index_precisions(NNIndex& index, const Matrix& const float SEARCH_EPS = 0.001; // make sure precisions array is sorted - sort(precisions, precisions+precisions_length); + std::sort(precisions, precisions+precisions_length); int pindex = 0; float precision = precisions[pindex]; diff --git a/modules/flann/include/opencv2/flann/kdtree_index.h b/modules/flann/include/opencv2/flann/kdtree_index.h index 81d314573..bf485d33f 100644 --- a/modules/flann/include/opencv2/flann/kdtree_index.h +++ b/modules/flann/include/opencv2/flann/kdtree_index.h @@ -45,8 +45,6 @@ #include "opencv2/flann/random.h" #include "opencv2/flann/saving.h" -using namespace std; - namespace cvflann { @@ -232,7 +230,7 @@ public: /* Randomize the order of vectors to allow for unbiased sampling. */ for (int j = (int)size_; j > 0; --j) { int rnd = rand_int(j); - swap(vind[j-1], vind[rnd]); + std::swap(vind[j-1], vind[rnd]); } trees[i] = divideTree(0, (int)size_ - 1); } @@ -384,7 +382,7 @@ private: /* Compute mean values. Only the first SAMPLE_MEAN values need to be sampled to get a good estimate. */ - int end = min(first + SAMPLE_MEAN, last); + int end = std::min(first + SAMPLE_MEAN, last); for (int j = first; j <= end; ++j) { ELEM_TYPE* v = dataset[vind[j]]; for (size_t k=0; k 0 && v[topind[j]] > v[topind[j-1]]) { - swap(topind[j], topind[j-1]); + std::swap(topind[j], topind[j-1]); --j; } } @@ -459,7 +457,7 @@ private: ++i; } else { /* Move to end of list by swapping vind i and j. */ - swap(vind[i], vind[j]); + std::swap(vind[i], vind[j]); --j; } } @@ -506,7 +504,7 @@ private: int checkCount = 0; Heap* heap = new Heap((int)size_); - vector checked(size_,false); + std::vector checked(size_,false); /* Search once through each tree down to root. */ for (i = 0; i < numTrees; ++i) { @@ -530,7 +528,7 @@ private: * at least "mindistsq". */ void searchLevel(ResultSet& result, const ELEM_TYPE* vec, Tree node, float mindistsq, int& checkCount, int maxCheck, - Heap* heap, vector& checked) + Heap* heap, std::vector& checked) { if (result.worstDist() // Compute the new potential double newPot = 0; for (int i = 0; i < n; i++) - newPot += min( flann_dist(dataset[indices[i]], dataset[indices[i]] + dataset.cols, dataset[indices[index]]), closestDistSq[i] ); + newPot += std::min( flann_dist(dataset[indices[i]], dataset[indices[i]] + dataset.cols, dataset[indices[index]]), closestDistSq[i] ); // Store the best result if (bestNewPot < 0 || newPot < bestNewPot) { @@ -366,7 +364,7 @@ class KMeansIndex : public NNIndex centers[centerCount] = indices[bestNewIndex]; currentPot = bestNewPot; for (int i = 0; i < n; i++) - closestDistSq[i] = min( flann_dist(dataset[indices[i]], dataset[indices[i]]+dataset.cols, dataset[indices[bestNewIndex]]), closestDistSq[i] ); + closestDistSq[i] = std::min( flann_dist(dataset[indices[i]], dataset[indices[i]]+dataset.cols, dataset[indices[bestNewIndex]]), closestDistSq[i] ); } centers_length = centerCount; @@ -402,7 +400,7 @@ public: branching = params.branching; max_iter = params.iterations; if (max_iter<0) { - max_iter = numeric_limits::max(); + max_iter = (std::numeric_limits::max)(); } flann_centers_init_t centersInit = params.centers_init; @@ -711,7 +709,7 @@ private: if (indices_length < branching) { node->indices = indices; - sort(node->indices,node->indices+indices_length); + std::sort(node->indices,node->indices+indices_length); node->childs = NULL; return; } @@ -722,7 +720,7 @@ private: if (centers_lengthindices = indices; - sort(node->indices,node->indices+indices_length); + std::sort(node->indices,node->indices+indices_length); node->childs = NULL; return; } @@ -859,8 +857,8 @@ private: double d = flann_dist(dataset[indices[i]],dataset[indices[i]]+veclen_,zero()); variance += d; mean_radius += sqrt(d); - swap(indices[i],indices[end]); - swap(belongs_to[i],belongs_to[end]); + std::swap(indices[i],indices[end]); + std::swap(belongs_to[i],belongs_to[end]); end++; } } @@ -1072,7 +1070,7 @@ private: float meanVariance = root->variance*root->size; while (clusterCount::max(); + float minVariance = (std::numeric_limits::max)(); int splitIndex = -1; for (int i=0;i #include "opencv2/flann/general.h" -using namespace std; namespace cvflann { diff --git a/modules/flann/include/opencv2/flann/nn_index.h b/modules/flann/include/opencv2/flann/nn_index.h index 8db8980ad..081f9aff6 100644 --- a/modules/flann/include/opencv2/flann/nn_index.h +++ b/modules/flann/include/opencv2/flann/nn_index.h @@ -36,8 +36,6 @@ #include "opencv2/flann/general.h" #include "opencv2/flann/matrix.h" -using namespace std; - namespace cvflann { diff --git a/modules/flann/include/opencv2/flann/random.h b/modules/flann/include/opencv2/flann/random.h index 71d94bdc0..d29a12396 100644 --- a/modules/flann/include/opencv2/flann/random.h +++ b/modules/flann/include/opencv2/flann/random.h @@ -35,7 +35,6 @@ #include #include -using namespace std; namespace cvflann { @@ -109,7 +108,7 @@ public: // int rand = cast(int) (drand48() * n); int rnd = rand_int(i); assert(rnd >=0 && rnd < i); - swap(vals[i-1], vals[rnd]); + std::swap(vals[i-1], vals[rnd]); } counter = 0; diff --git a/modules/flann/include/opencv2/flann/result_set.h b/modules/flann/include/opencv2/flann/result_set.h index 39477b12b..5b1a8e2ad 100644 --- a/modules/flann/include/opencv2/flann/result_set.h +++ b/modules/flann/include/opencv2/flann/result_set.h @@ -37,8 +37,6 @@ #include #include "opencv2/flann/dist.h" -using namespace std; - namespace cvflann { @@ -181,8 +179,8 @@ public: // bubble up while (i>=1 && (dists[i]=1 && (dists[i]::max() : dists[count-1]; + return (count::max)() : dists[count-1]; } }; @@ -215,7 +213,7 @@ class RadiusResultSet : public ResultSet } }; - vector items; + std::vector items; float radius; bool sorted; diff --git a/modules/flann/include/opencv2/flann/sampling.h b/modules/flann/include/opencv2/flann/sampling.h index e0ce5532a..95f6e150c 100644 --- a/modules/flann/include/opencv2/flann/sampling.h +++ b/modules/flann/include/opencv2/flann/sampling.h @@ -56,7 +56,7 @@ Matrix random_sample(Matrix& srcMatrix, long size, bool remove = false) dest = srcMatrix[srcMatrix.rows-i-1]; src = srcMatrix[r]; for (size_t j=0;j class GCGraph { public: @@ -76,8 +74,8 @@ private: TWeight weight; }; - vector vtcs; - vector edges; + std::vector vtcs; + std::vector edges; TWeight flow; }; @@ -158,7 +156,7 @@ TWeight GCGraph::maxFlow() Vtx *vtxPtr = &vtcs[0]; Edge *edgePtr = &edges[0]; - vector orphans; + std::vector orphans; // initialize the active queue and the graph vertices for( int i = 0; i < (int)vtcs.size(); i++ ) diff --git a/samples/gpu/driver_api_multi.cpp b/samples/gpu/driver_api_multi.cpp index 8b2471c70..9c086608f 100644 --- a/samples/gpu/driver_api_multi.cpp +++ b/samples/gpu/driver_api_multi.cpp @@ -16,11 +16,11 @@ int main() { #if !defined(HAVE_CUDA) - cout << "CUDA support is required (CMake key 'WITH_CUDA' must be true).\n"; + std::cout << "CUDA support is required (CMake key 'WITH_CUDA' must be true).\n"; #endif #if !defined(HAVE_TBB) - cout << "TBB support is required (CMake key 'WITH_TBB' must be true).\n"; + std::cout << "TBB support is required (CMake key 'WITH_TBB' must be true).\n"; #endif return 0; @@ -44,7 +44,7 @@ inline void safeCall_(int code, const char* expr, const char* file, int line) { if (code != CUDA_SUCCESS) { - cout << "CUDA driver API error: code " << code << ", expr " << expr + std::cout << "CUDA driver API error: code " << code << ", expr " << expr << ", file " << file << ", line " << line << endl; destroyContexts(); exit(-1); @@ -59,7 +59,7 @@ int main() int num_devices = getCudaEnabledDeviceCount(); if (num_devices < 2) { - cout << "Two or more GPUs are required\n"; + std::cout << "Two or more GPUs are required\n"; return -1; } @@ -68,7 +68,7 @@ int main() DeviceInfo dev_info(i); if (!dev_info.isCompatible()) { - cout << "GPU module isn't built for GPU #" << i << " (" + std::cout << "GPU module isn't built for GPU #" << i << " (" << dev_info.name() << ", CC " << dev_info.majorVersion() << dev_info.minorVersion() << "\n"; return -1; @@ -122,7 +122,7 @@ void Worker::operator()(int device_id) const // Check results bool passed = norm(dst - Mat(d_dst), NORM_INF) < 1e-3; - cout << "GPU #" << device_id << " (" << DeviceInfo().name() << "): " + std::cout << "GPU #" << device_id << " (" << DeviceInfo().name() << "): " << (passed ? "passed" : "FAILED") << endl; // Deallocate data here, otherwise deallocation will be performed diff --git a/samples/gpu/driver_api_stereo_multi.cpp b/samples/gpu/driver_api_stereo_multi.cpp index 5c39f5aa7..b8d1807e2 100644 --- a/samples/gpu/driver_api_stereo_multi.cpp +++ b/samples/gpu/driver_api_stereo_multi.cpp @@ -18,11 +18,11 @@ int main() { #if !defined(HAVE_CUDA) - cout << "CUDA support is required (CMake key 'WITH_CUDA' must be true).\n"; + std::cout << "CUDA support is required (CMake key 'WITH_CUDA' must be true).\n"; #endif #if !defined(HAVE_TBB) - cout << "TBB support is required (CMake key 'WITH_TBB' must be true).\n"; + std::cout << "TBB support is required (CMake key 'WITH_TBB' must be true).\n"; #endif return 0; @@ -46,7 +46,7 @@ inline void safeCall_(int code, const char* expr, const char* file, int line) { if (code != CUDA_SUCCESS) { - cout << "CUDA driver API error: code " << code << ", expr " << expr + std::cout << "CUDA driver API error: code " << code << ", expr " << expr << ", file " << file << ", line " << line << endl; destroyContexts(); exit(-1); @@ -80,14 +80,14 @@ int main(int argc, char** argv) { if (argc < 3) { - cout << "Usage: stereo_multi_gpu \n"; + std::cout << "Usage: stereo_multi_gpu \n"; return -1; } int num_devices = getCudaEnabledDeviceCount(); if (num_devices < 2) { - cout << "Two or more GPUs are required\n"; + std::cout << "Two or more GPUs are required\n"; return -1; } @@ -96,7 +96,7 @@ int main(int argc, char** argv) DeviceInfo dev_info(i); if (!dev_info.isCompatible()) { - cout << "GPU module isn't built for GPU #" << i << " (" + std::cout << "GPU module isn't built for GPU #" << i << " (" << dev_info.name() << ", CC " << dev_info.majorVersion() << dev_info.minorVersion() << "\n"; return -1; @@ -108,12 +108,12 @@ int main(int argc, char** argv) Mat right = imread(argv[2], CV_LOAD_IMAGE_GRAYSCALE); if (left.empty()) { - cout << "Cannot open '" << argv[1] << "'\n"; + std::cout << "Cannot open '" << argv[1] << "'\n"; return -1; } if (right.empty()) { - cout << "Cannot open '" << argv[2] << "'\n"; + std::cout << "Cannot open '" << argv[2] << "'\n"; return -1; } @@ -180,7 +180,7 @@ void Worker::operator()(int device_id) const bm[device_id]->operator()(d_left[device_id], d_right[device_id], d_result[device_id]); - cout << "GPU #" << device_id << " (" << DeviceInfo().name() + std::cout << "GPU #" << device_id << " (" << DeviceInfo().name() << "): finished\n"; contextOff(); diff --git a/samples/gpu/multi.cpp b/samples/gpu/multi.cpp index e02a4900d..06564b400 100644 --- a/samples/gpu/multi.cpp +++ b/samples/gpu/multi.cpp @@ -16,11 +16,11 @@ int main() { #if !defined(HAVE_CUDA) - cout << "CUDA support is required (CMake key 'WITH_CUDA' must be true).\n"; + std::cout << "CUDA support is required (CMake key 'WITH_CUDA' must be true).\n"; #endif #if !defined(HAVE_TBB) - cout << "TBB support is required (CMake key 'WITH_TBB' must be true).\n"; + std::cout << "TBB support is required (CMake key 'WITH_TBB' must be true).\n"; #endif return 0; @@ -43,7 +43,7 @@ int main() int num_devices = getCudaEnabledDeviceCount(); if (num_devices < 2) { - cout << "Two or more GPUs are required\n"; + std::cout << "Two or more GPUs are required\n"; return -1; } for (int i = 0; i < num_devices; ++i) @@ -51,7 +51,7 @@ int main() DeviceInfo dev_info(i); if (!dev_info.isCompatible()) { - cout << "GPU module isn't built for GPU #" << i << " (" + std::cout << "GPU module isn't built for GPU #" << i << " (" << dev_info.name() << ", CC " << dev_info.majorVersion() << dev_info.minorVersion() << "\n"; return -1; @@ -88,7 +88,7 @@ void Worker::operator()(int device_id) const // Check results bool passed = norm(dst - Mat(d_dst), NORM_INF) < 1e-3; - cout << "GPU #" << device_id << " (" << DeviceInfo().name() << "): " + std::cout << "GPU #" << device_id << " (" << DeviceInfo().name() << "): " << (passed ? "passed" : "FAILED") << endl; // Deallocate data here, otherwise deallocation will be performed diff --git a/samples/gpu/stereo_multi.cpp b/samples/gpu/stereo_multi.cpp index 54dcf3b6e..3ad3347c8 100644 --- a/samples/gpu/stereo_multi.cpp +++ b/samples/gpu/stereo_multi.cpp @@ -18,11 +18,11 @@ int main() { #if !defined(HAVE_CUDA) - cout << "CUDA support is required (CMake key 'WITH_CUDA' must be true).\n"; + std::cout << "CUDA support is required (CMake key 'WITH_CUDA' must be true).\n"; #endif #if !defined(HAVE_TBB) - cout << "TBB support is required (CMake key 'WITH_TBB' must be true).\n"; + std::cout << "TBB support is required (CMake key 'WITH_TBB' must be true).\n"; #endif return 0; @@ -53,14 +53,14 @@ int main(int argc, char** argv) { if (argc < 3) { - cout << "Usage: stereo_multi_gpu \n"; + std::cout << "Usage: stereo_multi_gpu \n"; return -1; } int num_devices = getCudaEnabledDeviceCount(); if (num_devices < 2) { - cout << "Two or more GPUs are required\n"; + std::cout << "Two or more GPUs are required\n"; return -1; } for (int i = 0; i < num_devices; ++i) @@ -68,7 +68,7 @@ int main(int argc, char** argv) DeviceInfo dev_info(i); if (!dev_info.isCompatible()) { - cout << "GPU module isn't built for GPU #" << i << " (" + std::cout << "GPU module isn't built for GPU #" << i << " (" << dev_info.name() << ", CC " << dev_info.majorVersion() << dev_info.minorVersion() << "\n"; return -1; @@ -80,12 +80,12 @@ int main(int argc, char** argv) Mat right = imread(argv[2], CV_LOAD_IMAGE_GRAYSCALE); if (left.empty()) { - cout << "Cannot open '" << argv[1] << "'\n"; + std::cout << "Cannot open '" << argv[1] << "'\n"; return -1; } if (right.empty()) { - cout << "Cannot open '" << argv[2] << "'\n"; + std::cout << "Cannot open '" << argv[2] << "'\n"; return -1; } @@ -139,7 +139,7 @@ void Worker::operator()(int device_id) const bm[device_id]->operator()(d_left[device_id], d_right[device_id], d_result[device_id]); - cout << "GPU #" << device_id << " (" << DeviceInfo().name() + std::cout << "GPU #" << device_id << " (" << DeviceInfo().name() << "): finished\n"; multi_gpu_mgr.gpuOff(); diff --git a/tests/ml/src/mltest.h b/tests/ml/src/mltest.h index cbca56809..c7ed83d18 100644 --- a/tests/ml/src/mltest.h +++ b/tests/ml/src/mltest.h @@ -55,7 +55,6 @@ #include #include -using namespace std; using namespace cv; #define CV_NBAYES "nbayes" @@ -83,13 +82,13 @@ protected: virtual int validate_test_results( int testCaseIdx ) = 0; int train( int testCaseIdx ); - float get_error( int testCaseIdx, int type, vector *resp = 0 ); + float get_error( int testCaseIdx, int type, std::vector *resp = 0 ); void save( const char* filename ); void load( const char* filename ); CvMLData data; string modelName, validationFN; - vector dataSetNames; + std::vector dataSetNames; FileStorage validationFS; // MLL models @@ -103,7 +102,7 @@ protected: CvRTrees* rtrees; CvERTrees* ertrees; - map cls_map; + std::map cls_map; int64 initSeed; }; @@ -125,7 +124,7 @@ protected: virtual int run_test_case( int testCaseIdx ); virtual int validate_test_results( int testCaseIdx ); - vector test_resps1, test_resps2; // predicted responses for test data + std::vector test_resps1, test_resps2; // predicted responses for test data char fname1[50], fname2[50]; };