diff --git a/samples/android/face-detection/jni/DetectionBasedTracker_jni.cpp b/samples/android/face-detection/jni/DetectionBasedTracker_jni.cpp index 9fd8494b2..7d198dc53 100644 --- a/samples/android/face-detection/jni/DetectionBasedTracker_jni.cpp +++ b/samples/android/face-detection/jni/DetectionBasedTracker_jni.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include #include diff --git a/samples/android/tutorial-2-mixedprocessing/jni/jni_part.cpp b/samples/android/tutorial-2-mixedprocessing/jni/jni_part.cpp index 2c0996156..72fa0b24a 100644 --- a/samples/android/tutorial-2-mixedprocessing/jni/jni_part.cpp +++ b/samples/android/tutorial-2-mixedprocessing/jni/jni_part.cpp @@ -1,7 +1,7 @@ #include -#include -#include -#include +#include +#include +#include #include using namespace std; diff --git a/samples/cpp/3calibration.cpp b/samples/cpp/3calibration.cpp index 12f2c81fc..7079b6d06 100644 --- a/samples/cpp/3calibration.cpp +++ b/samples/cpp/3calibration.cpp @@ -2,10 +2,10 @@ * 3calibration.cpp -- Calibrate 3 cameras in a horizontal line together. */ -#include "opencv2/calib3d/calib3d.hpp" -#include "opencv2/imgproc/imgproc.hpp" -#include "opencv2/imgcodecs/imgcodecs.hpp" -#include "opencv2/highgui/highgui.hpp" +#include "opencv2/calib3d.hpp" +#include "opencv2/imgproc.hpp" +#include "opencv2/imgcodecs.hpp" +#include "opencv2/highgui.hpp" #include "opencv2/core/utility.hpp" #include diff --git a/samples/cpp/contours2.cpp b/samples/cpp/contours2.cpp index c5a1fa70f..437f76cb2 100644 --- a/samples/cpp/contours2.cpp +++ b/samples/cpp/contours2.cpp @@ -1,5 +1,5 @@ -#include "opencv2/imgproc/imgproc.hpp" -#include "opencv2/highgui/highgui.hpp" +#include "opencv2/imgproc.hpp" +#include "opencv2/highgui.hpp" #include #include diff --git a/samples/cpp/convexhull.cpp b/samples/cpp/convexhull.cpp index 36e554454..fd2275645 100644 --- a/samples/cpp/convexhull.cpp +++ b/samples/cpp/convexhull.cpp @@ -1,6 +1,5 @@ -#include "opencv2/imgproc/imgproc.hpp" -#include "opencv2/highgui/highgui.hpp" -#include +#include "opencv2/imgproc.hpp" +#include "opencv2/highgui.hpp" #include using namespace cv; diff --git a/samples/cpp/cout_mat.cpp b/samples/cpp/cout_mat.cpp index bf1dfb2a4..ed2cd71c8 100644 --- a/samples/cpp/cout_mat.cpp +++ b/samples/cpp/cout_mat.cpp @@ -5,7 +5,7 @@ * */ -#include "opencv2/core/core.hpp" +#include "opencv2/core.hpp" #include using namespace std; diff --git a/samples/cpp/dbt_face_detection.cpp b/samples/cpp/dbt_face_detection.cpp index d7409bf5b..920ae001d 100644 --- a/samples/cpp/dbt_face_detection.cpp +++ b/samples/cpp/dbt_face_detection.cpp @@ -1,11 +1,11 @@ #if defined(__linux__) || defined(LINUX) || defined(__APPLE__) || defined(ANDROID) -#include // Gaussian Blur -#include // Basic OpenCV structures (cv::Mat, Scalar) -#include -#include // OpenCV window I/O -#include -#include +#include // Gaussian Blur +#include // Basic OpenCV structures (cv::Mat, Scalar) +#include +#include // OpenCV window I/O +#include +#include #include #include diff --git a/samples/cpp/delaunay2.cpp b/samples/cpp/delaunay2.cpp index a370feb2a..4807cd373 100644 --- a/samples/cpp/delaunay2.cpp +++ b/samples/cpp/delaunay2.cpp @@ -1,5 +1,5 @@ -#include -#include +#include +#include #include using namespace cv; diff --git a/samples/cpp/facedetect.cpp b/samples/cpp/facedetect.cpp index 39717b733..e9b648a7e 100644 --- a/samples/cpp/facedetect.cpp +++ b/samples/cpp/facedetect.cpp @@ -177,7 +177,7 @@ void detectAndDraw( Mat& img, CascadeClassifier& cascade, resize( gray, smallImg, Size(), fx, fx, INTER_LINEAR ); equalizeHist( smallImg, smallImg ); - t = (double)cvGetTickCount(); + t = (double)getTickCount(); cascade.detectMultiScale( smallImg, faces, 1.1, 2, 0 //|CASCADE_FIND_BIGGEST_OBJECT @@ -198,8 +198,8 @@ void detectAndDraw( Mat& img, CascadeClassifier& cascade, faces.push_back(Rect(smallImg.cols - r->x - r->width, r->y, r->width, r->height)); } } - t = (double)cvGetTickCount() - t; - printf( "detection time = %g ms\n", t/((double)cvGetTickFrequency()*1000.) ); + t = (double)getTickCount() - t; + printf( "detection time = %g ms\n", t*1000/getTickFrequency()); for ( size_t i = 0; i < faces.size(); i++ ) { Rect r = faces[i]; diff --git a/samples/cpp/facial_features.cpp b/samples/cpp/facial_features.cpp index f46fa3fb5..3ed6a442f 100644 --- a/samples/cpp/facial_features.cpp +++ b/samples/cpp/facial_features.cpp @@ -6,9 +6,9 @@ * */ -#include "opencv2/objdetect/objdetect.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/imgproc/imgproc.hpp" +#include "opencv2/objdetect.hpp" +#include "opencv2/highgui.hpp" +#include "opencv2/imgproc.hpp" #include #include diff --git a/samples/cpp/fback.cpp b/samples/cpp/fback.cpp index 5fbec6913..a04484402 100644 --- a/samples/cpp/fback.cpp +++ b/samples/cpp/fback.cpp @@ -1,7 +1,7 @@ #include "opencv2/video/tracking.hpp" -#include "opencv2/imgproc/imgproc.hpp" -#include "opencv2/videoio/videoio.hpp" -#include "opencv2/highgui/highgui.hpp" +#include "opencv2/imgproc.hpp" +#include "opencv2/videoio.hpp" +#include "opencv2/highgui.hpp" #include diff --git a/samples/cpp/ffilldemo.cpp b/samples/cpp/ffilldemo.cpp index 93bdd672b..d10d72e0e 100644 --- a/samples/cpp/ffilldemo.cpp +++ b/samples/cpp/ffilldemo.cpp @@ -1,7 +1,7 @@ -#include "opencv2/imgproc/imgproc.hpp" +#include "opencv2/imgproc.hpp" #include "opencv2/imgcodecs.hpp" -#include "opencv2/videoio/videoio.hpp" -#include "opencv2/highgui/highgui.hpp" +#include "opencv2/videoio.hpp" +#include "opencv2/highgui.hpp" #include diff --git a/samples/cpp/filestorage.cpp b/samples/cpp/filestorage.cpp index 60ea51aca..46b4da241 100644 --- a/samples/cpp/filestorage.cpp +++ b/samples/cpp/filestorage.cpp @@ -2,7 +2,7 @@ * filestorage_sample demonstrate the usage of the opencv serialization functionality */ -#include "opencv2/core/core.hpp" +#include "opencv2/core.hpp" #include #include diff --git a/samples/cpp/fitellipse.cpp b/samples/cpp/fitellipse.cpp index b83f617c1..0cd6c4a6d 100644 --- a/samples/cpp/fitellipse.cpp +++ b/samples/cpp/fitellipse.cpp @@ -14,10 +14,11 @@ * * ********************************************************************************/ -#include "opencv2/imgproc/imgproc.hpp" +#include "opencv2/imgproc.hpp" #include "opencv2/imgcodecs.hpp" -#include "opencv2/highgui/highgui.hpp" +#include "opencv2/highgui.hpp" #include + using namespace cv; using namespace std; diff --git a/samples/cpp/grabcut.cpp b/samples/cpp/grabcut.cpp index b6b406000..726906c6f 100644 --- a/samples/cpp/grabcut.cpp +++ b/samples/cpp/grabcut.cpp @@ -1,6 +1,6 @@ #include "opencv2/imgcodecs.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/imgproc/imgproc.hpp" +#include "opencv2/highgui.hpp" +#include "opencv2/imgproc.hpp" #include diff --git a/samples/cpp/houghcircles.cpp b/samples/cpp/houghcircles.cpp index bdafffec3..26c4dbae0 100644 --- a/samples/cpp/houghcircles.cpp +++ b/samples/cpp/houghcircles.cpp @@ -1,6 +1,6 @@ #include "opencv2/imgcodecs.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/imgproc/imgproc.hpp" +#include "opencv2/highgui.hpp" +#include "opencv2/imgproc.hpp" #include diff --git a/samples/cpp/houghlines.cpp b/samples/cpp/houghlines.cpp index ddeb3bd75..94eec86ee 100644 --- a/samples/cpp/houghlines.cpp +++ b/samples/cpp/houghlines.cpp @@ -1,6 +1,6 @@ #include "opencv2/imgcodecs.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/imgproc/imgproc.hpp" +#include "opencv2/highgui.hpp" +#include "opencv2/imgproc.hpp" #include diff --git a/samples/cpp/image.cpp b/samples/cpp/image.cpp index b5925c69a..fc57738a7 100644 --- a/samples/cpp/image.cpp +++ b/samples/cpp/image.cpp @@ -1,7 +1,7 @@ #include #include -#include -#include +#include +#include #include using namespace cv; // all the new API is put into "cv" namespace. Export its content diff --git a/samples/cpp/image_sequence.cpp b/samples/cpp/image_sequence.cpp index 14b63e39c..6a84fab4b 100644 --- a/samples/cpp/image_sequence.cpp +++ b/samples/cpp/image_sequence.cpp @@ -1,6 +1,6 @@ -#include -#include -#include +#include +#include +#include #include diff --git a/samples/cpp/imagelist_creator.cpp b/samples/cpp/imagelist_creator.cpp index bdb023187..5b2dc38d4 100644 --- a/samples/cpp/imagelist_creator.cpp +++ b/samples/cpp/imagelist_creator.cpp @@ -1,9 +1,9 @@ /*this creates a yaml or xml list of files from the command line args */ -#include "opencv2/core/core.hpp" +#include "opencv2/core.hpp" #include "opencv2/imgcodecs.hpp" -#include "opencv2/highgui/highgui.hpp" +#include "opencv2/highgui.hpp" #include #include diff --git a/samples/cpp/inpaint.cpp b/samples/cpp/inpaint.cpp index 62d752193..86e6e3741 100644 --- a/samples/cpp/inpaint.cpp +++ b/samples/cpp/inpaint.cpp @@ -1,7 +1,7 @@ #include "opencv2/imgcodecs.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/imgproc/imgproc.hpp" -#include "opencv2/photo/photo.hpp" +#include "opencv2/highgui.hpp" +#include "opencv2/imgproc.hpp" +#include "opencv2/photo.hpp" #include diff --git a/samples/cpp/intelperc_capture.cpp b/samples/cpp/intelperc_capture.cpp index daae4420f..d8a1c3224 100644 --- a/samples/cpp/intelperc_capture.cpp +++ b/samples/cpp/intelperc_capture.cpp @@ -1,8 +1,8 @@ // testOpenCVCam.cpp : Defines the entry point for the console application. // -#include "opencv2/videoio/videoio.hpp" -#include "opencv2/highgui/highgui.hpp" +#include "opencv2/videoio.hpp" +#include "opencv2/highgui.hpp" #include diff --git a/samples/cpp/kalman.cpp b/samples/cpp/kalman.cpp index 8f9adc6c2..501a74912 100644 --- a/samples/cpp/kalman.cpp +++ b/samples/cpp/kalman.cpp @@ -1,5 +1,5 @@ #include "opencv2/video/tracking.hpp" -#include "opencv2/highgui/highgui.hpp" +#include "opencv2/highgui.hpp" #include diff --git a/samples/cpp/laplace.cpp b/samples/cpp/laplace.cpp index b33b49cbd..462f62804 100644 --- a/samples/cpp/laplace.cpp +++ b/samples/cpp/laplace.cpp @@ -1,6 +1,6 @@ -#include "opencv2/videoio/videoio.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/imgproc/imgproc.hpp" +#include "opencv2/videoio.hpp" +#include "opencv2/highgui.hpp" +#include "opencv2/imgproc.hpp" #include #include diff --git a/samples/cpp/letter_recog.cpp b/samples/cpp/letter_recog.cpp index 3d7e34ab7..0eb67d1e4 100644 --- a/samples/cpp/letter_recog.cpp +++ b/samples/cpp/letter_recog.cpp @@ -1,5 +1,5 @@ -#include "opencv2/core/core.hpp" -#include "opencv2/ml/ml.hpp" +#include "opencv2/core.hpp" +#include "opencv2/ml.hpp" #include #include diff --git a/samples/cpp/lkdemo.cpp b/samples/cpp/lkdemo.cpp index 3881aa865..5e57aa84a 100644 --- a/samples/cpp/lkdemo.cpp +++ b/samples/cpp/lkdemo.cpp @@ -1,7 +1,7 @@ #include "opencv2/video/tracking.hpp" -#include "opencv2/imgproc/imgproc.hpp" -#include "opencv2/videoio/videoio.hpp" -#include "opencv2/highgui/highgui.hpp" +#include "opencv2/imgproc.hpp" +#include "opencv2/videoio.hpp" +#include "opencv2/highgui.hpp" #include #include diff --git a/samples/cpp/lsd_lines.cpp b/samples/cpp/lsd_lines.cpp index 4c8c7e0a4..e0db6c366 100644 --- a/samples/cpp/lsd_lines.cpp +++ b/samples/cpp/lsd_lines.cpp @@ -1,11 +1,8 @@ #include -#include -#include "opencv2/core/core.hpp" -#include "opencv2/core/utility.hpp" -#include "opencv2/imgproc/imgproc.hpp" +#include "opencv2/imgproc.hpp" #include "opencv2/imgcodecs.hpp" -#include "opencv2/highgui/highgui.hpp" +#include "opencv2/highgui.hpp" using namespace std; using namespace cv; @@ -23,6 +20,9 @@ int main(int argc, char** argv) Mat image = imread(in, IMREAD_GRAYSCALE); + if( image.empty() ) + { return -1; } + #if 0 Canny(image, image, 50, 200, 3); // Apply canny edge #endif diff --git a/samples/cpp/minarea.cpp b/samples/cpp/minarea.cpp index 91ad5a37b..ac79db5e5 100644 --- a/samples/cpp/minarea.cpp +++ b/samples/cpp/minarea.cpp @@ -1,5 +1,5 @@ -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/imgproc/imgproc.hpp" +#include "opencv2/highgui.hpp" +#include "opencv2/imgproc.hpp" #include diff --git a/samples/cpp/morphology2.cpp b/samples/cpp/morphology2.cpp index 04e916c64..8439080b2 100644 --- a/samples/cpp/morphology2.cpp +++ b/samples/cpp/morphology2.cpp @@ -1,6 +1,6 @@ -#include "opencv2/imgproc/imgproc.hpp" +#include "opencv2/imgproc.hpp" #include "opencv2/imgcodecs.hpp" -#include "opencv2/highgui/highgui.hpp" +#include "opencv2/highgui.hpp" #include #include #include @@ -66,7 +66,7 @@ int main( int argc, char** argv ) return 0; } std::string filename = parser.get("@image"); - if( (src = imread(filename,1)).empty() ) + if( (src = imread(filename,IMREAD_COLOR)).empty() ) { help(); return -1; diff --git a/samples/cpp/openni_capture.cpp b/samples/cpp/openni_capture.cpp index 70d4a7c61..6c5162497 100644 --- a/samples/cpp/openni_capture.cpp +++ b/samples/cpp/openni_capture.cpp @@ -1,6 +1,6 @@ #include "opencv2/videoio/videoio.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/imgproc/imgproc.hpp" +#include "opencv2/highgui.hpp" +#include "opencv2/imgproc.hpp" #include diff --git a/samples/cpp/pca.cpp b/samples/cpp/pca.cpp index 35fd0c1a0..b33a46321 100644 --- a/samples/cpp/pca.cpp +++ b/samples/cpp/pca.cpp @@ -42,9 +42,9 @@ #include #include -#include +#include #include "opencv2/imgcodecs.hpp" -#include +#include using namespace cv; using namespace std; diff --git a/samples/cpp/phase_corr.cpp b/samples/cpp/phase_corr.cpp index 5e8685fcf..c3120fe08 100644 --- a/samples/cpp/phase_corr.cpp +++ b/samples/cpp/phase_corr.cpp @@ -1,7 +1,7 @@ -#include "opencv2/core/core.hpp" -#include "opencv2/videoio/videoio.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/imgproc/imgproc.hpp" +#include "opencv2/core.hpp" +#include "opencv2/videoio.hpp" +#include "opencv2/highgui.hpp" +#include "opencv2/imgproc.hpp" using namespace cv; diff --git a/samples/cpp/polar_transforms.cpp b/samples/cpp/polar_transforms.cpp index 872dda8c3..3cbc431c3 100644 --- a/samples/cpp/polar_transforms.cpp +++ b/samples/cpp/polar_transforms.cpp @@ -1,94 +1,75 @@ -#include "opencv2/imgproc/imgproc_c.h" -#include "opencv2/videoio/videoio_c.h" -#include "opencv2/highgui/highgui_c.h" -#include "opencv2/core/utility.hpp" +#include "opencv2/imgproc.hpp" +#include "opencv2/highgui.hpp" +#include -#include -#include +using namespace cv; static void help( void ) { printf("\nThis program illustrates Linear-Polar and Log-Polar image transforms\n" "Usage :\n" - "./polar_transforms [[camera number -- Default 0],[AVI path_filename]]\n\n" - ); + "./polar_transforms [[camera number -- Default 0],[path_to_filename]]\n\n"); } + int main( int argc, char** argv ) { - CvCapture* capture = 0; - IplImage* log_polar_img = 0; - IplImage* lin_polar_img = 0; - IplImage* recovered_img = 0; + VideoCapture capture; + Mat log_polar_img, lin_polar_img, recovered_log_polar, recovered_lin_polar_img; help(); - cv::CommandLineParser parser(argc, argv, "{help h||}{@input|0|}"); - if (parser.has("help")) - { - help(); - return 0; - } + + CommandLineParser parser(argc, argv, "{@input|0|}"); std::string arg = parser.get("@input"); + if( arg.size() == 1 && isdigit(arg[0]) ) - capture = cvCaptureFromCAM( arg[0] - '0' ); + capture.open( arg[0] - '0' ); else - capture = cvCaptureFromAVI( arg.c_str() ); - if( !capture ) + capture.open( arg.c_str() ); + + if( !capture.isOpened() ) { const char* name = argv[0]; fprintf(stderr,"Could not initialize capturing...\n"); fprintf(stderr,"Usage: %s , or \n %s \n", name, name); - help(); return -1; } - cvNamedWindow( "Linear-Polar", 0 ); - cvNamedWindow( "Log-Polar", 0 ); - cvNamedWindow( "Recovered image", 0 ); + namedWindow( "Linear-Polar", WINDOW_NORMAL ); + namedWindow( "Log-Polar", WINDOW_NORMAL ); + namedWindow( "Recovered Linear-Polar", WINDOW_NORMAL ); + namedWindow( "Recovered Log-Polar", WINDOW_NORMAL ); - cvMoveWindow( "Linear-Polar", 20,20 ); - cvMoveWindow( "Log-Polar", 700,20 ); - cvMoveWindow( "Recovered image", 20,700 ); + moveWindow( "Linear-Polar", 20,20 ); + moveWindow( "Log-Polar", 700,20 ); + moveWindow( "Recovered Linear-Polar", 20, 350 ); + moveWindow( "Recovered Log-Polar", 700, 350 ); for(;;) { - IplImage* frame = 0; + Mat frame; + capture >> frame; - frame = cvQueryFrame( capture ); - if( !frame ) + if( frame.empty() ) break; - if( !log_polar_img ) - { - log_polar_img = cvCreateImage( cvSize(frame->width,frame->height), IPL_DEPTH_8U, frame->nChannels ); - lin_polar_img = cvCreateImage( cvSize(frame->width,frame->height), IPL_DEPTH_8U, frame->nChannels ); - recovered_img = cvCreateImage( cvSize(frame->width,frame->height), IPL_DEPTH_8U, frame->nChannels ); - } + Point2f center( (float)frame.cols / 2, (float)frame.rows / 2 ); + double M = (double)frame.cols / 8; - cvLogPolar(frame,log_polar_img,cvPoint2D32f(frame->width >> 1,frame->height >> 1),70, CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS); - cvLinearPolar(frame,lin_polar_img,cvPoint2D32f(frame->width >> 1,frame->height >> 1),70, CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS); + logPolar(frame,log_polar_img, center, M, INTER_LINEAR + WARP_FILL_OUTLIERS); + linearPolar(frame,lin_polar_img, center, M, INTER_LINEAR + WARP_FILL_OUTLIERS); -#if 0 - cvLogPolar(log_polar_img,recovered_img,cvPoint2D32f(frame->width >> 1,frame->height >> 1),70, CV_WARP_INVERSE_MAP+CV_INTER_LINEAR); -#else - cvLinearPolar(lin_polar_img,recovered_img,cvPoint2D32f(frame->width >> 1,frame->height >> 1),70, CV_WARP_INVERSE_MAP+CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS); -#endif + logPolar(log_polar_img, recovered_log_polar, center, M, WARP_INVERSE_MAP + INTER_LINEAR); + linearPolar(lin_polar_img, recovered_lin_polar_img, center, M, WARP_INVERSE_MAP + INTER_LINEAR + WARP_FILL_OUTLIERS); - cvShowImage("Log-Polar", log_polar_img ); - cvShowImage("Linear-Polar", lin_polar_img ); - cvShowImage("Recovered image", recovered_img ); + imshow("Log-Polar", log_polar_img ); + imshow("Linear-Polar", lin_polar_img ); + imshow("Recovered Linear-Polar", recovered_lin_polar_img ); + imshow("Recovered Log-Polar", recovered_log_polar ); - if( cvWaitKey(10) >= 0 ) + if( waitKey(10) >= 0 ) break; } - cvReleaseCapture( &capture ); - cvDestroyWindow("Linear-Polar"); - cvDestroyWindow("Log-Polar"); - cvDestroyWindow("Recovered image"); - + waitKey(0); return 0; } - -#ifdef _EiC -main(1,"laplace.c"); -#endif diff --git a/samples/cpp/segment_objects.cpp b/samples/cpp/segment_objects.cpp index 3c217f679..916283124 100644 --- a/samples/cpp/segment_objects.cpp +++ b/samples/cpp/segment_objects.cpp @@ -1,6 +1,6 @@ -#include "opencv2/imgproc/imgproc.hpp" -#include "opencv2/videoio/videoio.hpp" -#include "opencv2/highgui/highgui.hpp" +#include "opencv2/imgproc.hpp" +#include "opencv2/videoio.hpp" +#include "opencv2/highgui.hpp" #include "opencv2/video/background_segm.hpp" #include #include diff --git a/samples/cpp/squares.cpp b/samples/cpp/squares.cpp index f53e931e7..df8459caa 100644 --- a/samples/cpp/squares.cpp +++ b/samples/cpp/squares.cpp @@ -2,10 +2,10 @@ // It loads several images sequentially and tries to find squares in // each image -#include "opencv2/core/core.hpp" -#include "opencv2/imgproc/imgproc.hpp" +#include "opencv2/core.hpp" +#include "opencv2/imgproc.hpp" #include "opencv2/imgcodecs.hpp" -#include "opencv2/highgui/highgui.hpp" +#include "opencv2/highgui.hpp" #include #include @@ -23,8 +23,8 @@ static void help() "Returns sequence of squares detected on the image.\n" "the sequence is stored in the specified memory storage\n" "Call:\n" - "./squares\n" - "Using OpenCV version %s\n" << CV_VERSION << "\n" << endl; + "./squares [file_name (optional)]\n" + "Using OpenCV version " << CV_VERSION << "\n" << endl; } @@ -140,11 +140,18 @@ static void drawSquares( Mat& image, const vector >& squares ) } -int main(int /*argc*/, char** /*argv*/) +int main(int argc, char** argv) { static const char* names[] = { "../data/pic1.png", "../data/pic2.png", "../data/pic3.png", "../data/pic4.png", "../data/pic5.png", "../data/pic6.png", 0 }; help(); + + if( argc > 1) + { + names[0] = argv[1]; + names[1] = "0"; + } + namedWindow( wndname, 1 ); vector > squares; diff --git a/samples/cpp/starter_imagelist.cpp b/samples/cpp/starter_imagelist.cpp index 89df0cc1b..6f4f71466 100644 --- a/samples/cpp/starter_imagelist.cpp +++ b/samples/cpp/starter_imagelist.cpp @@ -9,7 +9,7 @@ * easy as CV_PI right? */ #include "opencv2/imgcodecs.hpp" -#include "opencv2/highgui/highgui.hpp" +#include "opencv2/highgui.hpp" #include #include diff --git a/samples/cpp/starter_video.cpp b/samples/cpp/starter_video.cpp index d6bf1b766..2839b03d7 100644 --- a/samples/cpp/starter_video.cpp +++ b/samples/cpp/starter_video.cpp @@ -12,8 +12,8 @@ */ #include -#include -#include +#include +#include #include #include diff --git a/samples/cpp/stereo_calib.cpp b/samples/cpp/stereo_calib.cpp index 117c9bac5..842a6492b 100644 --- a/samples/cpp/stereo_calib.cpp +++ b/samples/cpp/stereo_calib.cpp @@ -22,10 +22,10 @@ GitHub: https://github.com/Itseez/opencv/ ************************************************** */ -#include "opencv2/calib3d/calib3d.hpp" +#include "opencv2/calib3d.hpp" #include "opencv2/imgcodecs.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/imgproc/imgproc.hpp" +#include "opencv2/highgui.hpp" +#include "opencv2/imgproc.hpp" #include #include diff --git a/samples/cpp/stereo_match.cpp b/samples/cpp/stereo_match.cpp index e88b139a1..4868a6395 100644 --- a/samples/cpp/stereo_match.cpp +++ b/samples/cpp/stereo_match.cpp @@ -8,9 +8,9 @@ */ #include "opencv2/calib3d/calib3d.hpp" -#include "opencv2/imgproc/imgproc.hpp" +#include "opencv2/imgproc.hpp" #include "opencv2/imgcodecs.hpp" -#include "opencv2/highgui/highgui.hpp" +#include "opencv2/highgui.hpp" #include "opencv2/core/utility.hpp" #include diff --git a/samples/cpp/tree_engine.cpp b/samples/cpp/tree_engine.cpp index 441258875..96b2adf83 100644 --- a/samples/cpp/tree_engine.cpp +++ b/samples/cpp/tree_engine.cpp @@ -1,5 +1,5 @@ -#include "opencv2/ml/ml.hpp" -#include "opencv2/core/core.hpp" +#include "opencv2/ml.hpp" +#include "opencv2/core.hpp" #include "opencv2/core/utility.hpp" #include #include diff --git a/samples/cpp/tutorial_code/HighGUI/AddingImagesTrackbar.cpp b/samples/cpp/tutorial_code/HighGUI/AddingImagesTrackbar.cpp index 9e04dd912..93a7b48b1 100644 --- a/samples/cpp/tutorial_code/HighGUI/AddingImagesTrackbar.cpp +++ b/samples/cpp/tutorial_code/HighGUI/AddingImagesTrackbar.cpp @@ -5,7 +5,7 @@ */ #include "opencv2/imgcodecs.hpp" -#include "opencv2/highgui/highgui.hpp" +#include "opencv2/highgui.hpp" #include using namespace cv; diff --git a/samples/cpp/tutorial_code/HighGUI/BasicLinearTransformsTrackbar.cpp b/samples/cpp/tutorial_code/HighGUI/BasicLinearTransformsTrackbar.cpp index 213850f99..1834e35e2 100644 --- a/samples/cpp/tutorial_code/HighGUI/BasicLinearTransformsTrackbar.cpp +++ b/samples/cpp/tutorial_code/HighGUI/BasicLinearTransformsTrackbar.cpp @@ -6,7 +6,7 @@ */ #include "opencv2/imgcodecs.hpp" -#include "opencv2/highgui/highgui.hpp" +#include "opencv2/highgui.hpp" using namespace cv; diff --git a/samples/cpp/tutorial_code/Histograms_Matching/EqualizeHist_Demo.cpp b/samples/cpp/tutorial_code/Histograms_Matching/EqualizeHist_Demo.cpp index 45db5854e..80d4d4645 100644 --- a/samples/cpp/tutorial_code/Histograms_Matching/EqualizeHist_Demo.cpp +++ b/samples/cpp/tutorial_code/Histograms_Matching/EqualizeHist_Demo.cpp @@ -5,10 +5,9 @@ */ #include "opencv2/imgcodecs.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/imgproc/imgproc.hpp" +#include "opencv2/highgui.hpp" +#include "opencv2/imgproc.hpp" #include -#include using namespace cv; using namespace std; @@ -24,10 +23,10 @@ int main( int, char** argv ) const char* equalized_window = "Equalized Image"; /// Load image - src = imread( argv[1], 1 ); + src = imread( argv[1], IMREAD_COLOR ); if( src.empty() ) - { cout<<"Usage: ./Histogram_Demo "<"< -#include using namespace std; using namespace cv; @@ -27,11 +26,24 @@ void MatchingMethod( int, void* ); /** * @function main */ -int main( int, char** argv ) +int main( int argc, char** argv ) { + if (argc < 3) + { + cout << "Not enough parameters" << endl; + cout << "Usage:\n./MatchTemplate_Demo " << endl; + return -1; + } + /// Load image and template - img = imread( argv[1], 1 ); - templ = imread( argv[2], 1 ); + img = imread( argv[1], IMREAD_COLOR ); + templ = imread( argv[2], IMREAD_COLOR ); + + if(img.empty() || templ.empty()) + { + cout << "Can't read one of the images" << endl; + return -1; + } /// Create windows namedWindow( image_window, WINDOW_AUTOSIZE ); diff --git a/samples/cpp/tutorial_code/Histograms_Matching/calcBackProject_Demo1.cpp b/samples/cpp/tutorial_code/Histograms_Matching/calcBackProject_Demo1.cpp index ce0e91123..1e2fe928f 100644 --- a/samples/cpp/tutorial_code/Histograms_Matching/calcBackProject_Demo1.cpp +++ b/samples/cpp/tutorial_code/Histograms_Matching/calcBackProject_Demo1.cpp @@ -4,9 +4,9 @@ * @author OpenCV team */ -#include "opencv2/imgproc/imgproc.hpp" +#include "opencv2/imgproc.hpp" #include "opencv2/imgcodecs.hpp" -#include "opencv2/highgui/highgui.hpp" +#include "opencv2/highgui.hpp" #include @@ -27,7 +27,13 @@ void Hist_and_Backproj(int, void* ); int main( int, char** argv ) { /// Read the image - src = imread( argv[1], 1 ); + src = imread( argv[1], IMREAD_COLOR ); + + if( src.empty() ) + { cout<<"Usage: ./calcBackProject_Demo1 "< @@ -30,7 +30,7 @@ void pickPoint (int event, int x, int y, int, void* ); int main( int, char** argv ) { /// Read the image - src = imread( argv[1], 1 ); + src = imread( argv[1], IMREAD_COLOR ); /// Transform it to HSV cvtColor( src, hsv, COLOR_BGR2HSV ); diff --git a/samples/cpp/tutorial_code/Histograms_Matching/calcHist_Demo.cpp b/samples/cpp/tutorial_code/Histograms_Matching/calcHist_Demo.cpp index 1540cd85d..27e21e76b 100644 --- a/samples/cpp/tutorial_code/Histograms_Matching/calcHist_Demo.cpp +++ b/samples/cpp/tutorial_code/Histograms_Matching/calcHist_Demo.cpp @@ -4,11 +4,10 @@ * @author */ -#include "opencv2/highgui/highgui.hpp" +#include "opencv2/highgui.hpp" #include "opencv2/imgcodecs.hpp" -#include "opencv2/imgproc/imgproc.hpp" +#include "opencv2/imgproc.hpp" #include -#include using namespace std; using namespace cv; @@ -16,12 +15,19 @@ using namespace cv; /** * @function main */ -int main( int, char** argv ) +int main(int argc, char** argv) { Mat src, dst; /// Load image - src = imread( argv[1], 1 ); + String imageName( "../data/lena.jpg" ); // by default + + if (argc > 1) + { + imageName = argv[1]; + } + + src = imread( imageName, IMREAD_COLOR ); if( src.empty() ) { return -1; } diff --git a/samples/cpp/tutorial_code/Histograms_Matching/compareHist_Demo.cpp b/samples/cpp/tutorial_code/Histograms_Matching/compareHist_Demo.cpp index 122e19beb..4d0123b24 100644 --- a/samples/cpp/tutorial_code/Histograms_Matching/compareHist_Demo.cpp +++ b/samples/cpp/tutorial_code/Histograms_Matching/compareHist_Demo.cpp @@ -5,10 +5,9 @@ */ #include "opencv2/imgcodecs.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/imgproc/imgproc.hpp" +#include "opencv2/highgui.hpp" +#include "opencv2/imgproc.hpp" #include -#include using namespace std; using namespace cv; @@ -26,13 +25,19 @@ int main( int argc, char** argv ) /// Load three images with different environment settings if( argc < 4 ) { - printf("** Error. Usage: ./compareHist_Demo \n"); + printf("** Error. Usage: ./compareHist_Demo \n"); return -1; } - src_base = imread( argv[1], 1 ); - src_test1 = imread( argv[2], 1 ); - src_test2 = imread( argv[3], 1 ); + src_base = imread( argv[1], IMREAD_COLOR ); + src_test1 = imread( argv[2], IMREAD_COLOR ); + src_test2 = imread( argv[3], IMREAD_COLOR ); + + if(src_base.empty() || src_test1.empty() || src_test2.empty()) + { + cout << "Can't read one of the images" << endl; + return -1; + } /// Convert to HSV cvtColor( src_base, hsv_base, COLOR_BGR2HSV ); diff --git a/samples/cpp/tutorial_code/ImgProc/AddingImages.cpp b/samples/cpp/tutorial_code/ImgProc/AddingImages.cpp index 32ce10f4b..20b09ec32 100644 --- a/samples/cpp/tutorial_code/ImgProc/AddingImages.cpp +++ b/samples/cpp/tutorial_code/ImgProc/AddingImages.cpp @@ -5,7 +5,7 @@ */ #include "opencv2/imgcodecs.hpp" -#include "opencv2/highgui/highgui.hpp" +#include "opencv2/highgui.hpp" #include using namespace cv; diff --git a/samples/cpp/tutorial_code/ImgProc/BasicLinearTransforms.cpp b/samples/cpp/tutorial_code/ImgProc/BasicLinearTransforms.cpp index 9ffe1563d..b24451de3 100644 --- a/samples/cpp/tutorial_code/ImgProc/BasicLinearTransforms.cpp +++ b/samples/cpp/tutorial_code/ImgProc/BasicLinearTransforms.cpp @@ -5,7 +5,7 @@ */ #include "opencv2/imgcodecs.hpp" -#include "opencv2/highgui/highgui.hpp" +#include "opencv2/highgui.hpp" #include using namespace cv; diff --git a/samples/cpp/tutorial_code/ImgProc/Morphology_1.cpp b/samples/cpp/tutorial_code/ImgProc/Morphology_1.cpp index e8fac9130..626bd8b96 100644 --- a/samples/cpp/tutorial_code/ImgProc/Morphology_1.cpp +++ b/samples/cpp/tutorial_code/ImgProc/Morphology_1.cpp @@ -4,11 +4,9 @@ * @author OpenCV team */ -#include "opencv2/imgproc/imgproc.hpp" +#include "opencv2/imgproc.hpp" #include "opencv2/imgcodecs.hpp" -#include "opencv2/highgui/highgui.hpp" -#include -#include +#include "opencv2/highgui.hpp" using namespace cv; @@ -32,7 +30,7 @@ void Dilation( int, void* ); int main( int, char** argv ) { /// Load an image - src = imread( argv[1] ); + src = imread( argv[1], IMREAD_COLOR ); if( src.empty() ) { return -1; } diff --git a/samples/cpp/tutorial_code/ImgProc/Morphology_2.cpp b/samples/cpp/tutorial_code/ImgProc/Morphology_2.cpp index 3f43eeeed..97304a461 100644 --- a/samples/cpp/tutorial_code/ImgProc/Morphology_2.cpp +++ b/samples/cpp/tutorial_code/ImgProc/Morphology_2.cpp @@ -4,11 +4,9 @@ * @author OpenCV team */ -#include "opencv2/imgproc/imgproc.hpp" +#include "opencv2/imgproc.hpp" #include "opencv2/imgcodecs.hpp" -#include "opencv2/highgui/highgui.hpp" -#include -#include +#include "opencv2/highgui.hpp" using namespace cv; @@ -34,7 +32,7 @@ void Morphology_Operations( int, void* ); int main( int, char** argv ) { /// Load an image - src = imread( argv[1] ); + src = imread( argv[1], IMREAD_COLOR ); if( src.empty() ) { return -1; } @@ -67,7 +65,6 @@ int main( int, char** argv ) */ void Morphology_Operations( int, void* ) { - // Since MORPH_X : 2,3,4,5 and 6 int operation = morph_operator + 2; diff --git a/samples/cpp/tutorial_code/ImgProc/Pyramids.cpp b/samples/cpp/tutorial_code/ImgProc/Pyramids.cpp index c52c0e04f..e4b7096e6 100644 --- a/samples/cpp/tutorial_code/ImgProc/Pyramids.cpp +++ b/samples/cpp/tutorial_code/ImgProc/Pyramids.cpp @@ -4,12 +4,9 @@ * @author OpenCV team */ -#include "opencv2/imgproc/imgproc.hpp" +#include "opencv2/imgproc.hpp" #include "opencv2/imgcodecs.hpp" -#include "opencv2/highgui/highgui.hpp" -#include -#include -#include +#include "opencv2/highgui.hpp" using namespace cv; diff --git a/samples/cpp/tutorial_code/ImgProc/Smoothing.cpp b/samples/cpp/tutorial_code/ImgProc/Smoothing.cpp index e7ac4d40f..6a84da073 100644 --- a/samples/cpp/tutorial_code/ImgProc/Smoothing.cpp +++ b/samples/cpp/tutorial_code/ImgProc/Smoothing.cpp @@ -3,13 +3,10 @@ * brief Sample code for simple filters * author OpenCV team */ -#include -#include -#include "opencv2/imgproc/imgproc.hpp" +#include "opencv2/imgproc.hpp" #include "opencv2/imgcodecs.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/features2d/features2d.hpp" +#include "opencv2/highgui.hpp" using namespace std; using namespace cv; @@ -35,7 +32,7 @@ int main( void ) namedWindow( window_name, WINDOW_AUTOSIZE ); /// Load the source image - src = imread( "../data/lena.jpg", 1 ); + src = imread( "../data/lena.jpg", IMREAD_COLOR ); if( display_caption( "Original Image" ) != 0 ) { return 0; } diff --git a/samples/cpp/tutorial_code/ImgProc/Threshold.cpp b/samples/cpp/tutorial_code/ImgProc/Threshold.cpp index 0944f6cd3..36943028d 100644 --- a/samples/cpp/tutorial_code/ImgProc/Threshold.cpp +++ b/samples/cpp/tutorial_code/ImgProc/Threshold.cpp @@ -4,11 +4,9 @@ * @author OpenCV team */ -#include "opencv2/imgproc/imgproc.hpp" +#include "opencv2/imgproc.hpp" #include "opencv2/imgcodecs.hpp" -#include "opencv2/highgui/highgui.hpp" -#include -#include +#include "opencv2/highgui.hpp" using namespace cv; @@ -35,10 +33,13 @@ void Threshold_Demo( int, void* ); int main( int, char** argv ) { /// Load an image - src = imread( argv[1], 1 ); + src = imread( argv[1], IMREAD_COLOR ); + + if( src.empty() ) + { return -1; } /// Convert the image to Gray - cvtColor( src, src_gray, COLOR_RGB2GRAY ); + cvtColor( src, src_gray, COLOR_BGR2GRAY ); /// Create a window to display results namedWindow( window_name, WINDOW_AUTOSIZE ); diff --git a/samples/cpp/tutorial_code/ImgTrans/CannyDetector_Demo.cpp b/samples/cpp/tutorial_code/ImgTrans/CannyDetector_Demo.cpp index 92e10e4b0..8b94bb320 100644 --- a/samples/cpp/tutorial_code/ImgTrans/CannyDetector_Demo.cpp +++ b/samples/cpp/tutorial_code/ImgTrans/CannyDetector_Demo.cpp @@ -4,11 +4,9 @@ * @author OpenCV team */ -#include "opencv2/imgproc/imgproc.hpp" +#include "opencv2/imgproc.hpp" #include "opencv2/imgcodecs.hpp" -#include "opencv2/highgui/highgui.hpp" -#include -#include +#include "opencv2/highgui.hpp" using namespace cv; @@ -50,7 +48,7 @@ static void CannyThreshold(int, void*) int main( int, char** argv ) { /// Load an image - src = imread( argv[1] ); + src = imread( argv[1], IMREAD_COLOR ); if( src.empty() ) { return -1; } diff --git a/samples/cpp/tutorial_code/ImgTrans/Geometric_Transforms_Demo.cpp b/samples/cpp/tutorial_code/ImgTrans/Geometric_Transforms_Demo.cpp index 00184a3f8..edbb1e738 100644 --- a/samples/cpp/tutorial_code/ImgTrans/Geometric_Transforms_Demo.cpp +++ b/samples/cpp/tutorial_code/ImgTrans/Geometric_Transforms_Demo.cpp @@ -5,10 +5,9 @@ */ #include "opencv2/imgcodecs.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/imgproc/imgproc.hpp" +#include "opencv2/highgui.hpp" +#include "opencv2/imgproc.hpp" #include -#include using namespace cv; using namespace std; @@ -31,7 +30,7 @@ int main( int, char** argv ) Mat src, warp_dst, warp_rotate_dst; /// Load the image - src = imread( argv[1], 1 ); + src = imread( argv[1], IMREAD_COLOR ); /// Set the dst image the same type and size as src warp_dst = Mat::zeros( src.rows, src.cols, src.type() ); diff --git a/samples/cpp/tutorial_code/ImgTrans/HoughCircle_Demo.cpp b/samples/cpp/tutorial_code/ImgTrans/HoughCircle_Demo.cpp index 02f03813f..81bb3f889 100644 --- a/samples/cpp/tutorial_code/ImgTrans/HoughCircle_Demo.cpp +++ b/samples/cpp/tutorial_code/ImgTrans/HoughCircle_Demo.cpp @@ -5,8 +5,8 @@ */ #include "opencv2/imgcodecs.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/imgproc/imgproc.hpp" +#include "opencv2/highgui.hpp" +#include "opencv2/imgproc.hpp" #include using namespace std; @@ -63,7 +63,7 @@ int main(int argc, char** argv) } // Read the image - src = imread( argv[1], 1 ); + src = imread( argv[1], IMREAD_COLOR ); if( src.empty() ) { diff --git a/samples/cpp/tutorial_code/ImgTrans/HoughLines_Demo.cpp b/samples/cpp/tutorial_code/ImgTrans/HoughLines_Demo.cpp index 2d9b7b645..5610cfefe 100644 --- a/samples/cpp/tutorial_code/ImgTrans/HoughLines_Demo.cpp +++ b/samples/cpp/tutorial_code/ImgTrans/HoughLines_Demo.cpp @@ -5,10 +5,9 @@ */ #include "opencv2/imgcodecs.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/imgproc/imgproc.hpp" +#include "opencv2/highgui.hpp" +#include "opencv2/imgproc.hpp" #include -#include using namespace cv; using namespace std; @@ -39,7 +38,7 @@ void Probabilistic_Hough( int, void* ); int main( int, char** argv ) { /// Read the image - src = imread( argv[1], 1 ); + src = imread( argv[1], IMREAD_COLOR ); if( src.empty() ) { help(); diff --git a/samples/cpp/tutorial_code/ImgTrans/Laplace_Demo.cpp b/samples/cpp/tutorial_code/ImgTrans/Laplace_Demo.cpp index f0d45e715..386b26da7 100644 --- a/samples/cpp/tutorial_code/ImgTrans/Laplace_Demo.cpp +++ b/samples/cpp/tutorial_code/ImgTrans/Laplace_Demo.cpp @@ -4,11 +4,9 @@ * @author OpenCV team */ -#include "opencv2/imgproc/imgproc.hpp" +#include "opencv2/imgproc.hpp" #include "opencv2/imgcodecs.hpp" -#include "opencv2/highgui/highgui.hpp" -#include -#include +#include "opencv2/highgui.hpp" using namespace cv; @@ -26,7 +24,7 @@ int main( int, char** argv ) const char* window_name = "Laplace Demo"; /// Load an image - src = imread( argv[1] ); + src = imread( argv[1], IMREAD_COLOR ); if( src.empty() ) { return -1; } diff --git a/samples/cpp/tutorial_code/ImgTrans/Remap_Demo.cpp b/samples/cpp/tutorial_code/ImgTrans/Remap_Demo.cpp index 49727e9cf..b5a76faa4 100644 --- a/samples/cpp/tutorial_code/ImgTrans/Remap_Demo.cpp +++ b/samples/cpp/tutorial_code/ImgTrans/Remap_Demo.cpp @@ -5,10 +5,9 @@ */ #include "opencv2/imgcodecs.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/imgproc/imgproc.hpp" +#include "opencv2/highgui.hpp" +#include "opencv2/imgproc.hpp" #include -#include using namespace cv; @@ -27,7 +26,7 @@ void update_map( void ); int main( int, char** argv ) { /// Load the image - src = imread( argv[1], 1 ); + src = imread( argv[1], IMREAD_COLOR ); /// Create dst, map_x and map_y with the same size as src: dst.create( src.size(), src.type() ); diff --git a/samples/cpp/tutorial_code/ImgTrans/Sobel_Demo.cpp b/samples/cpp/tutorial_code/ImgTrans/Sobel_Demo.cpp index 7d57e8ec6..efe4c7169 100644 --- a/samples/cpp/tutorial_code/ImgTrans/Sobel_Demo.cpp +++ b/samples/cpp/tutorial_code/ImgTrans/Sobel_Demo.cpp @@ -4,11 +4,9 @@ * @author OpenCV team */ -#include "opencv2/imgproc/imgproc.hpp" +#include "opencv2/imgproc.hpp" #include "opencv2/imgcodecs.hpp" -#include "opencv2/highgui/highgui.hpp" -#include -#include +#include "opencv2/highgui.hpp" using namespace cv; @@ -26,7 +24,7 @@ int main( int, char** argv ) int ddepth = CV_16S; /// Load an image - src = imread( argv[1] ); + src = imread( argv[1], IMREAD_COLOR ); if( src.empty() ) { return -1; } diff --git a/samples/cpp/tutorial_code/ImgTrans/copyMakeBorder_demo.cpp b/samples/cpp/tutorial_code/ImgTrans/copyMakeBorder_demo.cpp index 5f786d568..6da2b296b 100644 --- a/samples/cpp/tutorial_code/ImgTrans/copyMakeBorder_demo.cpp +++ b/samples/cpp/tutorial_code/ImgTrans/copyMakeBorder_demo.cpp @@ -4,11 +4,9 @@ * @author OpenCV team */ -#include "opencv2/imgproc/imgproc.hpp" +#include "opencv2/imgproc.hpp" #include "opencv2/imgcodecs.hpp" -#include "opencv2/highgui/highgui.hpp" -#include -#include +#include "opencv2/highgui.hpp" using namespace cv; @@ -28,7 +26,7 @@ int main( int, char** argv ) int c; /// Load an image - src = imread( argv[1] ); + src = imread( argv[1], IMREAD_COLOR ); if( src.empty() ) { diff --git a/samples/cpp/tutorial_code/ImgTrans/filter2D_demo.cpp b/samples/cpp/tutorial_code/ImgTrans/filter2D_demo.cpp index 3c580bb21..6fc04d8f4 100644 --- a/samples/cpp/tutorial_code/ImgTrans/filter2D_demo.cpp +++ b/samples/cpp/tutorial_code/ImgTrans/filter2D_demo.cpp @@ -4,11 +4,9 @@ * @author OpenCV team */ -#include "opencv2/imgproc/imgproc.hpp" +#include "opencv2/imgproc.hpp" #include "opencv2/imgcodecs.hpp" -#include "opencv2/highgui/highgui.hpp" -#include -#include +#include "opencv2/highgui.hpp" using namespace cv; @@ -30,7 +28,7 @@ int main ( int, char** argv ) int c; /// Load an image - src = imread( argv[1] ); + src = imread( argv[1], IMREAD_COLOR ); if( src.empty() ) { return -1; } diff --git a/samples/cpp/tutorial_code/ShapeDescriptors/findContours_demo.cpp b/samples/cpp/tutorial_code/ShapeDescriptors/findContours_demo.cpp index 6a6de9539..b831441b3 100644 --- a/samples/cpp/tutorial_code/ShapeDescriptors/findContours_demo.cpp +++ b/samples/cpp/tutorial_code/ShapeDescriptors/findContours_demo.cpp @@ -5,11 +5,9 @@ */ #include "opencv2/imgcodecs.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/imgproc/imgproc.hpp" +#include "opencv2/highgui.hpp" +#include "opencv2/imgproc.hpp" #include -#include -#include using namespace cv; using namespace std; @@ -28,7 +26,7 @@ void thresh_callback(int, void* ); int main( int, char** argv ) { /// Load source image - src = imread(argv[1]); + src = imread(argv[1], IMREAD_COLOR); if (src.empty()) { cerr << "No image supplied ..." << endl; diff --git a/samples/cpp/tutorial_code/ShapeDescriptors/generalContours_demo1.cpp b/samples/cpp/tutorial_code/ShapeDescriptors/generalContours_demo1.cpp index a9c22e60f..29d75515c 100644 --- a/samples/cpp/tutorial_code/ShapeDescriptors/generalContours_demo1.cpp +++ b/samples/cpp/tutorial_code/ShapeDescriptors/generalContours_demo1.cpp @@ -5,11 +5,9 @@ */ #include "opencv2/imgcodecs.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/imgproc/imgproc.hpp" +#include "opencv2/highgui.hpp" +#include "opencv2/imgproc.hpp" #include -#include -#include using namespace cv; using namespace std; @@ -28,7 +26,7 @@ void thresh_callback(int, void* ); int main( int, char** argv ) { /// Load source image and convert it to gray - src = imread( argv[1], 1 ); + src = imread( argv[1], IMREAD_COLOR ); /// Convert image to gray and blur it cvtColor( src, src_gray, COLOR_BGR2GRAY ); diff --git a/samples/cpp/tutorial_code/ShapeDescriptors/generalContours_demo2.cpp b/samples/cpp/tutorial_code/ShapeDescriptors/generalContours_demo2.cpp index c6fd37932..742c6cf0a 100644 --- a/samples/cpp/tutorial_code/ShapeDescriptors/generalContours_demo2.cpp +++ b/samples/cpp/tutorial_code/ShapeDescriptors/generalContours_demo2.cpp @@ -5,11 +5,9 @@ */ #include "opencv2/imgcodecs.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/imgproc/imgproc.hpp" +#include "opencv2/highgui.hpp" +#include "opencv2/imgproc.hpp" #include -#include -#include using namespace cv; using namespace std; @@ -28,7 +26,7 @@ void thresh_callback(int, void* ); int main( int, char** argv ) { /// Load source image and convert it to gray - src = imread( argv[1], 1 ); + src = imread( argv[1], IMREAD_COLOR ); /// Convert image to gray and blur it cvtColor( src, src_gray, COLOR_BGR2GRAY ); diff --git a/samples/cpp/tutorial_code/ShapeDescriptors/hull_demo.cpp b/samples/cpp/tutorial_code/ShapeDescriptors/hull_demo.cpp index 0b354291a..7fe5b71f9 100644 --- a/samples/cpp/tutorial_code/ShapeDescriptors/hull_demo.cpp +++ b/samples/cpp/tutorial_code/ShapeDescriptors/hull_demo.cpp @@ -5,11 +5,9 @@ */ #include "opencv2/imgcodecs.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/imgproc/imgproc.hpp" +#include "opencv2/highgui.hpp" +#include "opencv2/imgproc.hpp" #include -#include -#include using namespace cv; using namespace std; @@ -28,7 +26,7 @@ void thresh_callback(int, void* ); int main( int, char** argv ) { /// Load source image and convert it to gray - src = imread( argv[1], 1 ); + src = imread( argv[1], IMREAD_COLOR ); /// Convert image to gray and blur it cvtColor( src, src_gray, COLOR_BGR2GRAY ); diff --git a/samples/cpp/tutorial_code/ShapeDescriptors/moments_demo.cpp b/samples/cpp/tutorial_code/ShapeDescriptors/moments_demo.cpp index c3a5cbf60..4064048df 100644 --- a/samples/cpp/tutorial_code/ShapeDescriptors/moments_demo.cpp +++ b/samples/cpp/tutorial_code/ShapeDescriptors/moments_demo.cpp @@ -5,11 +5,9 @@ */ #include "opencv2/imgcodecs.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/imgproc/imgproc.hpp" +#include "opencv2/highgui.hpp" +#include "opencv2/imgproc.hpp" #include -#include -#include using namespace cv; using namespace std; @@ -28,7 +26,7 @@ void thresh_callback(int, void* ); int main( int, char** argv ) { /// Load source image and convert it to gray - src = imread( argv[1], 1 ); + src = imread( argv[1], IMREAD_COLOR ); /// Convert image to gray and blur it cvtColor( src, src_gray, COLOR_BGR2GRAY ); diff --git a/samples/cpp/tutorial_code/ShapeDescriptors/pointPolygonTest_demo.cpp b/samples/cpp/tutorial_code/ShapeDescriptors/pointPolygonTest_demo.cpp index f55f8f687..757b8dc0f 100644 --- a/samples/cpp/tutorial_code/ShapeDescriptors/pointPolygonTest_demo.cpp +++ b/samples/cpp/tutorial_code/ShapeDescriptors/pointPolygonTest_demo.cpp @@ -4,11 +4,9 @@ * @author OpenCV team */ -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/imgproc/imgproc.hpp" +#include "opencv2/highgui.hpp" +#include "opencv2/imgproc.hpp" #include -#include -#include using namespace cv; using namespace std; diff --git a/samples/cpp/tutorial_code/TrackingMotion/cornerDetector_Demo.cpp b/samples/cpp/tutorial_code/TrackingMotion/cornerDetector_Demo.cpp index c5dceab48..52d756152 100644 --- a/samples/cpp/tutorial_code/TrackingMotion/cornerDetector_Demo.cpp +++ b/samples/cpp/tutorial_code/TrackingMotion/cornerDetector_Demo.cpp @@ -3,12 +3,11 @@ * @brief Demo code for detecting corners using OpenCV built-in functions * @author OpenCV team */ + #include "opencv2/imgcodecs.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/imgproc/imgproc.hpp" +#include "opencv2/highgui.hpp" +#include "opencv2/imgproc.hpp" #include -#include -#include using namespace cv; using namespace std; @@ -40,7 +39,7 @@ void myHarris_function( int, void* ); int main( int, char** argv ) { /// Load source image and convert it to gray - src = imread( argv[1], 1 ); + src = imread( argv[1], IMREAD_COLOR ); cvtColor( src, src_gray, COLOR_BGR2GRAY ); /// Set some parameters diff --git a/samples/cpp/tutorial_code/TrackingMotion/cornerHarris_Demo.cpp b/samples/cpp/tutorial_code/TrackingMotion/cornerHarris_Demo.cpp index 4314a97e2..4f1df4b84 100644 --- a/samples/cpp/tutorial_code/TrackingMotion/cornerHarris_Demo.cpp +++ b/samples/cpp/tutorial_code/TrackingMotion/cornerHarris_Demo.cpp @@ -5,11 +5,9 @@ */ #include "opencv2/imgcodecs.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/imgproc/imgproc.hpp" +#include "opencv2/highgui.hpp" +#include "opencv2/imgproc.hpp" #include -#include -#include using namespace cv; using namespace std; @@ -31,7 +29,7 @@ void cornerHarris_demo( int, void* ); int main( int, char** argv ) { /// Load source image and convert it to gray - src = imread( argv[1], 1 ); + src = imread( argv[1], IMREAD_COLOR ); cvtColor( src, src_gray, COLOR_BGR2GRAY ); /// Create a window and a trackbar diff --git a/samples/cpp/tutorial_code/TrackingMotion/cornerSubPix_Demo.cpp b/samples/cpp/tutorial_code/TrackingMotion/cornerSubPix_Demo.cpp index 775e566ce..8e4876bce 100644 --- a/samples/cpp/tutorial_code/TrackingMotion/cornerSubPix_Demo.cpp +++ b/samples/cpp/tutorial_code/TrackingMotion/cornerSubPix_Demo.cpp @@ -5,11 +5,9 @@ */ #include "opencv2/imgcodecs.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/imgproc/imgproc.hpp" +#include "opencv2/highgui.hpp" +#include "opencv2/imgproc.hpp" #include -#include -#include using namespace cv; using namespace std; @@ -32,7 +30,7 @@ void goodFeaturesToTrack_Demo( int, void* ); int main( int, char** argv ) { /// Load source image and convert it to gray - src = imread( argv[1], 1 ); + src = imread( argv[1], IMREAD_COLOR ); cvtColor( src, src_gray, COLOR_BGR2GRAY ); /// Create Window diff --git a/samples/cpp/tutorial_code/TrackingMotion/goodFeaturesToTrack_Demo.cpp b/samples/cpp/tutorial_code/TrackingMotion/goodFeaturesToTrack_Demo.cpp index cff59f539..da357e740 100644 --- a/samples/cpp/tutorial_code/TrackingMotion/goodFeaturesToTrack_Demo.cpp +++ b/samples/cpp/tutorial_code/TrackingMotion/goodFeaturesToTrack_Demo.cpp @@ -5,11 +5,9 @@ */ #include "opencv2/imgcodecs.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/imgproc/imgproc.hpp" +#include "opencv2/highgui.hpp" +#include "opencv2/imgproc.hpp" #include -#include -#include using namespace cv; using namespace std; @@ -32,7 +30,7 @@ void goodFeaturesToTrack_Demo( int, void* ); int main( int, char** argv ) { /// Load source image and convert it to gray - src = imread( argv[1], 1 ); + src = imread( argv[1], IMREAD_COLOR ); cvtColor( src, src_gray, COLOR_BGR2GRAY ); /// Create Window diff --git a/samples/cpp/tutorial_code/calib3d/camera_calibration/camera_calibration.cpp b/samples/cpp/tutorial_code/calib3d/camera_calibration/camera_calibration.cpp index 032251983..580fe7379 100644 --- a/samples/cpp/tutorial_code/calib3d/camera_calibration/camera_calibration.cpp +++ b/samples/cpp/tutorial_code/calib3d/camera_calibration/camera_calibration.cpp @@ -21,7 +21,7 @@ using namespace std; static void help() { cout << "This is a camera calibration sample." << endl - << "Usage: calibration configurationFile" << endl + << "Usage: camera_calibration [configuration_file -- default ./default.xml]" << endl << "Near the sample file you'll find the configuration file, which has detailed help of " "how to edit it. It may be any OpenCV supported file format XML/YAML." << endl; } @@ -415,7 +415,7 @@ int main(int argc, char* argv[]) for(size_t i = 0; i < s.imageList.size(); i++ ) { - view = imread(s.imageList[i], 1); + view = imread(s.imageList[i], IMREAD_COLOR); if(view.empty()) continue; remap(view, rview, map1, map2, INTER_LINEAR); diff --git a/samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/src/Utils.cpp b/samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/src/Utils.cpp index fa2bad442..b548bed46 100644 --- a/samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/src/Utils.cpp +++ b/samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/src/Utils.cpp @@ -11,8 +11,8 @@ #include "ModelRegistration.h" #include "Utils.h" -#include -#include +#include +#include // For text int fontFace = cv::FONT_ITALIC; diff --git a/samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/src/main_detection.cpp b/samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/src/main_detection.cpp index 6de590e68..4808e6413 100644 --- a/samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/src/main_detection.cpp +++ b/samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/src/main_detection.cpp @@ -2,11 +2,11 @@ #include #include // OpenCV -#include +#include #include -#include -#include -#include +#include +#include +#include #include // PnP Tutorial #include "Mesh.h" diff --git a/samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/src/main_registration.cpp b/samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/src/main_registration.cpp index da775a063..5ddb83f0d 100644 --- a/samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/src/main_registration.cpp +++ b/samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/src/main_registration.cpp @@ -1,10 +1,10 @@ // C++ #include // OpenCV -#include -#include -#include -#include +#include +#include +#include +#include // PnP Tutorial #include "Mesh.h" #include "Model.h" diff --git a/samples/cpp/tutorial_code/calib3d/stereoBM/SBM_Sample.cpp b/samples/cpp/tutorial_code/calib3d/stereoBM/SBM_Sample.cpp index 90fa2801b..d114a9582 100644 --- a/samples/cpp/tutorial_code/calib3d/stereoBM/SBM_Sample.cpp +++ b/samples/cpp/tutorial_code/calib3d/stereoBM/SBM_Sample.cpp @@ -4,12 +4,10 @@ * @author A. Huaman */ -#include #include -#include "opencv2/calib3d/calib3d.hpp" -#include "opencv2/core/core.hpp" +#include "opencv2/calib3d.hpp" #include "opencv2/imgcodecs.hpp" -#include "opencv2/highgui/highgui.hpp" +#include "opencv2/highgui.hpp" using namespace cv; diff --git a/samples/cpp/tutorial_code/core/discrete_fourier_transform/discrete_fourier_transform.cpp b/samples/cpp/tutorial_code/core/discrete_fourier_transform/discrete_fourier_transform.cpp index dbebeea92..e23ab1c32 100644 --- a/samples/cpp/tutorial_code/core/discrete_fourier_transform/discrete_fourier_transform.cpp +++ b/samples/cpp/tutorial_code/core/discrete_fourier_transform/discrete_fourier_transform.cpp @@ -1,7 +1,7 @@ -#include "opencv2/core/core.hpp" -#include "opencv2/imgproc/imgproc.hpp" +#include "opencv2/core.hpp" +#include "opencv2/imgproc.hpp" #include "opencv2/imgcodecs.hpp" -#include "opencv2/highgui/highgui.hpp" +#include "opencv2/highgui.hpp" #include diff --git a/samples/cpp/tutorial_code/core/file_input_output/file_input_output.cpp b/samples/cpp/tutorial_code/core/file_input_output/file_input_output.cpp index 8fc722df7..faeacfb96 100644 --- a/samples/cpp/tutorial_code/core/file_input_output/file_input_output.cpp +++ b/samples/cpp/tutorial_code/core/file_input_output/file_input_output.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include diff --git a/samples/cpp/tutorial_code/core/how_to_scan_images/how_to_scan_images.cpp b/samples/cpp/tutorial_code/core/how_to_scan_images/how_to_scan_images.cpp index c673c6659..47a554783 100644 --- a/samples/cpp/tutorial_code/core/how_to_scan_images/how_to_scan_images.cpp +++ b/samples/cpp/tutorial_code/core/how_to_scan_images/how_to_scan_images.cpp @@ -16,7 +16,7 @@ static void help() << " we take an input image and divide the native color palette (255) with the " << endl << "input. Shows C operator[] method, iterators and at function for on-the-fly item address calculation."<< endl << "Usage:" << endl - << "./howToScanImages imageNameToUse divideWith [G]" << endl + << "./how_to_scan_images [G]" << endl << "if you add a G parameter the image is processed in gray scale" << endl << "--------------------------------------------------------------------------" << endl << endl; diff --git a/samples/cpp/tutorial_code/core/interoperability_with_OpenCV_1/interoperability_with_OpenCV_1.cpp b/samples/cpp/tutorial_code/core/interoperability_with_OpenCV_1/interoperability_with_OpenCV_1.cpp index b6aa6131d..79e7c99d8 100644 --- a/samples/cpp/tutorial_code/core/interoperability_with_OpenCV_1/interoperability_with_OpenCV_1.cpp +++ b/samples/cpp/tutorial_code/core/interoperability_with_OpenCV_1/interoperability_with_OpenCV_1.cpp @@ -1,12 +1,9 @@ //! [head] -#include #include -#include -#include +#include #include "opencv2/imgcodecs.hpp" -#include -#include +#include using namespace cv; // The new C++ interface API is inside this namespace. Import it. using namespace std; diff --git a/samples/cpp/tutorial_code/core/mat_mask_operations/mat_mask_operations.cpp b/samples/cpp/tutorial_code/core/mat_mask_operations/mat_mask_operations.cpp index f0cbca169..8eb9ca7ef 100644 --- a/samples/cpp/tutorial_code/core/mat_mask_operations/mat_mask_operations.cpp +++ b/samples/cpp/tutorial_code/core/mat_mask_operations/mat_mask_operations.cpp @@ -1,5 +1,3 @@ -#include -#include #include #include #include @@ -25,38 +23,44 @@ int main( int argc, char* argv[]) help(argv[0]); const char* filename = argc >=2 ? argv[1] : "../data/lena.jpg"; - Mat I, J, K; + Mat src, dst0, dst1; if (argc >= 3 && !strcmp("G", argv[2])) - I = imread( filename, IMREAD_GRAYSCALE); + src = imread( filename, IMREAD_GRAYSCALE); else - I = imread( filename, IMREAD_COLOR); + src = imread( filename, IMREAD_COLOR); + + if (src.empty()) + { + cerr << "Can't open image [" << filename << "]" << endl; + return -1; + } namedWindow("Input", WINDOW_AUTOSIZE); namedWindow("Output", WINDOW_AUTOSIZE); - imshow("Input", I); + imshow( "Input", src ); double t = (double)getTickCount(); - Sharpen(I, J); + Sharpen( src, dst0 ); t = ((double)getTickCount() - t)/getTickFrequency(); cout << "Hand written function times passed in seconds: " << t << endl; - imshow("Output", J); - waitKey(0); + imshow( "Output", dst0 ); + waitKey(); - Mat kern = (Mat_(3,3) << 0, -1, 0, + Mat kernel = (Mat_(3,3) << 0, -1, 0, -1, 5, -1, 0, -1, 0); t = (double)getTickCount(); - filter2D(I, K, I.depth(), kern ); + filter2D( src, dst1, src.depth(), kernel ); t = ((double)getTickCount() - t)/getTickFrequency(); cout << "Built-in filter2D time passed in seconds: " << t << endl; - imshow("Output", K); + imshow( "Output", dst1 ); - waitKey(0); + waitKey(); return 0; } void Sharpen(const Mat& myImage,Mat& Result) diff --git a/samples/cpp/tutorial_code/core/mat_the_basic_image_container/mat_the_basic_image_container.cpp b/samples/cpp/tutorial_code/core/mat_the_basic_image_container/mat_the_basic_image_container.cpp index 7fb060bdd..77ea93827 100644 --- a/samples/cpp/tutorial_code/core/mat_the_basic_image_container/mat_the_basic_image_container.cpp +++ b/samples/cpp/tutorial_code/core/mat_the_basic_image_container/mat_the_basic_image_container.cpp @@ -1,6 +1,6 @@ /* For description look into the help() function. */ -#include "opencv2/core/core.hpp" +#include "opencv2/core.hpp" #include using namespace std; @@ -15,7 +15,7 @@ static void help() << "That is, cv::Mat M(...); M.create and cout << M. " << endl << "Shows how output can be formated to OpenCV, python, numpy, csv and C styles." << endl << "Usage:" << endl - << "./cvout_sample" << endl + << "./mat_the_basic_image_container" << endl << "--------------------------------------------------------------------------" << endl << endl; } diff --git a/samples/cpp/tutorial_code/imgcodecs/GDAL_IO/gdal-image.cpp b/samples/cpp/tutorial_code/imgcodecs/GDAL_IO/gdal-image.cpp index 6e7c950a2..66084df78 100644 --- a/samples/cpp/tutorial_code/imgcodecs/GDAL_IO/gdal-image.cpp +++ b/samples/cpp/tutorial_code/imgcodecs/GDAL_IO/gdal-image.cpp @@ -3,9 +3,9 @@ */ // OpenCV Headers -#include "opencv2/core/core.hpp" -#include "opencv2/imgproc/imgproc.hpp" -#include "opencv2/highgui/highgui.hpp" +#include "opencv2/core.hpp" +#include "opencv2/imgproc.hpp" +#include "opencv2/highgui.hpp" // C++ Standard Libraries #include @@ -159,8 +159,8 @@ int main( int argc, char* argv[] ){ * Check input arguments */ if( argc < 3 ){ - cout << "usage: " << argv[0] << " " << endl; - return 1; + cout << "usage: " << argv[0] << " " << endl; + return -1; } // load the image (note that we don't have the projection information. You will diff --git a/samples/cpp/tutorial_code/introduction/display_image/display_image.cpp b/samples/cpp/tutorial_code/introduction/display_image/display_image.cpp index 558cb66d5..456286741 100644 --- a/samples/cpp/tutorial_code/introduction/display_image/display_image.cpp +++ b/samples/cpp/tutorial_code/introduction/display_image/display_image.cpp @@ -1,7 +1,7 @@ //! [includes] -#include +#include #include -#include +#include #include #include @@ -16,7 +16,7 @@ using namespace std; int main( int argc, char** argv ) { //! [load] - string imageName("../data/HappyFish.jpg"); // by default + String imageName( "../data/HappyFish.jpg" ); // by default if( argc > 1) { imageName = argv[1]; @@ -28,7 +28,7 @@ int main( int argc, char** argv ) //! [mat] //! [imread] - image = imread(imageName.c_str(), IMREAD_COLOR); // Read the file + image = imread( imageName, IMREAD_COLOR ); // Read the file //! [imread] if( image.empty() ) // Check for invalid input diff --git a/samples/cpp/tutorial_code/photo/decolorization/decolor.cpp b/samples/cpp/tutorial_code/photo/decolorization/decolor.cpp index 067bad117..13c1b0c5f 100644 --- a/samples/cpp/tutorial_code/photo/decolorization/decolor.cpp +++ b/samples/cpp/tutorial_code/photo/decolorization/decolor.cpp @@ -27,13 +27,13 @@ using namespace cv; int main(int argc, char *argv[]) { CV_Assert(argc == 2); - Mat I; - I = imread(argv[1]); + Mat src; + src = imread(argv[1], IMREAD_COLOR); - Mat gray = Mat(I.size(),CV_8UC1); - Mat color_boost = Mat(I.size(),CV_8UC3); + Mat gray = Mat(src.size(),CV_8UC1); + Mat color_boost = Mat(src.size(),CV_8UC3); - decolor(I,gray,color_boost); + decolor(src,gray,color_boost); imshow("grayscale",gray); imshow("color_boost",color_boost); waitKey(0); diff --git a/samples/cpp/tutorial_code/photo/non_photorealistic_rendering/npr_demo.cpp b/samples/cpp/tutorial_code/photo/non_photorealistic_rendering/npr_demo.cpp index f81204c88..8a24ddb7e 100644 --- a/samples/cpp/tutorial_code/photo/non_photorealistic_rendering/npr_demo.cpp +++ b/samples/cpp/tutorial_code/photo/non_photorealistic_rendering/npr_demo.cpp @@ -35,9 +35,9 @@ int main(int argc, char* argv[]) int num,type; - Mat I = imread(argv[1]); + Mat src = imread(argv[1], IMREAD_COLOR); - if(I.empty()) + if(src.empty()) { cout << "Image not found" << endl; exit(0); @@ -71,25 +71,25 @@ int main(int argc, char* argv[]) cin >> type; - edgePreservingFilter(I,img,type); + edgePreservingFilter(src,img,type); imshow("Edge Preserve Smoothing",img); } else if(num == 2) { - detailEnhance(I,img); + detailEnhance(src,img); imshow("Detail Enhanced",img); } else if(num == 3) { Mat img1; - pencilSketch(I,img1, img, 10 , 0.1f, 0.03f); + pencilSketch(src,img1, img, 10 , 0.1f, 0.03f); imshow("Pencil Sketch",img1); imshow("Color Pencil Sketch",img); } else if(num == 4) { - stylization(I,img); + stylization(src,img); imshow("Stylization",img); } waitKey(0); diff --git a/samples/cpp/tutorial_code/video/bg_sub.cpp b/samples/cpp/tutorial_code/video/bg_sub.cpp index d37c7bd0f..94799f388 100644 --- a/samples/cpp/tutorial_code/video/bg_sub.cpp +++ b/samples/cpp/tutorial_code/video/bg_sub.cpp @@ -38,9 +38,9 @@ void help() << " OpenCV. You can process both videos (-vid) and images (-img)." << endl << endl << "Usage:" << endl - << "./bs {-vid