From 11ca1c95f8ee86a0f38e48c19605b8f0f4791924 Mon Sep 17 00:00:00 2001 From: Suleyman TURKMEN Date: Mon, 15 Feb 2016 15:37:29 +0200 Subject: [PATCH] update cpp samples and tutorials --- .../jni/DetectionBasedTracker_jni.cpp | 2 +- .../tutorial-2-mixedprocessing/jni/jni_part.cpp | 6 +- samples/cpp/3calibration.cpp | 8 +- samples/cpp/contours2.cpp | 4 +- samples/cpp/convexhull.cpp | 5 +- samples/cpp/cout_mat.cpp | 2 +- samples/cpp/dbt_face_detection.cpp | 12 +-- samples/cpp/delaunay2.cpp | 4 +- samples/cpp/facedetect.cpp | 6 +- samples/cpp/facial_features.cpp | 6 +- samples/cpp/fback.cpp | 6 +- samples/cpp/ffilldemo.cpp | 6 +- samples/cpp/filestorage.cpp | 2 +- samples/cpp/fitellipse.cpp | 5 +- samples/cpp/grabcut.cpp | 4 +- samples/cpp/houghcircles.cpp | 4 +- samples/cpp/houghlines.cpp | 4 +- samples/cpp/image.cpp | 4 +- samples/cpp/image_sequence.cpp | 6 +- samples/cpp/imagelist_creator.cpp | 4 +- samples/cpp/inpaint.cpp | 6 +- samples/cpp/intelperc_capture.cpp | 4 +- samples/cpp/kalman.cpp | 2 +- samples/cpp/laplace.cpp | 6 +- samples/cpp/letter_recog.cpp | 4 +- samples/cpp/lkdemo.cpp | 6 +- samples/cpp/lsd_lines.cpp | 10 +-- samples/cpp/minarea.cpp | 4 +- samples/cpp/morphology2.cpp | 6 +- samples/cpp/openni_capture.cpp | 4 +- samples/cpp/pca.cpp | 4 +- samples/cpp/phase_corr.cpp | 8 +- samples/cpp/polar_transforms.cpp | 95 +++++++++------------- samples/cpp/segment_objects.cpp | 6 +- samples/cpp/squares.cpp | 19 +++-- samples/cpp/starter_imagelist.cpp | 2 +- samples/cpp/starter_video.cpp | 4 +- samples/cpp/stereo_calib.cpp | 6 +- samples/cpp/stereo_match.cpp | 4 +- samples/cpp/tree_engine.cpp | 4 +- .../tutorial_code/HighGUI/AddingImagesTrackbar.cpp | 2 +- .../HighGUI/BasicLinearTransformsTrackbar.cpp | 2 +- .../Histograms_Matching/EqualizeHist_Demo.cpp | 9 +- .../Histograms_Matching/MatchTemplate_Demo.cpp | 24 ++++-- .../Histograms_Matching/calcBackProject_Demo1.cpp | 12 ++- .../Histograms_Matching/calcBackProject_Demo2.cpp | 6 +- .../Histograms_Matching/calcHist_Demo.cpp | 16 ++-- .../Histograms_Matching/compareHist_Demo.cpp | 19 +++-- samples/cpp/tutorial_code/ImgProc/AddingImages.cpp | 2 +- .../ImgProc/BasicLinearTransforms.cpp | 2 +- samples/cpp/tutorial_code/ImgProc/Morphology_1.cpp | 8 +- samples/cpp/tutorial_code/ImgProc/Morphology_2.cpp | 9 +- samples/cpp/tutorial_code/ImgProc/Pyramids.cpp | 7 +- samples/cpp/tutorial_code/ImgProc/Smoothing.cpp | 9 +- samples/cpp/tutorial_code/ImgProc/Threshold.cpp | 13 +-- .../tutorial_code/ImgTrans/CannyDetector_Demo.cpp | 8 +- .../ImgTrans/Geometric_Transforms_Demo.cpp | 7 +- .../tutorial_code/ImgTrans/HoughCircle_Demo.cpp | 6 +- .../cpp/tutorial_code/ImgTrans/HoughLines_Demo.cpp | 7 +- .../cpp/tutorial_code/ImgTrans/Laplace_Demo.cpp | 8 +- samples/cpp/tutorial_code/ImgTrans/Remap_Demo.cpp | 7 +- samples/cpp/tutorial_code/ImgTrans/Sobel_Demo.cpp | 8 +- .../tutorial_code/ImgTrans/copyMakeBorder_demo.cpp | 8 +- .../cpp/tutorial_code/ImgTrans/filter2D_demo.cpp | 8 +- .../ShapeDescriptors/findContours_demo.cpp | 8 +- .../ShapeDescriptors/generalContours_demo1.cpp | 8 +- .../ShapeDescriptors/generalContours_demo2.cpp | 8 +- .../tutorial_code/ShapeDescriptors/hull_demo.cpp | 8 +- .../ShapeDescriptors/moments_demo.cpp | 8 +- .../ShapeDescriptors/pointPolygonTest_demo.cpp | 6 +- .../TrackingMotion/cornerDetector_Demo.cpp | 9 +- .../TrackingMotion/cornerHarris_Demo.cpp | 8 +- .../TrackingMotion/cornerSubPix_Demo.cpp | 8 +- .../TrackingMotion/goodFeaturesToTrack_Demo.cpp | 8 +- .../camera_calibration/camera_calibration.cpp | 4 +- .../real_time_pose_estimation/src/Utils.cpp | 4 +- .../src/main_detection.cpp | 8 +- .../src/main_registration.cpp | 8 +- .../tutorial_code/calib3d/stereoBM/SBM_Sample.cpp | 6 +- .../discrete_fourier_transform.cpp | 6 +- .../core/file_input_output/file_input_output.cpp | 2 +- .../core/how_to_scan_images/how_to_scan_images.cpp | 2 +- .../interoperability_with_OpenCV_1.cpp | 7 +- .../mat_mask_operations/mat_mask_operations.cpp | 30 ++++--- .../mat_the_basic_image_container.cpp | 4 +- .../tutorial_code/imgcodecs/GDAL_IO/gdal-image.cpp | 10 +-- .../introduction/display_image/display_image.cpp | 8 +- .../tutorial_code/photo/decolorization/decolor.cpp | 10 +-- .../non_photorealistic_rendering/npr_demo.cpp | 12 +-- samples/cpp/tutorial_code/video/bg_sub.cpp | 6 +- .../video-input-psnr-ssim.cpp | 10 +-- .../videoio/video-write/video-write.cpp | 6 +- samples/gpu/alpha_comp.cpp | 2 +- samples/gpu/cascadeclassifier.cpp | 6 +- samples/gpu/driver_api_multi.cpp | 2 +- samples/gpu/driver_api_stereo_multi.cpp | 4 +- samples/gpu/multi.cpp | 2 +- samples/gpu/opengl.cpp | 4 +- samples/gpu/opticalflow_nvidia_api.cpp | 3 +- samples/gpu/surf_keypoint_matcher.cpp | 6 +- samples/tapi/camshift.cpp | 6 +- samples/tapi/clahe.cpp | 6 +- samples/tapi/squares.cpp | 4 +- samples/tapi/tvl1_optical_flow.cpp | 4 +- .../FaceDetection/FaceDetection/MainPage.xaml.cpp | 8 +- .../MediaExtensions/OcvTransform/OcvTransform.cpp | 6 +- .../OcvImageProcessing/MainPage.xaml.cpp | 4 +- .../PhoneTutorial/MainPage.xaml.cpp | 4 +- .../PhoneXamlDirect3DApp1Comp/Direct3DInterop.cpp | 6 +- .../OpenCVXaml/OpenCVComponent/OpenCVComponent.cpp | 7 +- 110 files changed, 394 insertions(+), 423 deletions(-) diff --git a/samples/android/face-detection/jni/DetectionBasedTracker_jni.cpp b/samples/android/face-detection/jni/DetectionBasedTracker_jni.cpp index 9fd8494..7d198dc 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 2c09961..72fa0b2 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 12f2c81..7079b6d 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 c5a1fa7..437f76c 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 36e5544..fd22756 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 bf1dfb2..ed2cd71 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 d7409bf..920ae00 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 a370feb..4807cd3 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 39717b7..e9b648a 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 f46fa3f..3ed6a44 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 5fbec69..a044844 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 93bdd67..d10d72e 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 60ea51a..46b4da2 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 b83f617..0cd6c4a 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 b6b4060..726906c 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 bdafffe..26c4dba 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 ddeb3bd..94eec86 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 b5925c6..fc57738 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 14b63e3..6a84fab 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 bdb0231..5b2dc38 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 62d7521..86e6e37 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 daae442..d8a1c32 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 8f9adc6..501a749 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 b33b49c..462f628 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 3d7e34a..0eb67d1 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 3881aa8..5e57aa8 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 4c8c7e0..e0db6c3 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 91ad5a3..ac79db5 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 04e916c..8439080 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 70d4a7c..6c51624 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 35fd0c1..b33a463 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 5e8685f..c3120fe 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 872dda8..3cbc431 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 3c217f6..9162831 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 f53e931..df8459c 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 89df0cc..6f4f714 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 d6bf1b7..2839b03 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 117c9ba..842a649 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 e88b139..4868a63 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 4412588..96b2adf 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 9e04dd9..93a7b48 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 213850f..1834e35 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 45db585..80d4d46 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 ce0e911..1e2fe92 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 1540cd8..27e21e7 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 122e19b..4d0123b 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 32ce10f..20b09ec 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 9ffe156..b24451d 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 e8fac91..626bd8b 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 3f43eee..97304a4 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 c52c0e0..e4b7096 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 e7ac4d4..6a84da0 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 0944f6c..3694302 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 92e10e4..8b94bb3 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 00184a3..edbb1e7 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 02f0381..81bb3f8 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 2d9b7b6..5610cfe 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 f0d45e7..386b26d 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 49727e9..b5a76fa 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 7d57e8e..efe4c71 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 5f786d5..6da2b29 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 3c580bb..6fc04d8 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 6a6de95..b831441 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 a9c22e6..29d7551 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 c6fd379..742c6cf 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 0b35429..7fe5b71 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 c3a5cbf..4064048 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 f55f8f6..757b8dc 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 c5dceab..52d7561 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 4314a97..4f1df4b 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 775e566..8e4876b 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 cff59f5..da357e7 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 0322519..580fe73 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 fa2bad4..b548bed 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 6de590e..4808e64 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 da775a0..5ddb83f 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 90fa280..d114a95 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 dbebeea..e23ab1c 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 8fc722d..faeacfb 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 c673c66..47a5547 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 b6aa613..79e7c99 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 f0cbca1..8eb9ca7 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 7fb060b..77ea938 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 6e7c950..66084df 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 558cb66..4562867 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 067bad1..13c1b0c 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 f81204c..8a24ddb 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 d37c7bd..94799f3 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