From 042271f5f7914f5cef5baf76fa21328721c428b3 Mon Sep 17 00:00:00 2001 From: Vadim Pisarevsky Date: Fri, 26 Nov 2010 17:59:40 +0000 Subject: [PATCH] use the new-style headers in the samples to improve OpenCV build time. --- samples/c/adaptiveskindetector.cpp | 4 +- samples/c/bgfg_codebook.cpp | 9 +- samples/c/bgfg_segm.cpp | 5 +- samples/c/blobtrack_sample.cpp | 7 +- samples/c/calibration_artificial.cpp | 5 +- samples/c/camshiftdemo.c | 11 +- samples/c/contours.c | 13 +- samples/c/convert_cascade.c | 12 +- samples/c/convexhull.c | 13 +- samples/c/delaunay.c | 13 +- samples/c/demhist.c | 13 +- samples/c/dft.c | 7 +- samples/c/distrans.c | 11 +- samples/c/drawing.c | 14 +- samples/c/edge.c | 12 +- samples/c/facedetect.cpp | 12 +- samples/c/fback.cpp | 7 +- samples/c/fback_c.c | 6 +- samples/c/ffilldemo.c | 14 +- samples/c/find_obj.cpp | 11 +- samples/c/find_obj_ferns.cpp | 7 +- samples/c/fitellipse.cpp | 12 +- samples/c/houghlines.c | 9 +- samples/c/image.cpp | 644 ++++++++++++++++++++++- samples/c/inpaint.cpp | 10 +- samples/c/kalman.c | 13 +- samples/c/kmeans.c | 13 +- samples/c/laplace.c | 11 +- samples/c/latentsvmdetect.cpp | 7 +- samples/c/letter_recog.cpp | 4 +- samples/c/lkdemo.c | 16 +- samples/c/minarea.c | 13 +- samples/c/morphology.c | 8 +- samples/c/motempl.c | 17 +- samples/c/mser_sample.cpp | 64 ++- samples/c/mushroom.cpp | 3 +- samples/c/one_way_sample.cpp | 7 +- samples/c/peopledetect.cpp | 6 +- samples/c/polar_transforms.c | 12 +- samples/c/pyramid_segmentation.c | 13 +- samples/c/squares.c | 10 +- samples/c/stereo_calib.cpp | 7 +- samples/c/stereo_match.cpp | 6 +- samples/c/tree_engine.cpp | 2 +- samples/c/watershed.cpp | 10 +- samples/cpp/3calibration.cpp | 5 +- samples/cpp/brief_match_test.cpp | 5 +- samples/cpp/connected_components.cpp | 6 +- samples/cpp/contours2.cpp | 5 +- samples/cpp/generic_descriptor_match.cpp | 1 + samples/cpp/morphology2.cpp | 4 +- samples/cpp/segment_objects.cpp | 5 +- samples/cpp/starter_imagelist.cpp | 3 +- samples/cpp/starter_video.cpp | 3 +- samples/cpp/video_homography.cpp | 5 +- 55 files changed, 795 insertions(+), 370 deletions(-) diff --git a/samples/c/adaptiveskindetector.cpp b/samples/c/adaptiveskindetector.cpp index b036c286a5..d35c607b6d 100644 --- a/samples/c/adaptiveskindetector.cpp +++ b/samples/c/adaptiveskindetector.cpp @@ -39,8 +39,8 @@ #include #include #include -#include -#include +#include +#include class ASDFrameHolder { diff --git a/samples/c/bgfg_codebook.cpp b/samples/c/bgfg_codebook.cpp index 7a811c7537..27c0b7802a 100644 --- a/samples/c/bgfg_codebook.cpp +++ b/samples/c/bgfg_codebook.cpp @@ -21,13 +21,14 @@ ISBN-10: 0596516134 or: ISBN-13: 978-0596516130 ************************************************** */ -#include "cvaux.h" -#include "cxmisc.h" -#include "highgui.h" #include #include #include +#include +#include +#include + //VARIABLES for CODEBOOK METHOD: CvBGCodeBookModel* model = 0; const int NCHANNELS = 3; @@ -220,7 +221,7 @@ int main(int argc, char** argv) if( ch[n] ) { int v = ptr[n] + (c == 'i' || c == 'l' ? 1 : -1); - ptr[n] = CV_CAST_8U(v); + ptr[n] = cv::saturate_cast(v); } printf("%d,", ptr[n]); } diff --git a/samples/c/bgfg_segm.cpp b/samples/c/bgfg_segm.cpp index 348f48e2eb..b8d7bdcadb 100644 --- a/samples/c/bgfg_segm.cpp +++ b/samples/c/bgfg_segm.cpp @@ -1,5 +1,6 @@ -#include "cvaux.h" -#include "highgui.h" +#include +#include + #include //this is a sample for foreground detection functions diff --git a/samples/c/blobtrack_sample.cpp b/samples/c/blobtrack_sample.cpp index 88f6afd53d..b0217f12e2 100644 --- a/samples/c/blobtrack_sample.cpp +++ b/samples/c/blobtrack_sample.cpp @@ -1,5 +1,8 @@ -#include "cvaux.h" -#include "highgui.h" +#include +#include +#include +#include + #include /* Select appropriate case insensitive string comparison function: */ diff --git a/samples/c/calibration_artificial.cpp b/samples/c/calibration_artificial.cpp index 07b5c646d9..7757dfe71c 100644 --- a/samples/c/calibration_artificial.cpp +++ b/samples/c/calibration_artificial.cpp @@ -3,8 +3,9 @@ #include #include -#include "cv.h" -#include "highgui.h" +#include +#include +#include using namespace cv; using namespace std; diff --git a/samples/c/camshiftdemo.c b/samples/c/camshiftdemo.c index 94e3c447b2..02bd96d194 100644 --- a/samples/c/camshiftdemo.c +++ b/samples/c/camshiftdemo.c @@ -1,15 +1,8 @@ -#ifdef _CH_ -#pragma package -#endif - -#define CV_NO_BACKWARD_COMPATIBILITY +#include +#include -#ifndef _EiC -#include "cv.h" -#include "highgui.h" #include #include -#endif IplImage *image = 0, *hsv = 0, *hue = 0, *mask = 0, *backproject = 0, *histimg = 0; CvHistogram *hist = 0; diff --git a/samples/c/contours.c b/samples/c/contours.c index 7c9fdb4f51..4af2d2a0c2 100644 --- a/samples/c/contours.c +++ b/samples/c/contours.c @@ -1,14 +1,5 @@ -#ifdef _CH_ -#pragma package -#endif - -#define CV_NO_BACKWARD_COMPATIBILITY - -#ifndef _EiC -#include "cv.h" -#include "highgui.h" -#include -#endif +#include +#include #define w 500 int levels = 3; diff --git a/samples/c/convert_cascade.c b/samples/c/convert_cascade.c index ff20b03cad..51e9b4961f 100644 --- a/samples/c/convert_cascade.c +++ b/samples/c/convert_cascade.c @@ -1,14 +1,8 @@ -#ifdef _CH_ -#pragma package -#endif - -#define CV_NO_BACKWARD_COMPATIBILITY +#include +#include -#ifndef _EiC -#include "cv.h" -#include "highgui.h" +#include #include -#endif int main( int argc, char** argv ) { diff --git a/samples/c/convexhull.c b/samples/c/convexhull.c index 19d6ee12d3..3e4321190c 100644 --- a/samples/c/convexhull.c +++ b/samples/c/convexhull.c @@ -1,14 +1,5 @@ -#ifdef _CH_ -#pragma package -#endif - -#define CV_NO_BACKWARD_COMPATIBILITY - -#ifndef _EiC -#include "cv.h" -#include "highgui.h" -#include -#endif +#include +#include #define ARRAY 1 diff --git a/samples/c/delaunay.c b/samples/c/delaunay.c index a30affc3c4..3177d0ee68 100644 --- a/samples/c/delaunay.c +++ b/samples/c/delaunay.c @@ -1,14 +1,5 @@ -#ifdef _CH_ -#pragma package -#endif - -#define CV_NO_BACKWARD_COMPATIBILITY - -#ifndef _EiC -#include "cv.h" -#include "highgui.h" -#include -#endif +#include +#include /* the script demostrates iterative construction of delaunay triangulation and voronoi tesselation */ diff --git a/samples/c/demhist.c b/samples/c/demhist.c index 22e9ea6395..5ef2d24864 100644 --- a/samples/c/demhist.c +++ b/samples/c/demhist.c @@ -1,14 +1,5 @@ -#ifdef _CH_ -#pragma package -#endif - -#define CV_NO_BACKWARD_COMPATIBILITY - -#ifndef _EiC -#include "cv.h" -#include "highgui.h" -#include -#endif +#include +#include char file_name[] = "baboon.jpg"; diff --git a/samples/c/dft.c b/samples/c/dft.c index b34a9be705..22ecf07cfd 100644 --- a/samples/c/dft.c +++ b/samples/c/dft.c @@ -1,8 +1,5 @@ -#define CV_NO_BACKWARD_COMPATIBILITY - -#include -#include -#include +#include +#include // Rearrange the quadrants of Fourier image so that the origin is at // the image center diff --git a/samples/c/distrans.c b/samples/c/distrans.c index 497ead085b..0bc66fc496 100644 --- a/samples/c/distrans.c +++ b/samples/c/distrans.c @@ -1,12 +1,5 @@ -#define CV_NO_BACKWARD_COMPATIBILITY - -#ifdef _CH_ -#pragma package -#endif - -#include "cv.h" -#include "highgui.h" -#include +#include +#include char wndname[] = "Distance transform"; char tbarname[] = "Threshold"; diff --git a/samples/c/drawing.c b/samples/c/drawing.c index 6ce2066535..f6da5684a5 100644 --- a/samples/c/drawing.c +++ b/samples/c/drawing.c @@ -1,15 +1,5 @@ -#ifdef _CH_ -#pragma package -#endif - -#define CV_NO_BACKWARD_COMPATIBILITY - -#ifndef _EiC -#include "cv.h" -#include "highgui.h" -#include -#include -#endif +#include +#include #define NUMBER 100 #define DELAY 5 diff --git a/samples/c/edge.c b/samples/c/edge.c index dbf4b7aa01..125147ce36 100644 --- a/samples/c/edge.c +++ b/samples/c/edge.c @@ -1,13 +1,5 @@ -#ifdef _CH_ -#pragma package -#endif - -#define CV_NO_BACKWARD_COMPATIBILITY - -#ifndef _EiC -#include "cv.h" -#include "highgui.h" -#endif +#include +#include char wndname[] = "Edge"; char tbarname[] = "Threshold"; diff --git a/samples/c/facedetect.cpp b/samples/c/facedetect.cpp index d96b5a9488..b5dad77be0 100644 --- a/samples/c/facedetect.cpp +++ b/samples/c/facedetect.cpp @@ -1,14 +1,8 @@ -#define CV_NO_BACKWARD_COMPATIBILITY - -#include "cv.h" -#include "highgui.h" +#include +#include +#include #include -#include - -#ifdef _EiC -#define WIN32 -#endif using namespace std; using namespace cv; diff --git a/samples/c/fback.cpp b/samples/c/fback.cpp index d89f3b637f..57643fc596 100644 --- a/samples/c/fback.cpp +++ b/samples/c/fback.cpp @@ -1,7 +1,6 @@ -#undef _GLIBCXX_DEBUG - -#include "cv.h" -#include "highgui.h" +#include +#include +#include using namespace cv; diff --git a/samples/c/fback_c.c b/samples/c/fback_c.c index e058f16bd1..ce6b7c022a 100644 --- a/samples/c/fback_c.c +++ b/samples/c/fback_c.c @@ -1,7 +1,5 @@ -#undef _GLIBCXX_DEBUG - -#include "cv.h" -#include "highgui.h" +#include +#include void drawOptFlowMap(const CvMat* flow, CvMat* cflowmap, int step, double scale, CvScalar color) diff --git a/samples/c/ffilldemo.c b/samples/c/ffilldemo.c index a049a4aa6e..d65064af75 100644 --- a/samples/c/ffilldemo.c +++ b/samples/c/ffilldemo.c @@ -1,15 +1,5 @@ -#ifdef _CH_ -#pragma package -#endif - -#define CV_NO_BACKWARD_COMPATIBILITY - -#ifndef _EiC -#include "cv.h" -#include "highgui.h" -#include -#include -#endif +#include +#include IplImage* color_img0; IplImage* mask; diff --git a/samples/c/find_obj.cpp b/samples/c/find_obj.cpp index 134138c58a..5ff4b20390 100644 --- a/samples/c/find_obj.cpp +++ b/samples/c/find_obj.cpp @@ -4,12 +4,11 @@ * Author: Liu Liu * liuliu.1987+opencv@gmail.com */ - -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include diff --git a/samples/c/find_obj_ferns.cpp b/samples/c/find_obj_ferns.cpp index a222dcf528..eca24263e6 100644 --- a/samples/c/find_obj_ferns.cpp +++ b/samples/c/find_obj_ferns.cpp @@ -1,6 +1,7 @@ -#include -#include -#include +#include "opencv2/highgui/highgui.hpp" +#include "opencv2/core/core.hpp" +#include "opencv2/imgproc/imgproc.hpp" +#include "opencv2/features2d/features2d.hpp" #include #include diff --git a/samples/c/fitellipse.cpp b/samples/c/fitellipse.cpp index aa8d59286b..190204c5d3 100644 --- a/samples/c/fitellipse.cpp +++ b/samples/c/fitellipse.cpp @@ -14,16 +14,8 @@ * * ********************************************************************************/ -#ifdef _CH_ -#pragma package -#endif - -#define CV_NO_BACKWARD_COMPATIBILITY - -#ifndef _EiC -#include "cv.h" -#include "highgui.h" -#endif +#include "opencv2/imgproc/imgproc_c.h" +#include "opencv2/highgui/highgui.hpp" int slider_pos = 70; diff --git a/samples/c/houghlines.c b/samples/c/houghlines.c index 5ea8dfb481..9ab0c2c8fa 100644 --- a/samples/c/houghlines.c +++ b/samples/c/houghlines.c @@ -1,10 +1,5 @@ -#define CV_NO_BACKWARD_COMPATIBILITY - -/* This is a standalone program. Pass an image name as a first parameter of the program. - Switch between standard and probabilistic Hough transform by changing "#if 1" to "#if 0" and back */ -#include -#include -#include +#include "opencv2/highgui/highgui.hpp" +#include "opencv2/imgproc/imgproc.hpp" int main(int argc, char** argv) { diff --git a/samples/c/image.cpp b/samples/c/image.cpp index 8dda8522ad..6be2d66ac3 100644 --- a/samples/c/image.cpp +++ b/samples/c/image.cpp @@ -1,8 +1,28 @@ #include "cv.h" // include standard OpenCV headers, same as before #include "highgui.h" +#include "ml.h" #include +#include +#include using namespace cv; // all the new API is put into "cv" namespace. Export its content +using namespace std; +using namespace cv::flann; + +#define RAD2DEG 57.295779513082321 +void print32FMat(const CvMat&mat) +{ + float *data = mat.data.fl; + + for (int r = 0; r < mat.rows; ++r) + { + for (int c = 0; c < mat.cols; ++c) + { + printf("%+1.9f\t", data[r*mat.cols+c]); + } + printf("\n"); + } +} #if 0 @@ -114,26 +134,610 @@ int main( int argc, char** argv ) int main(int argc, char *argv[]) { - Mat im(160, 160, CV_32F); - randu(im, Scalar(0.0), Scalar(1.0)); - Mat dd = Mat::zeros(17,1,CV_32F); - Mat lp = Mat::zeros(17,1,CV_32F); - dd.at(0) = 0.5; - dd.at(16) = -0.5; - lp.at(0) = 0.5; - lp.at(16) = 0.5; - int p = 16; - Mat H = dd*lp.t(); - Mat imcrop(im, Rect(17, 17, im.cols-2*p, im.rows-2*p)); - Mat out1, out2; - filter2D(imcrop, out1, CV_32F, H, Point(-1,-1)); - sepFilter2D(imcrop, out2, CV_32F, lp, dd, Point(-1,-1)); - Mat temp; - out1.convertTo(temp, CV_16U, 65535.0, 32768.0); - imshow("filtered1.png", temp); - out2.convertTo(temp, CV_16U, 65535.0, 32768.0); - imshow("filtered2.png", temp); - waitKey(); + /*double a = 56004.409155979447; + double b = -15158.994132169822; + double c = 215540.83745481662; + + { + double A[4]; + double InvA[4]; + CvMat matA, matInvA; + + A[0] = a; + A[1] = A[2] = b; + A[3] = c; + + cvInitMatHeader( &matA, 2, 2, CV_64F, A ); + cvInitMatHeader( &matInvA, 2, 2, CV_64FC1, InvA ); + + cvInvert( &matA, &matInvA, CV_SVD ); + + printf("%g\t%g\n%g\t%g\n", InvA[0], InvA[1], InvA[2], InvA[3]); + }*/ + + //Mat img = imread("/Users/vp/work/ocv/opencv/samples/c/left04.jpg", 1); + //Vec v; + + /*Mat img = Mat::zeros(20, 20, CV_8U); + img(Range(0,10),Range(0,10)) = Scalar(255); + img.at(10,10)=255; + img(Range(11,20),Range(11,20)) = Scalar(255); + vector corner(1, Point2f(9.5,9.5)); + cornerSubPix(img, corner, Size(5,5), Size(-1,-1), TermCriteria(3, 30, 0.001)); + printf("Corner at (%g, %g)", corner[0].x, corner[0].y);*/ + + /*Mat large, large2, gray; + resize(img, large, img.size()*3, 0, 0, CV_INTER_LANCZOS4); + cvtColor(large, gray, CV_BGR2GRAY); + vector corners; + bool found = findChessboardCorners(gray, Size(9,6), corners); + cornerSubPix(gray, corners, Size(11,11), Size(-1,-1), + TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 30, 0.01)); + + drawChessboardCorners(large, Size(9,6), Mat(corners), false); + //rectangle(img, Point(150,100), Point(250,200), Scalar(0,255,0), 1); + resize(large(Rect(150*3,100*3,100*3,100*3)), large2, Size(), 4, 4, CV_INTER_CUBIC); + imshow("test", large2); + waitKey(0);*/ + + /*int N=4; + CvEM em_model; + CvEMParams params; + int nsamples=500; + for (int D=2; D < 15; D++) + { + CvMat* samples = cvCreateMat( nsamples, D, CV_32FC1 ); + for (int s=0; s < nsamples;s++) + for (int d=0; d > objectPoints; + vector >imagePoints; + cv::FileStorage f("/Users/vp/Downloads/calib_debug.2.yml",cv::FileStorage::READ); + cv::FileNodeIterator it = f["img_sz"].begin(); it >> imageSize.width >> imageSize.height; + Nimg = (int) f ["NofImages"]; + Npts = (int) f["NofPoints"]; + for (int i=0; i ov; + vector iv; + for (int j=0; j> op.x >> op.y >> op.z; + cv::FileNodeIterator it = pnt["imgPnt"].begin(); it >> ip.x >> ip.y; + iv.push_back(ip); + ov.push_back(op); + } + imagePoints.push_back(iv); + objectPoints.push_back(ov); + } + cv::Mat M,D; + vector R,T; + cv::calibrateCamera(objectPoints, imagePoints, imageSize, M, D,R,T, + CV_CALIB_FIX_ASPECT_RATIO + 1*CV_CALIB_FIX_K3 + 1*CV_CALIB_ZERO_TANGENT_DIST); + cv::FileStorage fo("calib_output.yml",cv::FileStorage::WRITE); + //fo << "M" << M; + cout << "M: " << M;*/ + + /*Mat img = imread("/Users/vp/Downloads/test5.tif", CV_LOAD_IMAGE_ANYDEPTH|CV_LOAD_IMAGE_COLOR), img16; + cout << "img.depth()=" << img.depth() << endl; + if(img.depth() == CV_16U) + img16 = img; + else + img.convertTo(img16, CV_16U, 256, 0); + imshow("test", img16); + imwrite("/Users/vp/tmp/test16_2.png", img16); + waitKey();*/ + + /*Mat img(600,800,CV_8UC3); + img = Scalar::all(0); + IplImage _img = img; + + CvFont font = cvFont(2,1); + cvPutText(&_img, "Test", cvPoint(100, 100), &font, cvScalar(0,0,255)); + + imshow("test", img); + waitKey();*/ + + /*IplImage* img = cvCreateImage(cvSize(800,600), 8, 3); + cvZero(img); + CvFont font = cvFont(2,1); + cvPutText(img, "Test", cvPoint(100, 100), &font, cvScalar(0,0,255)); + cvNamedWindow("test", 1); + cvShowImage("test", img); + cvWaitKey(0);*/ + /*int sz[] = {1, 5, 5}; + CvMatND* src = cvCreateMatND(3, sz, CV_64F); + CvMatND* dst = cvCreateMatND(3, sz, CV_64F); + CvRNG rng = cvRNG(-1); + cvRandArr(&rng, src, CV_RAND_UNI, cvScalarAll(-100), cvScalarAll(100)); + cvAddS(src, cvScalar(100), dst, 0); + cvSave("_input.xml", src); + cvSave("_output.xml", dst);*/ + + /* + /// random data generation : + Mat data(100,10,CV_32FC1); + randn(data, 0.0, 1.0); + /// Creating the ANN engine + AutotunedIndexParams autoParams(0.9,0.5,0.2,1); + Index index(data,autoParams); + /// Creating a query + SearchParams searchParams(5); + vector query, dist; + vector foundIndice; + foundIndice.push_back(0); + dist.push_back(0); + for(int i = 0 ; i < 10 ; i++) + { + query.push_back(data.at(2,i)); + } + /// Do a reaserch : result must be equal to 2. + index.knnSearch(query, foundIndice, dist, 1, searchParams); + cout << "Found indice (must be 2) : " << foundIndice[0] << endl; + /// save params + index.save(string("test")); + */ + + /*namedWindow("orig", CV_WINDOW_AUTOSIZE); + namedWindow("canny", CV_WINDOW_AUTOSIZE); + namedWindow("hough", CV_WINDOW_AUTOSIZE); + + Mat orig = cv::imread("/Users/vp/Downloads/1.jpg", 0); + //equalizeHist(orig, orig); + Mat hough; + cvtColor(orig, hough, CV_GRAY2BGR); + + Mat canny; + Canny(orig, canny, 100, 50); // reproduce Canny-Filtering as in Hough-Circles + + int bestRad = 20; + int minRad = bestRad / 1.3; + int maxRad = bestRad * 1.3; + + vector circles; // detect circles + HoughCircles(orig, circles, CV_HOUGH_GRADIENT, + 1, // accu-scaling + 20, // minDist + 100, // CannyParam + 10, // minAccuCount + minRad, + maxRad); + // Draw Circles into image in gray + for( size_t i = 0; i < circles.size(); i++ ) + { + Point center(cvRound(circles[i][0]), cvRound(circles[i][1])); + int radius = cvRound(circles[i][2]); + // draw the circle center + circle( hough, center, 3, Scalar(0,0,255), -1, 8, 0 ); + // draw the circle outline + circle( hough, center, radius, Scalar(0,255,255), 1, 8, 0 ); + } + + // Draw reference circles + Point c(bestRad * 3, bestRad * 3); + circle(hough, c, bestRad, 255); + circle(hough, c, minRad, 255); + circle(hough, c, maxRad, 255); + + + + cv::imshow("orig", orig); + cv::imshow("canny", canny); + cv::imshow("hough", hough); + + cv::waitKey();*/ + + /*int npoints = 4; + CvMat *OP = cvCreateMat(1, npoints, CV_32FC3); + CvPoint3D32f *op = (CvPoint3D32f *)OP->data.fl; + + CvMat *OP2 = cvCreateMat(1, npoints, CV_32FC3); + CvPoint3D32f *op2 = (CvPoint3D32f *)OP2->data.fl; + + CvMat *IP = cvCreateMat(1, npoints, CV_32FC2); + CvPoint2D32f *ip = (CvPoint2D32f *)IP->data.fl; + + CvMat *IP2 = cvCreateMat(1, npoints, CV_32FC2); + CvPoint2D32f *ip2 = (CvPoint2D32f *)IP2->data.fl; + + CvMat *IP0 = cvCreateMat(1, npoints, CV_32FC2); + + float rv[3], rv2[3]; + float rotMat[9]; + float t[3], t2[3]; + float tRotMat[16]; + + double kMat[9]; + + CvMat K = cvMat(3, 3, CV_64F, kMat); + CvMat T = cvMat(3, 1, CV_32F, t); + CvMat RV = cvMat(3, 1, CV_32F, rv); + CvMat T2 = cvMat(3, 1, CV_32F, t2); + CvMat RV2 = cvMat(3, 1, CV_32F, rv2); + CvMat R = cvMat(3, 3, CV_32F, rotMat); + + float r0, r1, r2; + + kMat[0] = 659.88; + kMat[1] = 0.00; + kMat[2] = 320.40; + kMat[3] = 0.00; + kMat[4] = 657.53; + kMat[5] = 240.98; + kMat[6] = 0.00; + kMat[7] = 0.00; + kMat[8] = 1.00; + + ip[0].x = 277.56; ip[0].y = 184.03; + ip[1].x = 329.00; ip[1].y = 199.04; + ip[2].x = 405.96; ip[2].y = 205.96; + ip[3].x = 364.00; ip[3].y = 187.97; + + op[0].x = -189.00; op[0].y = 171.00; + op[1].x = -280.00; op[1].y = 265.00; + op[2].x = -436.00; op[2].y = 316.00; + op[3].x = -376.00; op[3].y = 209.00; + + ip2[0].x = 277.56; ip2[0].y = 184.03; + ip2[1].x = 328.00; ip2[1].y = 199.11; + ip2[2].x = 405.89; ip2[2].y = 206.89; + ip2[3].x = 366.00; ip2[3].y = 187.93; + + op2[0].x = -194.00; op2[0].y = 168.00; + op2[1].x = -281.00; op2[1].y = 267.00; + op2[2].x = -433.00; op2[2].y = 321.00; + op2[3].x = -372.00; op2[3].y = 208.00; + + //ip[4].x = 405.89; ip[4].y = 206.89; + //op[4].x = -433.00; op[4].y = 321.00; + //ip2[4].x = 364.00; ip2[4].y = 187.97; + //op2[4].x = -376.00; op2[4].y = 209.00; + + cvFindExtrinsicCameraParams2(OP, IP, &K, + NULL, //&D, + &RV, &T, 0); + + cvRodrigues2(&RV, &R, 0); + + printf("--first--\n"); + print32FMat(R); + + cvFindExtrinsicCameraParams2(OP2, IP2, &K, + NULL, //&D, + &RV2, &T2, 0); + + cvRodrigues2(&RV2, &R, 0); + printf("---second---\n"); + print32FMat(R); + + double err; + cvProjectPoints2(OP, &RV, &T, &K, NULL, IP0); + err = cvNorm(IP, IP0, CV_L2); + printf("\n\nfirst avg reprojection error = %g\n", sqrt(err*err/npoints)); + + cvProjectPoints2(OP2, &RV2, &T2, &K, NULL, IP0); + err = cvNorm(IP2, IP0, CV_L2); + printf("second avg reprojection error = %g\n", sqrt(err*err/npoints)); + + cvProjectPoints2(OP, &RV2, &T2, &K, NULL, IP0); + err = cvNorm(IP, IP0, CV_L2); + printf("\n\nsecond->first cross reprojection error = %g\n", sqrt(err*err/npoints)); + + cvProjectPoints2(OP2, &RV, &T, &K, NULL, IP0); + err = cvNorm(IP2, IP0, CV_L2); + printf("first->second cross reprojection error = %g\n", sqrt(err*err/npoints)); + */ + /*Mat img = imread("/Users/vp/work/ocv/opencv/samples/c/baboon.jpg", 1); + vector corners; + double t0 = 0, t; + + for( size_t i = 0; i < 50; i++ ) + { + corners.clear(); + t = (double)getTickCount(); + goodFeaturesToTrack(img, corners, 1000, 0.01, 10); + t = (double)getTickCount() - t; + if( i == 0 || t0 > t ) + t0 = t; + } + printf("minimum running time = %gms\n", t0*1000./getTickFrequency()); + + Mat imgc; + cvtColor(img, imgc, CV_GRAY2BGR); + + for( size_t i = 0; i < corners.size(); i++ ) + { + circle(imgc, corners[i], 3, Scalar(0,255,0), -1); + } + imshow("corners", imgc);*/ + /*Mat imgf, imgf2, img2; + img.convertTo(imgf, CV_64F, 1./255); + resize(imgf, imgf2, Size(), 0.7, 0.7, CV_INTER_LANCZOS4); + imgf2.convertTo(img2, CV_8U, 255); + imshow("test", img2); + + waitKey();*/ + + /*Mat src = imread("/Users/vp/work/ocv/opencv/samples/c/fruits.jpg", 1); + //if( argc != 2 || !(src=imread(argv[1], 1)).data ) + // return -1; + + Mat hsv; + cvtColor(src, hsv, CV_BGR2HSV); + + // let's quantize the hue to 30 levels + // and the saturation to 32 levels + int hbins = 30, sbins = 32; + int histSize[] = {hbins, sbins}; + // hue varies from 0 to 179, see cvtColor + float hranges[] = { 0, 180 }; + // saturation varies from 0 (black-gray-white) to + // 255 (pure spectrum color) + float sranges[] = { 0, 256 }; + const float* ranges[] = { hranges, sranges }; + MatND hist; + // we compute the histogram from the 0-th and 1-st channels + int channels[] = {0, 1}; + + calcHist( &hsv, 1, channels, Mat(), // do not use mask + hist, 2, histSize, ranges, + true, // the histogram is uniform + false ); + double maxVal=0; + minMaxLoc(hist, 0, &maxVal, 0, 0); + + int scale = 10; + Mat histImg = Mat::zeros(sbins*scale, hbins*10, CV_8UC3); + + for( int h = 0; h < hbins; h++ ) + for( int s = 0; s < sbins; s++ ) + { + float binVal = hist.at(h, s); + int intensity = cvRound(binVal*255/maxVal); + rectangle( histImg, Point(h*scale, s*scale), + Point( (h+1)*scale - 1, (s+1)*scale - 1), + Scalar::all(intensity), + CV_FILLED ); + } + + namedWindow( "Source", 1 ); + imshow( "Source", src ); + + namedWindow( "H-S Histogram", 1 ); + imshow( "H-S Histogram", histImg ); + waitKey();*/ + + /*Mat_ a(3, 3); + a << 1, 0, 0, 0, 1, 0, 0, 0, 1; + Mat_ b(3, 1); + b << 1, 2, 3; + Mat c; + hconcat(a, b, c); + cout << c;*/ + + /*Mat img = imread("/Users/vp/work/ocv/opencv/samples/c/lena.jpg", 1), img2; + cv::imshow( "Original Image D", img ); + + if( img.channels()==3 ) + { + Mat L,u,v; + Mat luv; + vector splitted; + Mat img_float0, img_float; + + img.convertTo( img_float0, CV_32F, 1./255, 0 ); + cvtColor( img_float0, luv, CV_BGR2Luv); + + cv::split( luv, splitted ); + + L = (Mat)splitted[0]; + u = (Mat)splitted[1]; + v = (Mat)splitted[2]; + + vector res; + + res.push_back( L ); + res.push_back( u ); + res.push_back( v ); + + cv::merge( res, luv ); + + cvtColor( luv, img_float, CV_Luv2BGR ); + + printf("diff = %g\n", cv::norm(img_float0, img_float, CV_C)); + + img_float.convertTo( img2, CV_8U, 255. ); + } + + cv::imshow( "After Darken", img2 ); + cv::absdiff(img, img2, img2); + img2 *= 255; + cv::imshow("Magnified difference", img2); + + waitKey();*/ + + /*const char* imgFilename = "/Users/vp/Downloads/tsukuba.png"; + + Mat bgr = imread( imgFilename ); + Mat gray = imread( imgFilename, 0 ), gray_; + cvtColor( bgr, gray_, CV_BGR2GRAY ); + + int N = countNonZero( gray != gray_ ); + printf( "Count non zero = %d / %d\n", N, gray.cols * gray.rows ); + + Mat diff = abs( gray-gray_ ); + double maxVal = 0; + minMaxLoc( diff, 0, &maxVal, 0, 0); + printf( "Max abs diff = %f\n", maxVal);*/ + /*Mat img = imread("/Users/vp/Downloads/r_forearm_cam_rect_crop.png", 1); + vector corners; + Mat big; + resize(img, big, Size(), 1, 1); + bool found = findChessboardCorners(big, Size(5,4), corners); + drawChessboardCorners(big, Size(5,4), Mat(corners), found); + imshow("test", big); + waitKey();*/ + + /*float x[] = {0, 1}; + float y[] = {0, 1}; + CvMat mx = cvMat(2, 1, CV_32F, x); + CvMat my = cvMat(2, 1, CV_32F, y); + CvNormalBayesClassifier b; + bool s = b.train(&mx, &my, 0, 0, false);*/ + + /*float responseData[] = {1, 1, 1, 0, 0, 0}; + float intdata[] = { 1, 0, 0, 1, + 1, 0, 1, 0, + + 1, 1, 0, 0, + + 0, 0, 0, 1, + + 0, 0, 1, 0, + + 0, 1, 0, 0}; + + CvMat data = cvMat(6, 4, CV_32FC1, intdata); + + CvMat responses = cvMat(6, 1, CV_32FC1, responseData); + + CvNormalBayesClassifier bc; + + bool succ = bc.train(&data, &responses, 0, 0, false); + float testData[] = {1.0, 1, 0, 0}; + float dummy[] = {0}; + CvMat test = cvMat(1, 4, CV_32FC1, testData); + + CvMat testResults = cvMat(1, 6, CV_32FC1, 0); + + float whatsthis = bc.predict(&test, &testResults);*/ + + int sz[] = {10, 20, 30}; + Mat m(3, sz, CV_32F); + randu(m, Scalar::all(-10), Scalar::all(10)); + double maxVal0, maxVal = -FLT_MAX; + minMaxIdx(m, 0, &maxVal0, 0, 0); + + MatConstIterator_ it = m.begin(), it_end = m.end(); + + for( ; it != it_end; ++it ) + { + if( maxVal < *it ) + maxVal = *it; + } + + printf("maxval(minmaxloc) = %g, maxval(iterator) = %g\n", maxVal0, maxVal); + return 0; } #endif diff --git a/samples/c/inpaint.cpp b/samples/c/inpaint.cpp index 75b30c8317..b8161fecf8 100644 --- a/samples/c/inpaint.cpp +++ b/samples/c/inpaint.cpp @@ -1,11 +1,5 @@ -#ifdef _CH_ -#pragma package -#endif - -#include "cv.h" -#include "highgui.h" -#include -#include +#include "opencv2/highgui/highgui.hpp" +#include "opencv2/imgproc/imgproc_c.h" IplImage* inpaint_mask = 0; IplImage* img0 = 0, *img = 0, *inpainted = 0; diff --git a/samples/c/kalman.c b/samples/c/kalman.c index 5418c42a86..d04d477947 100644 --- a/samples/c/kalman.c +++ b/samples/c/kalman.c @@ -11,17 +11,8 @@ Pressing ESC will stop the program. */ -#ifdef _CH_ -#pragma package -#endif - -#define CV_NO_BACKWARD_COMPATIBILITY - -#ifndef _EiC -#include "cv.h" -#include "highgui.h" -#include -#endif +#include "opencv2/video/tracking.hpp" +#include "opencv2/highgui/highgui.hpp" int main(int argc, char** argv) { diff --git a/samples/c/kmeans.c b/samples/c/kmeans.c index ed8a5236ae..55b69d8363 100644 --- a/samples/c/kmeans.c +++ b/samples/c/kmeans.c @@ -1,14 +1,5 @@ -#ifdef _CH_ -#pragma package -#endif - -#define CV_NO_BACKWARD_COMPATIBILITY - -#ifndef _EiC -#include "cv.h" -#include "highgui.h" -#include -#endif +#include "opencv2/highgui/highgui.hpp" +#include "opencv2/core/core.hpp" int main( int argc, char** argv ) { diff --git a/samples/c/laplace.c b/samples/c/laplace.c index 3a45f27c2f..069eee54fd 100644 --- a/samples/c/laplace.c +++ b/samples/c/laplace.c @@ -1,15 +1,8 @@ -#ifdef _CH_ -#pragma package -#endif - -#define CV_NO_BACKWARD_COMPATIBILITY +#include "opencv2/highgui/highgui.hpp" +#include "opencv2/imgproc/imgproc.hpp" -#ifndef _EiC -#include "cv.h" -#include "highgui.h" #include #include -#endif int sigma = 3; int smoothType = CV_GAUSSIAN; diff --git a/samples/c/latentsvmdetect.cpp b/samples/c/latentsvmdetect.cpp index b683d93e20..8723f955b4 100644 --- a/samples/c/latentsvmdetect.cpp +++ b/samples/c/latentsvmdetect.cpp @@ -1,6 +1,5 @@ #include "opencv2/objdetect/objdetect.hpp" -#include "opencv2/core/core_c.h" -#include "opencv2/highgui/highgui_c.h" +#include "opencv2/highgui/highgui.hpp" #include using namespace cv; @@ -43,14 +42,14 @@ int main(int argc, char* argv[]) IplImage* image = cvLoadImage(image_filename); if (!image) { - printf( "Unable to load the image\n" + printf( "Unable to load the image\n" "Pass it as the first parameter: latentsvmdetect \n" ); return -1; } CvLatentSvmDetector* detector = cvLoadLatentSvmDetector(model_filename); if (!detector) { - printf( "Unable to load the model\n" + printf( "Unable to load the model\n" "Pass it as the second parameter: latentsvmdetect \n" ); cvReleaseImage( &image ); return -1; diff --git a/samples/c/letter_recog.cpp b/samples/c/letter_recog.cpp index 7ce7a22d21..353440154e 100644 --- a/samples/c/letter_recog.cpp +++ b/samples/c/letter_recog.cpp @@ -1,5 +1,5 @@ -#include "ml.h" -#include +#include "opencv2/core/core_c.h" +#include "opencv2/ml/ml.hpp" /* The sample demonstrates how to train Random Trees classifier diff --git a/samples/c/lkdemo.c b/samples/c/lkdemo.c index 0cef2bbcaf..53f4e0f609 100644 --- a/samples/c/lkdemo.c +++ b/samples/c/lkdemo.c @@ -1,18 +1,8 @@ -/* Demo of modified Lucas-Kanade optical flow algorithm. - See the printf below */ +#include "opencv2/video/tracking.hpp" +#include "opencv2/highgui/highgui.hpp" -#ifdef _CH_ -#pragma package -#endif - -#define CV_NO_BACKWARD_COMPATIBILITY - -#ifndef _EiC -#include "cv.h" -#include "highgui.h" -#include #include -#endif +#include IplImage *image = 0, *grey = 0, *prev_grey = 0, *pyramid = 0, *prev_pyramid = 0, *swap_temp; diff --git a/samples/c/minarea.c b/samples/c/minarea.c index 2cff7b111d..0e0acb9bf8 100644 --- a/samples/c/minarea.c +++ b/samples/c/minarea.c @@ -1,14 +1,5 @@ -#ifdef _CH_ -#pragma package -#endif - -#define CV_NO_BACKWARD_COMPATIBILITY - -#ifndef _EiC -#include "cv.h" -#include "highgui.h" -#include -#endif +#include "opencv2/highgui/highgui.hpp" +#include "opencv2/imgproc/imgproc_c.h" #define ARRAY 1 diff --git a/samples/c/morphology.c b/samples/c/morphology.c index b37e9b3216..0c15d70256 100644 --- a/samples/c/morphology.c +++ b/samples/c/morphology.c @@ -1,9 +1,5 @@ -#define CV_NO_BACKWARD_COMPATIBILITY - -#include -#include -#include -#include +#include "opencv2/highgui/highgui.hpp" +#include "opencv2/imgproc/imgproc.hpp" IplImage* src = 0; IplImage* dst = 0; diff --git a/samples/c/motempl.c b/samples/c/motempl.c index 245890f72b..14354f056b 100644 --- a/samples/c/motempl.c +++ b/samples/c/motempl.c @@ -1,18 +1,7 @@ -#ifdef _CH_ -#pragma package -#endif - -#define CV_NO_BACKWARD_COMPATIBILITY - -#ifndef _EiC -// motion templates sample code -#include "cv.h" -#include "highgui.h" +#include "opencv2/video/tracking.hpp" +#include "opencv2/imgproc/imgproc.hpp" +#include "opencv2/highgui/highgui.hpp" #include -#include -#include -#include -#endif // various tracking parameters (in seconds) const double MHI_DURATION = 1; diff --git a/samples/c/mser_sample.cpp b/samples/c/mser_sample.cpp index 4d70d801ff..eb9a8d31f3 100644 --- a/samples/c/mser_sample.cpp +++ b/samples/c/mser_sample.cpp @@ -1,40 +1,38 @@ /* This sample code was originally provided by Liu Liu - * Copyright© 2009, Liu Liu All rights reserved. + * Copyright� 2009, Liu Liu All rights reserved. */ -#include -#include -#include -#include "cv.h" -#include "highgui.h" +#include "opencv2/highgui/highgui.hpp" +#include "opencv2/features2d/features2d.hpp" +#include "opencv2/imgproc/imgproc_c.h" - static CvScalar colors[] = - { - {{0,0,255}}, - {{0,128,255}}, - {{0,255,255}}, - {{0,255,0}}, - {{255,128,0}}, - {{255,255,0}}, - {{255,0,0}}, - {{255,0,255}}, - {{255,255,255}}, - {{196,255,255}}, - {{255,255,196}} - }; - - static uchar bcolors[][3] = - { - {0,0,255}, - {0,128,255}, - {0,255,255}, - {0,255,0}, - {255,128,0}, - {255,255,0}, - {255,0,0}, - {255,0,255}, - {255,255,255} - }; +static CvScalar colors[] = +{ + {{0,0,255}}, + {{0,128,255}}, + {{0,255,255}}, + {{0,255,0}}, + {{255,128,0}}, + {{255,255,0}}, + {{255,0,0}}, + {{255,0,255}}, + {{255,255,255}}, + {{196,255,255}}, + {{255,255,196}} +}; + +static uchar bcolors[][3] = +{ + {0,0,255}, + {0,128,255}, + {0,255,255}, + {0,255,0}, + {255,128,0}, + {255,255,0}, + {255,0,0}, + {255,0,255}, + {255,255,255} +}; int main( int argc, char** argv ) { diff --git a/samples/c/mushroom.cpp b/samples/c/mushroom.cpp index adc5a5ce55..1a5b5fcbae 100644 --- a/samples/c/mushroom.cpp +++ b/samples/c/mushroom.cpp @@ -1,4 +1,5 @@ -#include "ml.h" +#include "opencv2/core/core_c.h" +#include "opencv2/ml/ml.hpp" #include /* diff --git a/samples/c/one_way_sample.cpp b/samples/c/one_way_sample.cpp index e962161a7e..6f0df4d95c 100644 --- a/samples/c/one_way_sample.cpp +++ b/samples/c/one_way_sample.cpp @@ -7,9 +7,10 @@ * */ -#include -#include -#include +#include "opencv2/imgproc/imgproc.hpp" +#include "opencv2/features2d/features2d.hpp" +#include "opencv2/highgui/highgui.hpp" +#include "opencv2/imgproc/imgproc_c.h" #include diff --git a/samples/c/peopledetect.cpp b/samples/c/peopledetect.cpp index 9e4ec3be02..d57306edb4 100644 --- a/samples/c/peopledetect.cpp +++ b/samples/c/peopledetect.cpp @@ -1,5 +1,7 @@ -#include "cvaux.h" -#include "highgui.h" +#include "opencv2/imgproc/imgproc.hpp" +#include "opencv2/objdetect/objdetect.hpp" +#include "opencv2/highgui/highgui.hpp" + #include #include #include diff --git a/samples/c/polar_transforms.c b/samples/c/polar_transforms.c index 510b6f8ce1..85d7ce8f96 100644 --- a/samples/c/polar_transforms.c +++ b/samples/c/polar_transforms.c @@ -1,16 +1,8 @@ -#ifdef _CH_ -#pragma package -#endif - -#define CV_NO_BACKWARD_COMPATIBILITY +#include "opencv2/imgproc/imgproc.hpp" +#include "opencv2/highgui/highgui.hpp" -#ifndef _EiC -#include "cv.h" -#include "highgui.h" #include #include -#endif - int main( int argc, char** argv ) { diff --git a/samples/c/pyramid_segmentation.c b/samples/c/pyramid_segmentation.c index 3304b4cb71..e71d2239e2 100644 --- a/samples/c/pyramid_segmentation.c +++ b/samples/c/pyramid_segmentation.c @@ -1,14 +1,5 @@ -#ifdef _CH_ -#pragma package -#endif - -#define CV_NO_BACKWARD_COMPATIBILITY - -#ifndef _EiC -#include "cv.h" -#include "highgui.h" -#include -#endif +#include "opencv2/imgproc/imgproc.hpp" +#include "opencv2/highgui/highgui.hpp" IplImage* image[2] = { 0, 0 }, *image0 = 0, *image1 = 0; CvSize size; diff --git a/samples/c/squares.c b/samples/c/squares.c index 82c5d6100e..da5d7bd9b4 100644 --- a/samples/c/squares.c +++ b/samples/c/squares.c @@ -3,14 +3,8 @@ // It loads several images subsequentally and tries to find squares in // each image // -#ifdef _CH_ -#pragma package -#endif - -#define CV_NO_BACKWARD_COMPATIBILITY - -#include "cv.h" -#include "highgui.h" +#include "opencv2/imgproc/imgproc.hpp" +#include "opencv2/highgui/highgui.hpp" #include #include #include diff --git a/samples/c/stereo_calib.cpp b/samples/c/stereo_calib.cpp index 32c5ff4f3d..1e20e7ba0b 100644 --- a/samples/c/stereo_calib.cpp +++ b/samples/c/stereo_calib.cpp @@ -25,11 +25,10 @@ http://pr.willowgarage.com/wiki/OpenCV ************************************************** */ -#undef _GLIBCXX_DEBUG +#include "opencv2/calib3d/calib3d.hpp" +#include "opencv2/highgui/highgui.hpp" +#include "opencv2/imgproc/imgproc_c.h" -#include "cv.h" -#include "cxmisc.h" -#include "highgui.h" #include #include #include diff --git a/samples/c/stereo_match.cpp b/samples/c/stereo_match.cpp index 0e0ae385ff..16ac6b2f11 100644 --- a/samples/c/stereo_match.cpp +++ b/samples/c/stereo_match.cpp @@ -7,8 +7,10 @@ * */ -#include -#include +#include "opencv2/calib3d/calib3d.hpp" +#include "opencv2/imgproc/imgproc.hpp" +#include "opencv2/highgui/highgui.hpp" + #include using namespace cv; diff --git a/samples/c/tree_engine.cpp b/samples/c/tree_engine.cpp index 0bd6bf4ce1..e6b060c406 100644 --- a/samples/c/tree_engine.cpp +++ b/samples/c/tree_engine.cpp @@ -1,4 +1,4 @@ -#include "ml.h" +#include "opencv2/ml/ml.hpp" #include /* The sample demonstrates how to use different decision trees. diff --git a/samples/c/watershed.cpp b/samples/c/watershed.cpp index 86d4a5c564..d79dd0b56d 100644 --- a/samples/c/watershed.cpp +++ b/samples/c/watershed.cpp @@ -1,13 +1,7 @@ -#ifdef _CH_ -#pragma package -#endif - -#ifndef _EiC -#include "cv.h" -#include "highgui.h" +#include "opencv2/imgproc/imgproc_c.h" +#include "opencv2/highgui/highgui.hpp" #include #include -#endif IplImage* marker_mask = 0; IplImage* markers = 0; diff --git a/samples/cpp/3calibration.cpp b/samples/cpp/3calibration.cpp index 1da623dfce..cada2d46bb 100644 --- a/samples/cpp/3calibration.cpp +++ b/samples/cpp/3calibration.cpp @@ -2,7 +2,10 @@ * 3calibration.cpp -- Calibrate 3 cameras in a horizontal line together. */ -#include "opencv2/opencv.hpp" +#include "opencv2/calib3d/calib3d.hpp" +#include "opencv2/imgproc/imgproc.hpp" +#include "opencv2/highgui/highgui.hpp" + #include #include #include diff --git a/samples/cpp/brief_match_test.cpp b/samples/cpp/brief_match_test.cpp index 55cb86c42c..25864f0bec 100644 --- a/samples/cpp/brief_match_test.cpp +++ b/samples/cpp/brief_match_test.cpp @@ -4,7 +4,10 @@ * Created on: Oct 17, 2010 * Author: ethan */ -#include +#include +#include +#include +#include #include #include diff --git a/samples/cpp/connected_components.cpp b/samples/cpp/connected_components.cpp index 3a8f68955b..af2121bb57 100644 --- a/samples/cpp/connected_components.cpp +++ b/samples/cpp/connected_components.cpp @@ -1,8 +1,10 @@ -#include "cv.h" -#include "highgui.h" +#include +#include #include using namespace cv; +using namespace std; + Mat img; int threshval = 100; diff --git a/samples/cpp/contours2.cpp b/samples/cpp/contours2.cpp index 1d5806b96c..fc6073f811 100644 --- a/samples/cpp/contours2.cpp +++ b/samples/cpp/contours2.cpp @@ -1,9 +1,10 @@ -#include "cv.h" -#include "highgui.h" +#include +#include #include #include using namespace cv; +using namespace std; void help() { diff --git a/samples/cpp/generic_descriptor_match.cpp b/samples/cpp/generic_descriptor_match.cpp index c6ce5f06e6..dee99bc9a5 100644 --- a/samples/cpp/generic_descriptor_match.cpp +++ b/samples/cpp/generic_descriptor_match.cpp @@ -1,6 +1,7 @@ #include "opencv2/calib3d/calib3d.hpp" #include "opencv2/features2d/features2d.hpp" #include "opencv2/highgui/highgui.hpp" +#include "opencv2/imgproc/imgproc_c.h" #include diff --git a/samples/cpp/morphology2.cpp b/samples/cpp/morphology2.cpp index 84b2b4182c..4d7a64e163 100644 --- a/samples/cpp/morphology2.cpp +++ b/samples/cpp/morphology2.cpp @@ -1,7 +1,7 @@ #define CV_NO_BACKWARD_COMPATIBILITY -#include -#include +#include +#include #include #include diff --git a/samples/cpp/segment_objects.cpp b/samples/cpp/segment_objects.cpp index 0153892c50..5d472bf0b0 100644 --- a/samples/cpp/segment_objects.cpp +++ b/samples/cpp/segment_objects.cpp @@ -1,5 +1,6 @@ -#include "cvaux.h" -#include "highgui.h" +#include +#include +#include #include #include diff --git a/samples/cpp/starter_imagelist.cpp b/samples/cpp/starter_imagelist.cpp index 9b39915e45..99c662930e 100644 --- a/samples/cpp/starter_imagelist.cpp +++ b/samples/cpp/starter_imagelist.cpp @@ -8,7 +8,8 @@ * that was generated with imagelist_creator.cpp * easy as CV_PI right? */ -#include +#include +#include #include using namespace cv; diff --git a/samples/cpp/starter_video.cpp b/samples/cpp/starter_video.cpp index 1d8c3792e9..1f8f6692e1 100644 --- a/samples/cpp/starter_video.cpp +++ b/samples/cpp/starter_video.cpp @@ -7,7 +7,8 @@ * A starter sample for using opencv, get a video stream and display the images * easy as CV_PI right? */ -#include +#include +#include #include using namespace cv; diff --git a/samples/cpp/video_homography.cpp b/samples/cpp/video_homography.cpp index 7324a517c2..66ad976428 100644 --- a/samples/cpp/video_homography.cpp +++ b/samples/cpp/video_homography.cpp @@ -5,7 +5,10 @@ * Author: erublee */ -#include +#include +#include +#include +#include #include #include #include