diff --git a/3rdparty/lib/armeabi-v7a/libnative_camera_r2.2.0.so b/3rdparty/lib/armeabi-v7a/libnative_camera_r2.2.0.so index faff85416..5b618a874 100755 Binary files a/3rdparty/lib/armeabi-v7a/libnative_camera_r2.2.0.so and b/3rdparty/lib/armeabi-v7a/libnative_camera_r2.2.0.so differ diff --git a/3rdparty/lib/armeabi-v7a/libnative_camera_r2.3.3.so b/3rdparty/lib/armeabi-v7a/libnative_camera_r2.3.3.so index b2dfbad54..846fc88bd 100755 Binary files a/3rdparty/lib/armeabi-v7a/libnative_camera_r2.3.3.so and b/3rdparty/lib/armeabi-v7a/libnative_camera_r2.3.3.so differ diff --git a/3rdparty/lib/armeabi-v7a/libnative_camera_r3.0.1.so b/3rdparty/lib/armeabi-v7a/libnative_camera_r3.0.1.so index b5567092f..80bf459cc 100755 Binary files a/3rdparty/lib/armeabi-v7a/libnative_camera_r3.0.1.so and b/3rdparty/lib/armeabi-v7a/libnative_camera_r3.0.1.so differ diff --git a/3rdparty/lib/armeabi-v7a/libnative_camera_r4.0.0.so b/3rdparty/lib/armeabi-v7a/libnative_camera_r4.0.0.so index b4636df61..e5cc7d296 100755 Binary files a/3rdparty/lib/armeabi-v7a/libnative_camera_r4.0.0.so and b/3rdparty/lib/armeabi-v7a/libnative_camera_r4.0.0.so differ diff --git a/3rdparty/lib/armeabi-v7a/libnative_camera_r4.0.3.so b/3rdparty/lib/armeabi-v7a/libnative_camera_r4.0.3.so index 9068d3b6a..d3cf3b124 100755 Binary files a/3rdparty/lib/armeabi-v7a/libnative_camera_r4.0.3.so and b/3rdparty/lib/armeabi-v7a/libnative_camera_r4.0.3.so differ diff --git a/3rdparty/lib/armeabi-v7a/libnative_camera_r4.1.1.so b/3rdparty/lib/armeabi-v7a/libnative_camera_r4.1.1.so index 140c9d55b..6498151ba 100755 Binary files a/3rdparty/lib/armeabi-v7a/libnative_camera_r4.1.1.so and b/3rdparty/lib/armeabi-v7a/libnative_camera_r4.1.1.so differ diff --git a/3rdparty/lib/armeabi-v7a/libnative_camera_r4.2.0.so b/3rdparty/lib/armeabi-v7a/libnative_camera_r4.2.0.so index ca5cbb901..58bef3455 100755 Binary files a/3rdparty/lib/armeabi-v7a/libnative_camera_r4.2.0.so and b/3rdparty/lib/armeabi-v7a/libnative_camera_r4.2.0.so differ diff --git a/3rdparty/lib/armeabi-v7a/libnative_camera_r4.3.0.so b/3rdparty/lib/armeabi-v7a/libnative_camera_r4.3.0.so index 433a3b91b..ce69b52ea 100755 Binary files a/3rdparty/lib/armeabi-v7a/libnative_camera_r4.3.0.so and b/3rdparty/lib/armeabi-v7a/libnative_camera_r4.3.0.so differ diff --git a/3rdparty/lib/armeabi-v7a/libnative_camera_r4.4.0.so b/3rdparty/lib/armeabi-v7a/libnative_camera_r4.4.0.so index f6fb79a67..3e65fb171 100755 Binary files a/3rdparty/lib/armeabi-v7a/libnative_camera_r4.4.0.so and b/3rdparty/lib/armeabi-v7a/libnative_camera_r4.4.0.so differ diff --git a/3rdparty/lib/armeabi/libnative_camera_r2.2.0.so b/3rdparty/lib/armeabi/libnative_camera_r2.2.0.so index e00ff4a49..68805b589 100755 Binary files a/3rdparty/lib/armeabi/libnative_camera_r2.2.0.so and b/3rdparty/lib/armeabi/libnative_camera_r2.2.0.so differ diff --git a/3rdparty/lib/armeabi/libnative_camera_r2.3.3.so b/3rdparty/lib/armeabi/libnative_camera_r2.3.3.so index 5e6fa0046..88ac3f7e3 100755 Binary files a/3rdparty/lib/armeabi/libnative_camera_r2.3.3.so and b/3rdparty/lib/armeabi/libnative_camera_r2.3.3.so differ diff --git a/3rdparty/lib/armeabi/libnative_camera_r3.0.1.so b/3rdparty/lib/armeabi/libnative_camera_r3.0.1.so index 1c095e1f9..fa41cb250 100755 Binary files a/3rdparty/lib/armeabi/libnative_camera_r3.0.1.so and b/3rdparty/lib/armeabi/libnative_camera_r3.0.1.so differ diff --git a/3rdparty/lib/armeabi/libnative_camera_r4.0.0.so b/3rdparty/lib/armeabi/libnative_camera_r4.0.0.so index 5e543a91d..a305c2b00 100755 Binary files a/3rdparty/lib/armeabi/libnative_camera_r4.0.0.so and b/3rdparty/lib/armeabi/libnative_camera_r4.0.0.so differ diff --git a/3rdparty/lib/armeabi/libnative_camera_r4.0.3.so b/3rdparty/lib/armeabi/libnative_camera_r4.0.3.so index a89085a4d..8c34357cc 100755 Binary files a/3rdparty/lib/armeabi/libnative_camera_r4.0.3.so and b/3rdparty/lib/armeabi/libnative_camera_r4.0.3.so differ diff --git a/3rdparty/lib/armeabi/libnative_camera_r4.1.1.so b/3rdparty/lib/armeabi/libnative_camera_r4.1.1.so index ba479d3ab..a01ee15e2 100755 Binary files a/3rdparty/lib/armeabi/libnative_camera_r4.1.1.so and b/3rdparty/lib/armeabi/libnative_camera_r4.1.1.so differ diff --git a/3rdparty/lib/armeabi/libnative_camera_r4.2.0.so b/3rdparty/lib/armeabi/libnative_camera_r4.2.0.so index bb25fe000..a8ff89465 100755 Binary files a/3rdparty/lib/armeabi/libnative_camera_r4.2.0.so and b/3rdparty/lib/armeabi/libnative_camera_r4.2.0.so differ diff --git a/3rdparty/lib/armeabi/libnative_camera_r4.3.0.so b/3rdparty/lib/armeabi/libnative_camera_r4.3.0.so index 53f50923d..aa1cfd844 100755 Binary files a/3rdparty/lib/armeabi/libnative_camera_r4.3.0.so and b/3rdparty/lib/armeabi/libnative_camera_r4.3.0.so differ diff --git a/3rdparty/lib/armeabi/libnative_camera_r4.4.0.so b/3rdparty/lib/armeabi/libnative_camera_r4.4.0.so index 08a9cfbd5..264f6f217 100755 Binary files a/3rdparty/lib/armeabi/libnative_camera_r4.4.0.so and b/3rdparty/lib/armeabi/libnative_camera_r4.4.0.so differ diff --git a/3rdparty/lib/mips/libnative_camera_r4.0.3.so b/3rdparty/lib/mips/libnative_camera_r4.0.3.so index 9c467b3ec..14dfaf23b 100755 Binary files a/3rdparty/lib/mips/libnative_camera_r4.0.3.so and b/3rdparty/lib/mips/libnative_camera_r4.0.3.so differ diff --git a/3rdparty/lib/mips/libnative_camera_r4.1.1.so b/3rdparty/lib/mips/libnative_camera_r4.1.1.so index 65e6fc673..a37474256 100755 Binary files a/3rdparty/lib/mips/libnative_camera_r4.1.1.so and b/3rdparty/lib/mips/libnative_camera_r4.1.1.so differ diff --git a/3rdparty/lib/mips/libnative_camera_r4.2.0.so b/3rdparty/lib/mips/libnative_camera_r4.2.0.so index 797081002..31cbb3a99 100755 Binary files a/3rdparty/lib/mips/libnative_camera_r4.2.0.so and b/3rdparty/lib/mips/libnative_camera_r4.2.0.so differ diff --git a/3rdparty/lib/mips/libnative_camera_r4.3.0.so b/3rdparty/lib/mips/libnative_camera_r4.3.0.so index 38e0f1846..379fc7003 100755 Binary files a/3rdparty/lib/mips/libnative_camera_r4.3.0.so and b/3rdparty/lib/mips/libnative_camera_r4.3.0.so differ diff --git a/3rdparty/lib/mips/libnative_camera_r4.4.0.so b/3rdparty/lib/mips/libnative_camera_r4.4.0.so index 4545398a3..0f6c83713 100755 Binary files a/3rdparty/lib/mips/libnative_camera_r4.4.0.so and b/3rdparty/lib/mips/libnative_camera_r4.4.0.so differ diff --git a/3rdparty/lib/x86/libnative_camera_r2.3.3.so b/3rdparty/lib/x86/libnative_camera_r2.3.3.so index e24f344d5..5c46b1607 100755 Binary files a/3rdparty/lib/x86/libnative_camera_r2.3.3.so and b/3rdparty/lib/x86/libnative_camera_r2.3.3.so differ diff --git a/3rdparty/lib/x86/libnative_camera_r3.0.1.so b/3rdparty/lib/x86/libnative_camera_r3.0.1.so index 6dbeaea84..77512e5de 100755 Binary files a/3rdparty/lib/x86/libnative_camera_r3.0.1.so and b/3rdparty/lib/x86/libnative_camera_r3.0.1.so differ diff --git a/3rdparty/lib/x86/libnative_camera_r4.0.3.so b/3rdparty/lib/x86/libnative_camera_r4.0.3.so index f78989697..b5de08299 100755 Binary files a/3rdparty/lib/x86/libnative_camera_r4.0.3.so and b/3rdparty/lib/x86/libnative_camera_r4.0.3.so differ diff --git a/3rdparty/lib/x86/libnative_camera_r4.1.1.so b/3rdparty/lib/x86/libnative_camera_r4.1.1.so index 0039050d3..867137410 100755 Binary files a/3rdparty/lib/x86/libnative_camera_r4.1.1.so and b/3rdparty/lib/x86/libnative_camera_r4.1.1.so differ diff --git a/3rdparty/lib/x86/libnative_camera_r4.2.0.so b/3rdparty/lib/x86/libnative_camera_r4.2.0.so index a3d96ba6b..52e9a5792 100755 Binary files a/3rdparty/lib/x86/libnative_camera_r4.2.0.so and b/3rdparty/lib/x86/libnative_camera_r4.2.0.so differ diff --git a/3rdparty/lib/x86/libnative_camera_r4.3.0.so b/3rdparty/lib/x86/libnative_camera_r4.3.0.so index 2770f049e..af898ccad 100755 Binary files a/3rdparty/lib/x86/libnative_camera_r4.3.0.so and b/3rdparty/lib/x86/libnative_camera_r4.3.0.so differ diff --git a/3rdparty/lib/x86/libnative_camera_r4.4.0.so b/3rdparty/lib/x86/libnative_camera_r4.4.0.so index 83a6016e2..108862f56 100755 Binary files a/3rdparty/lib/x86/libnative_camera_r4.4.0.so and b/3rdparty/lib/x86/libnative_camera_r4.4.0.so differ diff --git a/CMakeLists.txt b/CMakeLists.txt index 35d777205..45e5b915f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -116,10 +116,10 @@ endif() OCV_OPTION(WITH_1394 "Include IEEE1394 support" ON IF (NOT ANDROID AND NOT IOS) ) OCV_OPTION(WITH_AVFOUNDATION "Use AVFoundation for Video I/O" ON IF IOS) OCV_OPTION(WITH_CARBON "Use Carbon for UI instead of Cocoa" OFF IF APPLE ) -OCV_OPTION(WITH_CUDA "Include NVidia Cuda Runtime support" ON IF (NOT ANDROID AND NOT IOS) ) -OCV_OPTION(WITH_CUFFT "Include NVidia Cuda Fast Fourier Transform (FFT) library support" ON IF (NOT ANDROID AND NOT IOS) ) -OCV_OPTION(WITH_CUBLAS "Include NVidia Cuda Basic Linear Algebra Subprograms (BLAS) library support" OFF IF (NOT ANDROID AND NOT IOS) ) -OCV_OPTION(WITH_NVCUVID "Include NVidia Video Decoding library support" OFF IF (NOT ANDROID AND NOT IOS AND NOT APPLE) ) +OCV_OPTION(WITH_CUDA "Include NVidia Cuda Runtime support" ON IF (NOT IOS) ) +OCV_OPTION(WITH_CUFFT "Include NVidia Cuda Fast Fourier Transform (FFT) library support" ON IF (NOT IOS) ) +OCV_OPTION(WITH_CUBLAS "Include NVidia Cuda Basic Linear Algebra Subprograms (BLAS) library support" OFF IF (NOT IOS) ) +OCV_OPTION(WITH_NVCUVID "Include NVidia Video Decoding library support" OFF IF (NOT IOS AND NOT APPLE) ) OCV_OPTION(WITH_EIGEN "Include Eigen2/Eigen3 support" ON) OCV_OPTION(WITH_VFW "Include Video for Windows support" ON IF WIN32 ) OCV_OPTION(WITH_FFMPEG "Include FFMPEG support" ON IF (NOT ANDROID AND NOT IOS)) diff --git a/apps/traincascade/boost.cpp b/apps/traincascade/boost.cpp index 5b244c8b3..ac2303300 100644 --- a/apps/traincascade/boost.cpp +++ b/apps/traincascade/boost.cpp @@ -14,6 +14,19 @@ using cv::FileNodeIterator; using cv::ParallelLoopBody; +using cv::Size; +using cv::Mat; +using cv::Point; +using cv::FileStorage; +using cv::Rect; +using cv::Ptr; +using cv::FileNode; +using cv::Mat_; +using cv::Range; +using cv::FileNodeIterator; +using cv::ParallelLoopBody; + + #include "boost.h" #include "cascadeclassifier.h" #include diff --git a/apps/traincascade/cascadeclassifier.cpp b/apps/traincascade/cascadeclassifier.cpp index 31bd1bee4..de26557dc 100644 --- a/apps/traincascade/cascadeclassifier.cpp +++ b/apps/traincascade/cascadeclassifier.cpp @@ -137,6 +137,9 @@ bool CvCascadeClassifier::train( const string _cascadeDirName, const CvCascadeBoostParams& _stageParams, bool baseFormatSave ) { + // Start recording clock ticks for training time output + const clock_t begin_time = clock(); + if( _cascadeDirName.empty() || _posFilename.empty() || _negFilename.empty() ) CV_Error( CV_StsBadArg, "_cascadeDirName or _bgfileName or _vecFileName is NULL" ); @@ -247,6 +250,14 @@ bool CvCascadeClassifier::train( const string _cascadeDirName, fs << FileStorage::getDefaultObjectName(stageFilename) << "{"; tempStage->write( fs, Mat() ); fs << "}"; + + // Output training time up till now + float seconds = float( clock () - begin_time ) / CLOCKS_PER_SEC; + int days = int(seconds) / 60 / 60 / 24; + int hours = (int(seconds) / 60 / 60) % 24; + int minutes = (int(seconds) / 60) % 60; + int seconds_left = int(seconds) % 60; + cout << "Training until now has taken " << days << " days " << hours << " hours " << minutes << " minutes " << seconds_left <<" seconds." << endl; } if(stageClassifiers.size() == 0) @@ -310,6 +321,7 @@ int CvCascadeClassifier::fillPassedSamples( int first, int count, bool isPositiv if( predict( i ) == 1.0F ) { getcount++; + printf("%s current samples: %d\r", isPositive ? "POS":"NEG", getcount); break; } } diff --git a/cmake/FindCUDA.cmake b/cmake/FindCUDA.cmake index 35f6497c9..e7ece0e21 100644 --- a/cmake/FindCUDA.cmake +++ b/cmake/FindCUDA.cmake @@ -759,11 +759,15 @@ endif() set(CUDA_VERSION_STRING "${CUDA_VERSION}") # Support for arm cross compilation with CUDA 5.5 -if(CUDA_VERSION VERSION_GREATER "5.0" AND CMAKE_CROSSCOMPILING AND ${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm" AND EXISTS "${CUDA_TOOLKIT_ROOT_DIR}/targets/armv7-linux-gnueabihf") - set(CUDA_TOOLKIT_TARGET_DIR "${CUDA_TOOLKIT_ROOT_DIR}/targets/armv7-linux-gnueabihf" CACHE PATH "Toolkit target location.") -else() - set(CUDA_TOOLKIT_TARGET_DIR "${CUDA_TOOLKIT_ROOT_DIR}" CACHE PATH "Toolkit target location.") +set(__cuda_toolkit_target_dir_initial "${CUDA_TOOLKIT_ROOT_DIR}") +if(CUDA_VERSION VERSION_GREATER "5.0" AND CMAKE_CROSSCOMPILING AND ${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm") + if(ANDROID AND EXISTS "${CUDA_TOOLKIT_ROOT_DIR}/targets/armv7-linux-androideabi") + set(__cuda_toolkit_target_dir_initial "${CUDA_TOOLKIT_ROOT_DIR}/targets/armv7-linux-androideabi") + elseif(EXISTS "${CUDA_TOOLKIT_ROOT_DIR}/targets/armv7-linux-gnueabihf") + set(__cuda_toolkit_target_dir_initial "${CUDA_TOOLKIT_ROOT_DIR}/targets/armv7-linux-gnueabihf") + endif() endif() +set(CUDA_TOOLKIT_TARGET_DIR "${__cuda_toolkit_target_dir_initial}" CACHE PATH "Toolkit target location.") mark_as_advanced(CUDA_TOOLKIT_TARGET_DIR) # Target CPU architecture diff --git a/cmake/OpenCVCompilerOptions.cmake b/cmake/OpenCVCompilerOptions.cmake index 84924b385..fd36a45c6 100644 --- a/cmake/OpenCVCompilerOptions.cmake +++ b/cmake/OpenCVCompilerOptions.cmake @@ -181,9 +181,6 @@ if(CMAKE_COMPILER_IS_GNUCXX) set(OPENCV_EXTRA_FLAGS_RELEASE "${OPENCV_EXTRA_FLAGS_RELEASE} -DNDEBUG") set(OPENCV_EXTRA_FLAGS_DEBUG "${OPENCV_EXTRA_FLAGS_DEBUG} -O0 -DDEBUG -D_DEBUG") - if(BUILD_WITH_DEBUG_INFO) - set(OPENCV_EXTRA_FLAGS_DEBUG "${OPENCV_EXTRA_FLAGS_DEBUG} -ggdb3") - endif() endif() if(MSVC) diff --git a/cmake/OpenCVDetectCUDA.cmake b/cmake/OpenCVDetectCUDA.cmake index 87dc4d178..f655ce8cd 100644 --- a/cmake/OpenCVDetectCUDA.cmake +++ b/cmake/OpenCVDetectCUDA.cmake @@ -88,12 +88,17 @@ if(CUDA_FOUND) endif() if(NOT DEFINED __cuda_arch_bin) - if(${CUDA_VERSION} VERSION_LESS "5.0") - set(__cuda_arch_bin "1.1 1.2 1.3 2.0 2.1(2.0) 3.0") + if(ANDROID) + set(__cuda_arch_bin "3.2") + set(__cuda_arch_ptx "") else() - set(__cuda_arch_bin "1.1 1.2 1.3 2.0 2.1(2.0) 3.0 3.5") + if(${CUDA_VERSION} VERSION_LESS "5.0") + set(__cuda_arch_bin "1.1 1.2 1.3 2.0 2.1(2.0) 3.0") + else() + set(__cuda_arch_bin "1.1 1.2 1.3 2.0 2.1(2.0) 3.0 3.5") + endif() + set(__cuda_arch_ptx "3.0") endif() - set(__cuda_arch_ptx "3.0") endif() set(CUDA_ARCH_BIN ${__cuda_arch_bin} CACHE STRING "Specify 'real' GPU architectures to build binaries for, BIN(PTX) format is supported") @@ -145,6 +150,11 @@ if(CUDA_FOUND) set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} ${NVCC_FLAGS_EXTRA}) set(OpenCV_CUDA_CC "${NVCC_FLAGS_EXTRA}") + if(ANDROID) + set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-Xptxas;-dlcm=ca") + set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-target-os-variant=Android") + endif() + message(STATUS "CUDA NVCC target flags: ${CUDA_NVCC_FLAGS}") OCV_OPTION(CUDA_FAST_MATH "Enable --use_fast_math for CUDA compiler " OFF) @@ -171,6 +181,14 @@ if(CUDA_FOUND) # we remove -fvisibility-inlines-hidden because it's used for C++ compiler # but NVCC uses C compiler by default string(REPLACE "-fvisibility-inlines-hidden" "" ${var} "${${var}}") + + # we remove -Wno-delete-non-virtual-dtor because it's used for C++ compiler + # but NVCC uses C compiler by default + string(REPLACE "-Wno-delete-non-virtual-dtor" "" ${var} "${${var}}") + + # we remove -frtti because it's used for C++ compiler + # but NVCC uses C compiler by default + string(REPLACE "-frtti" "" ${var} "${${var}}") endforeach() if(BUILD_SHARED_LIBS) diff --git a/doc/opencv_cheatsheet.tex b/doc/opencv_cheatsheet.tex index fc0c0fa41..d6c339916 100644 --- a/doc/opencv_cheatsheet.tex +++ b/doc/opencv_cheatsheet.tex @@ -437,7 +437,7 @@ Example. Decimate image by factor of $\sqrt{2}$:\\ \texttt{\href{http://docs.opencv.org/modules/imgproc/doc/miscellaneous_transformations.html\#watershed}{watershed()}}, \texttt{\href{http://docs.opencv.org/modules/imgproc/doc/miscellaneous_transformations.html\#grabcut}{grabCut()}} & marker-based image segmentation algorithms. - See the samples \texttt{\href{http://code.opencv.org/projects/opencv/repository/revisions/master/entry/samples/cpp/watershed.cpp}{watershed.cpp}} and \texttt{\href{http://code.opencv.org/projects/opencv/repository/revisions/master/entry/samples/cpp/grabcut.cpp}{grabcut.cpp}}. + See the samples \texttt{\href{https://github.com/Itseez/opencv/tree/master/samples/cpp/watershed.cpp}{watershed.cpp}} and \texttt{\href{https://github.com/Itseez/opencv/tree/master/samples/cpp/grabcut.cpp}{grabcut.cpp}}. \end{tabular} @@ -465,7 +465,7 @@ Example. Compute Hue-Saturation histogram of an image:\\ \end{tabbing} \subsection{Contours} -See \texttt{\href{http://code.opencv.org/projects/opencv/repository/revisions/master/entry/samples/cpp/contours2.cpp}{contours2.cpp}} and \texttt{\href{http://code.opencv.org/projects/opencv/repository/revisions/master/entry/samples/cpp/squares.cpp}{squares.cpp}} +See \texttt{\href{https://github.com/Itseez/opencv/tree/master/samples/cpp/contours2.cpp}{contours2.cpp}} and \texttt{\href{https://github.com/Itseez/opencv/tree/master/samples/cpp/squares.cpp}{squares.cpp}} samples on what are the contours and how to use them. \section{Data I/O} @@ -559,7 +559,7 @@ samples on what are the contours and how to use them. \end{tabular} -See \texttt{\href{http://code.opencv.org/projects/opencv/repository/revisions/master/entry/samples/cpp/camshiftdemo.cpp}{camshiftdemo.cpp}} and other \href{http://code.opencv.org/projects/opencv/repository/revisions/master/entry/samples/}{OpenCV samples} on how to use the GUI functions. +See \texttt{\href{https://github.com/Itseez/opencv/tree/master/samples/cpp/camshiftdemo.cpp}{camshiftdemo.cpp}} and other \href{https://github.com/Itseez/opencv/tree/master/samples/}{OpenCV samples} on how to use the GUI functions. \section{Camera Calibration, Pose Estimation and Depth Estimation} @@ -586,10 +586,10 @@ See \texttt{\href{http://code.opencv.org/projects/opencv/repository/revisions/ma \end{tabular} -To calibrate a camera, you can use \texttt{\href{http://code.opencv.org/projects/opencv/repository/revisions/master/entry/samples/cpp/calibration.cpp}{calibration.cpp}} or -\texttt{\href{http://code.opencv.org/projects/opencv/repository/revisions/master/entry/samples/cpp/stereo\_calib.cpp}{stereo\_calib.cpp}} samples. +To calibrate a camera, you can use \texttt{\href{https://github.com/Itseez/opencv/tree/master/samples/cpp/calibration.cpp}{calibration.cpp}} or +\texttt{\href{https://github.com/Itseez/opencv/tree/master/samples/cpp/stereo\_calib.cpp}{stereo\_calib.cpp}} samples. To get the disparity maps and the point clouds, use -\texttt{\href{http://code.opencv.org/projects/opencv/repository/revisions/master/entry/samples/cpp/stereo\_match.cpp}{stereo\_match.cpp}} sample. +\texttt{\href{https://github.com/Itseez/opencv/tree/master/samples/cpp/stereo\_match.cpp}{stereo\_match.cpp}} sample. \section{Object Detection} @@ -597,9 +597,9 @@ To get the disparity maps and the point clouds, use @{}p{\linewidth-\the\MyLen}@{}} \texttt{\href{http://docs.opencv.org/modules/imgproc/doc/object_detection.html\#matchtemplate}{matchTemplate}} & Compute proximity map for given template.\\ -\texttt{\href{http://docs.opencv.org/modules/objdetect/doc/cascade_classification.html\#cascadeclassifier}{CascadeClassifier}} & Viola's Cascade of Boosted classifiers using Haar or LBP features. Suits for detecting faces, facial features and some other objects without diverse textures. See \texttt{\href{http://code.opencv.org/projects/opencv/repository/revisions/master/entry/samples/c/facedetect.cpp}{facedetect.cpp}}\\ +\texttt{\href{http://docs.opencv.org/modules/objdetect/doc/cascade_classification.html\#cascadeclassifier}{CascadeClassifier}} & Viola's Cascade of Boosted classifiers using Haar or LBP features. Suits for detecting faces, facial features and some other objects without diverse textures. See \texttt{\href{https://github.com/Itseez/opencv/tree/master/samples/c/facedetect.cpp}{facedetect.cpp}}\\ -\texttt{{HOGDescriptor}} & N. Dalal's object detector using Histogram-of-Oriented-Gradients (HOG) features. Suits for detecting people, cars and other objects with well-defined silhouettes. See \texttt{\href{http://code.opencv.org/projects/opencv/repository/revisions/master/entry/samples/cpp/peopledetect.cpp}{peopledetect.cpp}}\\ +\texttt{{HOGDescriptor}} & N. Dalal's object detector using Histogram-of-Oriented-Gradients (HOG) features. Suits for detecting people, cars and other objects with well-defined silhouettes. See \texttt{\href{https://github.com/Itseez/opencv/tree/master/samples/cpp/peopledetect.cpp}{peopledetect.cpp}}\\ \end{tabular} diff --git a/doc/tutorials/core/basic_geometric_drawing/basic_geometric_drawing.rst b/doc/tutorials/core/basic_geometric_drawing/basic_geometric_drawing.rst index 361d1eee5..b4b4fcd29 100644 --- a/doc/tutorials/core/basic_geometric_drawing/basic_geometric_drawing.rst +++ b/doc/tutorials/core/basic_geometric_drawing/basic_geometric_drawing.rst @@ -56,7 +56,7 @@ Scalar Code ===== -* This code is in your OpenCV sample folder. Otherwise you can grab it from `here `_ +* This code is in your OpenCV sample folder. Otherwise you can grab it from `here `_ Explanation ============= diff --git a/doc/tutorials/features2d/feature_description/feature_description.rst b/doc/tutorials/features2d/feature_description/feature_description.rst index b6e2dfa2b..967b32d71 100644 --- a/doc/tutorials/features2d/feature_description/feature_description.rst +++ b/doc/tutorials/features2d/feature_description/feature_description.rst @@ -23,7 +23,7 @@ Theory Code ==== -This tutorial code's is shown lines below. You can also download it from `here `_ +This tutorial code's is shown lines below. You can also download it from `here `_ .. code-block:: cpp diff --git a/doc/tutorials/features2d/feature_flann_matcher/feature_flann_matcher.rst b/doc/tutorials/features2d/feature_flann_matcher/feature_flann_matcher.rst index 9839c8984..e4630c97a 100644 --- a/doc/tutorials/features2d/feature_flann_matcher/feature_flann_matcher.rst +++ b/doc/tutorials/features2d/feature_flann_matcher/feature_flann_matcher.rst @@ -19,97 +19,10 @@ Theory Code ==== -This tutorial code's is shown lines below. You can also download it from `here `_ +This tutorial code's is shown lines below. You can also download it from `here `_ -.. code-block:: cpp - - #include - #include - #include "opencv2/core.hpp" - #include "opencv2/features2d.hpp" - #include "opencv2/highgui.hpp" - #include "opencv2/nonfree.hpp" - - using namespace cv; - - void readme(); - - /** @function main */ - int main( int argc, char** argv ) - { - if( argc != 3 ) - { readme(); return -1; } - - Mat img_1 = imread( argv[1], CV_LOAD_IMAGE_GRAYSCALE ); - Mat img_2 = imread( argv[2], CV_LOAD_IMAGE_GRAYSCALE ); - - if( !img_1.data || !img_2.data ) - { std::cout<< " --(!) Error reading images " << std::endl; return -1; } - - //-- Step 1: Detect the keypoints using SURF Detector - int minHessian = 400; - - SurfFeatureDetector detector( minHessian ); - - std::vector keypoints_1, keypoints_2; - - detector.detect( img_1, keypoints_1 ); - detector.detect( img_2, keypoints_2 ); - - //-- Step 2: Calculate descriptors (feature vectors) - SurfDescriptorExtractor extractor; - - Mat descriptors_1, descriptors_2; - - extractor.compute( img_1, keypoints_1, descriptors_1 ); - extractor.compute( img_2, keypoints_2, descriptors_2 ); - - //-- Step 3: Matching descriptor vectors using FLANN matcher - FlannBasedMatcher matcher; - std::vector< DMatch > matches; - matcher.match( descriptors_1, descriptors_2, matches ); - - double max_dist = 0; double min_dist = 100; - - //-- Quick calculation of max and min distances between keypoints - for( int i = 0; i < descriptors_1.rows; i++ ) - { double dist = matches[i].distance; - if( dist < min_dist ) min_dist = dist; - if( dist > max_dist ) max_dist = dist; - } - - printf("-- Max dist : %f \n", max_dist ); - printf("-- Min dist : %f \n", min_dist ); - - //-- Draw only "good" matches (i.e. whose distance is less than 2*min_dist ) - //-- PS.- radiusMatch can also be used here. - std::vector< DMatch > good_matches; - - for( int i = 0; i < descriptors_1.rows; i++ ) - { if( matches[i].distance <= 2*min_dist ) - { good_matches.push_back( matches[i]); } - } - - //-- Draw only "good" matches - Mat img_matches; - drawMatches( img_1, keypoints_1, img_2, keypoints_2, - good_matches, img_matches, Scalar::all(-1), Scalar::all(-1), - vector(), DrawMatchesFlags::NOT_DRAW_SINGLE_POINTS ); - - //-- Show detected matches - imshow( "Good Matches", img_matches ); - - for( int i = 0; i < good_matches.size(); i++ ) - { printf( "-- Good Match [%d] Keypoint 1: %d -- Keypoint 2: %d \n", i, good_matches[i].queryIdx, good_matches[i].trainIdx ); } - - waitKey(0); - - return 0; - } - - /** @function readme */ - void readme() - { std::cout << " Usage: ./SURF_FlannMatcher " << std::endl; } +.. literalinclude:: ../../../../samples/cpp/tutorial_code/features2D/SURF_FlannMatcher.cpp + :language: cpp Explanation ============ diff --git a/doc/tutorials/features2d/trackingmotion/corner_subpixeles/corner_subpixeles.rst b/doc/tutorials/features2d/trackingmotion/corner_subpixeles/corner_subpixeles.rst index 4e9015cb6..f0d018870 100644 --- a/doc/tutorials/features2d/trackingmotion/corner_subpixeles/corner_subpixeles.rst +++ b/doc/tutorials/features2d/trackingmotion/corner_subpixeles/corner_subpixeles.rst @@ -19,7 +19,7 @@ Theory Code ==== -This tutorial code's is shown lines below. You can also download it from `here `_ +This tutorial code's is shown lines below. You can also download it from `here `_ .. code-block:: cpp diff --git a/doc/tutorials/features2d/trackingmotion/generic_corner_detector/generic_corner_detector.rst b/doc/tutorials/features2d/trackingmotion/generic_corner_detector/generic_corner_detector.rst index d33bf3df6..5cfcde2e7 100644 --- a/doc/tutorials/features2d/trackingmotion/generic_corner_detector/generic_corner_detector.rst +++ b/doc/tutorials/features2d/trackingmotion/generic_corner_detector/generic_corner_detector.rst @@ -20,7 +20,7 @@ Theory Code ==== -This tutorial code's is shown lines below. You can also download it from `here `_ +This tutorial code's is shown lines below. You can also download it from `here `_ .. literalinclude:: ../../../../../samples/cpp/tutorial_code/TrackingMotion/cornerDetector_Demo.cpp :language: cpp diff --git a/doc/tutorials/features2d/trackingmotion/good_features_to_track/good_features_to_track.rst b/doc/tutorials/features2d/trackingmotion/good_features_to_track/good_features_to_track.rst index 1495befc7..52e1eb463 100644 --- a/doc/tutorials/features2d/trackingmotion/good_features_to_track/good_features_to_track.rst +++ b/doc/tutorials/features2d/trackingmotion/good_features_to_track/good_features_to_track.rst @@ -18,7 +18,7 @@ Theory Code ==== -This tutorial code's is shown lines below. You can also download it from `here `_ +This tutorial code's is shown lines below. You can also download it from `here `_ .. code-block:: cpp diff --git a/doc/tutorials/features2d/trackingmotion/harris_detector/harris_detector.rst b/doc/tutorials/features2d/trackingmotion/harris_detector/harris_detector.rst index e0e4ea47e..d2c12fc84 100644 --- a/doc/tutorials/features2d/trackingmotion/harris_detector/harris_detector.rst +++ b/doc/tutorials/features2d/trackingmotion/harris_detector/harris_detector.rst @@ -151,7 +151,7 @@ How does it work? Code ==== -This tutorial code's is shown lines below. You can also download it from `here `_ +This tutorial code's is shown lines below. You can also download it from `here `_ .. code-block:: cpp diff --git a/doc/tutorials/imgproc/erosion_dilatation/erosion_dilatation.rst b/doc/tutorials/imgproc/erosion_dilatation/erosion_dilatation.rst index f313cb908..0f8f5fd91 100644 --- a/doc/tutorials/imgproc/erosion_dilatation/erosion_dilatation.rst +++ b/doc/tutorials/imgproc/erosion_dilatation/erosion_dilatation.rst @@ -70,7 +70,7 @@ Erosion Code ====== -This tutorial code's is shown lines below. You can also download it from `here `_ +This tutorial code's is shown lines below. You can also download it from `here `_ .. code-block:: cpp diff --git a/doc/tutorials/imgproc/gausian_median_blur_bilateral_filter/gausian_median_blur_bilateral_filter.rst b/doc/tutorials/imgproc/gausian_median_blur_bilateral_filter/gausian_median_blur_bilateral_filter.rst index b470d51ea..0c72a0ab4 100644 --- a/doc/tutorials/imgproc/gausian_median_blur_bilateral_filter/gausian_median_blur_bilateral_filter.rst +++ b/doc/tutorials/imgproc/gausian_median_blur_bilateral_filter/gausian_median_blur_bilateral_filter.rst @@ -115,7 +115,7 @@ Code * Applies 4 different kinds of filters (explained in Theory) and show the filtered images sequentially * **Downloadable code**: - Click `here `_ + Click `here `_ * **Code at glance:** diff --git a/doc/tutorials/imgproc/histograms/back_projection/back_projection.rst b/doc/tutorials/imgproc/histograms/back_projection/back_projection.rst index c456c9e93..fbb7dc4dd 100644 --- a/doc/tutorials/imgproc/histograms/back_projection/back_projection.rst +++ b/doc/tutorials/imgproc/histograms/back_projection/back_projection.rst @@ -99,9 +99,9 @@ Code * **Downloadable code**: - a. Click `here `_ for the basic version (explained in this tutorial). - b. For stuff slightly fancier (using H-S histograms and floodFill to define a mask for the skin area) you can check the `improved demo `_ - c. ...or you can always check out the classical `camshiftdemo `_ in samples. + a. Click `here `_ for the basic version (explained in this tutorial). + b. For stuff slightly fancier (using H-S histograms and floodFill to define a mask for the skin area) you can check the `improved demo `_ + c. ...or you can always check out the classical `camshiftdemo `_ in samples. * **Code at glance:** diff --git a/doc/tutorials/imgproc/histograms/histogram_calculation/histogram_calculation.rst b/doc/tutorials/imgproc/histograms/histogram_calculation/histogram_calculation.rst index 9277a101d..9a0b4b645 100644 --- a/doc/tutorials/imgproc/histograms/histogram_calculation/histogram_calculation.rst +++ b/doc/tutorials/imgproc/histograms/histogram_calculation/histogram_calculation.rst @@ -82,7 +82,7 @@ Code * Plot the three histograms in a window * **Downloadable code**: - Click `here `_ + Click `here `_ * **Code at glance:** diff --git a/doc/tutorials/imgproc/histograms/histogram_comparison/histogram_comparison.rst b/doc/tutorials/imgproc/histograms/histogram_comparison/histogram_comparison.rst index 1b1df197d..6a8345d69 100644 --- a/doc/tutorials/imgproc/histograms/histogram_comparison/histogram_comparison.rst +++ b/doc/tutorials/imgproc/histograms/histogram_comparison/histogram_comparison.rst @@ -80,7 +80,7 @@ Code * Display the numerical matching parameters obtained. * **Downloadable code**: - Click `here `_ + Click `here `_ * **Code at glance:** diff --git a/doc/tutorials/imgproc/histograms/histogram_equalization/histogram_equalization.rst b/doc/tutorials/imgproc/histograms/histogram_equalization/histogram_equalization.rst index 8f0c96f5e..7004da738 100644 --- a/doc/tutorials/imgproc/histograms/histogram_equalization/histogram_equalization.rst +++ b/doc/tutorials/imgproc/histograms/histogram_equalization/histogram_equalization.rst @@ -83,7 +83,7 @@ Code * Display the source and equalized images in a window. * **Downloadable code**: - Click `here `_ + Click `here `_ * **Code at glance:** diff --git a/doc/tutorials/imgproc/histograms/template_matching/template_matching.rst b/doc/tutorials/imgproc/histograms/template_matching/template_matching.rst index afe15ee0d..f4b30ef89 100644 --- a/doc/tutorials/imgproc/histograms/template_matching/template_matching.rst +++ b/doc/tutorials/imgproc/histograms/template_matching/template_matching.rst @@ -125,7 +125,7 @@ Code * Draw a rectangle around the area corresponding to the highest match * **Downloadable code**: - Click `here `_ + Click `here `_ * **Code at glance:** diff --git a/doc/tutorials/imgproc/imgtrans/canny_detector/canny_detector.rst b/doc/tutorials/imgproc/imgtrans/canny_detector/canny_detector.rst index ae2d0c8ac..c516fea21 100644 --- a/doc/tutorials/imgproc/imgtrans/canny_detector/canny_detector.rst +++ b/doc/tutorials/imgproc/imgtrans/canny_detector/canny_detector.rst @@ -86,7 +86,7 @@ Code * Applies the *Canny Detector* and generates a **mask** (bright lines representing the edges on a black background). * Applies the mask obtained on the original image and display it in a window. -#. The tutorial code's is shown lines below. You can also download it from `here `_ +#. The tutorial code's is shown lines below. You can also download it from `here `_ .. code-block:: cpp diff --git a/doc/tutorials/imgproc/imgtrans/copyMakeBorder/copyMakeBorder.rst b/doc/tutorials/imgproc/imgtrans/copyMakeBorder/copyMakeBorder.rst index 1f72f1366..a8ba92b1e 100644 --- a/doc/tutorials/imgproc/imgtrans/copyMakeBorder/copyMakeBorder.rst +++ b/doc/tutorials/imgproc/imgtrans/copyMakeBorder/copyMakeBorder.rst @@ -47,7 +47,7 @@ Code The user chooses either option by pressing 'c' (constant) or 'r' (replicate) * The program finishes when the user presses 'ESC' -#. The tutorial code's is shown lines below. You can also download it from `here `_ +#. The tutorial code's is shown lines below. You can also download it from `here `_ .. code-block:: cpp diff --git a/doc/tutorials/imgproc/imgtrans/filter_2d/filter_2d.rst b/doc/tutorials/imgproc/imgtrans/filter_2d/filter_2d.rst index 5ea70cc39..933f8888c 100644 --- a/doc/tutorials/imgproc/imgtrans/filter_2d/filter_2d.rst +++ b/doc/tutorials/imgproc/imgtrans/filter_2d/filter_2d.rst @@ -72,7 +72,7 @@ Code * The filter output (with each kernel) will be shown during 500 milliseconds -#. The tutorial code's is shown lines below. You can also download it from `here `_ +#. The tutorial code's is shown lines below. You can also download it from `here `_ .. code-block:: cpp diff --git a/doc/tutorials/imgproc/imgtrans/hough_circle/hough_circle.rst b/doc/tutorials/imgproc/imgtrans/hough_circle/hough_circle.rst index 96257683e..34ddde30d 100644 --- a/doc/tutorials/imgproc/imgtrans/hough_circle/hough_circle.rst +++ b/doc/tutorials/imgproc/imgtrans/hough_circle/hough_circle.rst @@ -40,9 +40,9 @@ Code * Display the detected circle in a window. .. |TutorialHoughCirclesSimpleDownload| replace:: here - .. _TutorialHoughCirclesSimpleDownload: http://code.opencv.org/projects/opencv/repository/revisions/master/raw/samples/cpp/houghcircles.cpp + .. _TutorialHoughCirclesSimpleDownload: https://github.com/Itseez/opencv/tree/master/samples/cpp/houghcircles.cpp .. |TutorialHoughCirclesFancyDownload| replace:: here - .. _TutorialHoughCirclesFancyDownload: http://code.opencv.org/projects/opencv/repository/revisions/master/raw/samples/cpp/tutorial_code/ImgTrans/HoughCircle_Demo.cpp + .. _TutorialHoughCirclesFancyDownload: https://github.com/Itseez/opencv/tree/master/samples/cpp/tutorial_code/ImgTrans/HoughCircle_Demo.cpp #. The sample code that we will explain can be downloaded from |TutorialHoughCirclesSimpleDownload|_. A slightly fancier version (which shows both Hough standard and probabilistic with trackbars for changing the threshold values) can be found |TutorialHoughCirclesFancyDownload|_. diff --git a/doc/tutorials/imgproc/imgtrans/hough_lines/hough_lines.rst b/doc/tutorials/imgproc/imgtrans/hough_lines/hough_lines.rst index d716c0832..a786fdb15 100644 --- a/doc/tutorials/imgproc/imgtrans/hough_lines/hough_lines.rst +++ b/doc/tutorials/imgproc/imgtrans/hough_lines/hough_lines.rst @@ -89,9 +89,9 @@ Code ====== .. |TutorialHoughLinesSimpleDownload| replace:: here -.. _TutorialHoughLinesSimpleDownload: http://code.opencv.org/projects/opencv/repository/revisions/master/raw/samples/cpp/houghlines.cpp +.. _TutorialHoughLinesSimpleDownload: https://github.com/Itseez/opencv/tree/master/samples/cpp/houghlines.cpp .. |TutorialHoughLinesFancyDownload| replace:: here -.. _TutorialHoughLinesFancyDownload: http://code.opencv.org/projects/opencv/repository/revisions/master/raw/samples/cpp/tutorial_code/ImgTrans/HoughLines_Demo.cpp +.. _TutorialHoughLinesFancyDownload: https://github.com/Itseez/opencv/tree/master/samples/cpp/tutorial_code/ImgTrans/HoughLines_Demo.cpp #. **What does this program do?** diff --git a/doc/tutorials/imgproc/imgtrans/laplace_operator/laplace_operator.rst b/doc/tutorials/imgproc/imgtrans/laplace_operator/laplace_operator.rst index 5f2d0d0b1..d30870f1d 100644 --- a/doc/tutorials/imgproc/imgtrans/laplace_operator/laplace_operator.rst +++ b/doc/tutorials/imgproc/imgtrans/laplace_operator/laplace_operator.rst @@ -55,7 +55,7 @@ Code * Applies a Laplacian operator to the grayscale image and stores the output image * Display the result in a window -#. The tutorial code's is shown lines below. You can also download it from `here `_ +#. The tutorial code's is shown lines below. You can also download it from `here `_ .. code-block:: cpp diff --git a/doc/tutorials/imgproc/imgtrans/remap/remap.rst b/doc/tutorials/imgproc/imgtrans/remap/remap.rst index a060aa779..f5db120e6 100644 --- a/doc/tutorials/imgproc/imgtrans/remap/remap.rst +++ b/doc/tutorials/imgproc/imgtrans/remap/remap.rst @@ -59,7 +59,7 @@ Code * Each second, apply 1 of 4 different remapping processes to the image and display them indefinitely in a window. * Wait for the user to exit the program -#. The tutorial code's is shown lines below. You can also download it from `here `_ +#. The tutorial code's is shown lines below. You can also download it from `here `_ .. code-block:: cpp diff --git a/doc/tutorials/imgproc/imgtrans/sobel_derivatives/sobel_derivatives.rst b/doc/tutorials/imgproc/imgtrans/sobel_derivatives/sobel_derivatives.rst index fe2593797..e5e7bdfcf 100644 --- a/doc/tutorials/imgproc/imgtrans/sobel_derivatives/sobel_derivatives.rst +++ b/doc/tutorials/imgproc/imgtrans/sobel_derivatives/sobel_derivatives.rst @@ -121,7 +121,7 @@ Code * Applies the *Sobel Operator* and generates as output an image with the detected *edges* bright on a darker background. -#. The tutorial code's is shown lines below. You can also download it from `here `_ +#. The tutorial code's is shown lines below. You can also download it from `here `_ .. code-block:: cpp diff --git a/doc/tutorials/imgproc/imgtrans/warp_affine/warp_affine.rst b/doc/tutorials/imgproc/imgtrans/warp_affine/warp_affine.rst index d61b49337..4fc97ee92 100644 --- a/doc/tutorials/imgproc/imgtrans/warp_affine/warp_affine.rst +++ b/doc/tutorials/imgproc/imgtrans/warp_affine/warp_affine.rst @@ -71,7 +71,7 @@ How do we get an Affine Transformation? a. We know both :math:`X` and `T` and we also know that they are related. Then our job is to find :math:`M` - b. We know :math:`M` and :math:'X`. To obtain :math:`T` we only need to apply :math:`T = M \cdot X`. Our information for :math:`M` may be explicit (i.e. have the 2-by-3 matrix) or it can come as a geometric relation between points. + b. We know :math:`M` and :math:`X`. To obtain :math:`T` we only need to apply :math:`T = M \cdot X`. Our information for :math:`M` may be explicit (i.e. have the 2-by-3 matrix) or it can come as a geometric relation between points. 2. Let's explain a little bit better (b). Since :math:`M` relates 02 images, we can analyze the simplest case in which it relates three points in both images. Look at the figure below: @@ -93,7 +93,7 @@ Code * Applies a Rotation to the image after being transformed. This rotation is with respect to the image center * Waits until the user exits the program -#. The tutorial code's is shown lines below. You can also download it from `here `_ +#. The tutorial code's is shown lines below. You can also download it from `here `_ .. code-block:: cpp diff --git a/doc/tutorials/imgproc/opening_closing_hats/opening_closing_hats.rst b/doc/tutorials/imgproc/opening_closing_hats/opening_closing_hats.rst index ca9d44546..ac734d94d 100644 --- a/doc/tutorials/imgproc/opening_closing_hats/opening_closing_hats.rst +++ b/doc/tutorials/imgproc/opening_closing_hats/opening_closing_hats.rst @@ -111,7 +111,7 @@ Black Hat Code ====== -This tutorial code's is shown lines below. You can also download it from `here `_ +This tutorial code's is shown lines below. You can also download it from `here `_ .. code-block:: cpp diff --git a/doc/tutorials/imgproc/pyramids/pyramids.rst b/doc/tutorials/imgproc/pyramids/pyramids.rst index dacc5b93a..7b78f0dc0 100644 --- a/doc/tutorials/imgproc/pyramids/pyramids.rst +++ b/doc/tutorials/imgproc/pyramids/pyramids.rst @@ -80,7 +80,7 @@ Gaussian Pyramid Code ====== -This tutorial code's is shown lines below. You can also download it from `here `_ +This tutorial code's is shown lines below. You can also download it from `here `_ .. code-block:: cpp diff --git a/doc/tutorials/imgproc/shapedescriptors/bounding_rects_circles/bounding_rects_circles.rst b/doc/tutorials/imgproc/shapedescriptors/bounding_rects_circles/bounding_rects_circles.rst index 24c276dc3..519f6943a 100644 --- a/doc/tutorials/imgproc/shapedescriptors/bounding_rects_circles/bounding_rects_circles.rst +++ b/doc/tutorials/imgproc/shapedescriptors/bounding_rects_circles/bounding_rects_circles.rst @@ -21,7 +21,7 @@ Theory Code ==== -This tutorial code's is shown lines below. You can also download it from `here `_ +This tutorial code's is shown lines below. You can also download it from `here `_ .. code-block:: cpp diff --git a/doc/tutorials/imgproc/shapedescriptors/bounding_rotated_ellipses/bounding_rotated_ellipses.rst b/doc/tutorials/imgproc/shapedescriptors/bounding_rotated_ellipses/bounding_rotated_ellipses.rst index 9c7fbb85f..a8e996655 100644 --- a/doc/tutorials/imgproc/shapedescriptors/bounding_rotated_ellipses/bounding_rotated_ellipses.rst +++ b/doc/tutorials/imgproc/shapedescriptors/bounding_rotated_ellipses/bounding_rotated_ellipses.rst @@ -21,7 +21,7 @@ Theory Code ==== -This tutorial code's is shown lines below. You can also download it from `here `_ +This tutorial code's is shown lines below. You can also download it from `here `_ .. code-block:: cpp diff --git a/doc/tutorials/imgproc/shapedescriptors/find_contours/find_contours.rst b/doc/tutorials/imgproc/shapedescriptors/find_contours/find_contours.rst index 68cf80dc7..ebb58f831 100644 --- a/doc/tutorials/imgproc/shapedescriptors/find_contours/find_contours.rst +++ b/doc/tutorials/imgproc/shapedescriptors/find_contours/find_contours.rst @@ -19,7 +19,7 @@ Theory Code ==== -This tutorial code's is shown lines below. You can also download it from `here `_ +This tutorial code's is shown lines below. You can also download it from `here `_ .. code-block:: cpp diff --git a/doc/tutorials/imgproc/shapedescriptors/hull/hull.rst b/doc/tutorials/imgproc/shapedescriptors/hull/hull.rst index eb5d19e3b..6a6bb62a4 100644 --- a/doc/tutorials/imgproc/shapedescriptors/hull/hull.rst +++ b/doc/tutorials/imgproc/shapedescriptors/hull/hull.rst @@ -19,7 +19,7 @@ Theory Code ==== -This tutorial code's is shown lines below. You can also download it from `here `_ +This tutorial code's is shown lines below. You can also download it from `here `_ .. code-block:: cpp diff --git a/doc/tutorials/imgproc/shapedescriptors/moments/moments.rst b/doc/tutorials/imgproc/shapedescriptors/moments/moments.rst index 350ca38d4..537842850 100644 --- a/doc/tutorials/imgproc/shapedescriptors/moments/moments.rst +++ b/doc/tutorials/imgproc/shapedescriptors/moments/moments.rst @@ -21,7 +21,7 @@ Theory Code ==== -This tutorial code's is shown lines below. You can also download it from `here `_ +This tutorial code's is shown lines below. You can also download it from `here `_ .. code-block:: cpp diff --git a/doc/tutorials/imgproc/shapedescriptors/point_polygon_test/point_polygon_test.rst b/doc/tutorials/imgproc/shapedescriptors/point_polygon_test/point_polygon_test.rst index 2d68cc247..1f698108c 100644 --- a/doc/tutorials/imgproc/shapedescriptors/point_polygon_test/point_polygon_test.rst +++ b/doc/tutorials/imgproc/shapedescriptors/point_polygon_test/point_polygon_test.rst @@ -19,7 +19,7 @@ Theory Code ==== -This tutorial code's is shown lines below. You can also download it from `here `_ +This tutorial code's is shown lines below. You can also download it from `here `_ .. code-block:: cpp diff --git a/doc/tutorials/imgproc/threshold/threshold.rst b/doc/tutorials/imgproc/threshold/threshold.rst index c4e8ddf64..e4ed3030c 100644 --- a/doc/tutorials/imgproc/threshold/threshold.rst +++ b/doc/tutorials/imgproc/threshold/threshold.rst @@ -130,7 +130,7 @@ Threshold to Zero, Inverted Code ====== -The tutorial code's is shown lines below. You can also download it from `here `_ +The tutorial code's is shown lines below. You can also download it from `here `_ .. code-block:: cpp diff --git a/doc/tutorials/introduction/display_image/display_image.rst b/doc/tutorials/introduction/display_image/display_image.rst index 1d2fdc097..6b30b7c29 100644 --- a/doc/tutorials/introduction/display_image/display_image.rst +++ b/doc/tutorials/introduction/display_image/display_image.rst @@ -17,7 +17,7 @@ In this tutorial you will learn how to: Source Code =========== -Download the source code from `here `_. +Download the source code from `here `_. .. literalinclude:: ../../../../samples/cpp/tutorial_code/introduction/display_image/display_image.cpp :language: cpp diff --git a/doc/tutorials/objdetect/cascade_classifier/cascade_classifier.rst b/doc/tutorials/objdetect/cascade_classifier/cascade_classifier.rst index ba9c2740e..c5ceb9b82 100644 --- a/doc/tutorials/objdetect/cascade_classifier/cascade_classifier.rst +++ b/doc/tutorials/objdetect/cascade_classifier/cascade_classifier.rst @@ -22,7 +22,7 @@ Theory Code ==== -This tutorial code's is shown lines below. You can also download it from `here `_ . The second version (using LBP for face detection) can be `found here `_ +This tutorial code's is shown lines below. You can also download it from `here `_ . The second version (using LBP for face detection) can be `found here `_ .. code-block:: cpp diff --git a/doc/user_guide/ug_highgui.rst b/doc/user_guide/ug_highgui.rst index 53dadf504..196714a5a 100644 --- a/doc/user_guide/ug_highgui.rst +++ b/doc/user_guide/ug_highgui.rst @@ -130,4 +130,4 @@ Flags specifing the needed generator type must be used in combination with parti For more information please refer to the example of usage openni_capture.cpp_ in ``opencv/samples/cpp`` folder. -.. _openni_capture.cpp: http://code.opencv.org/projects/opencv/repository/revisions/master/raw/samples/cpp/openni_capture.cpp +.. _openni_capture.cpp: https://github.com/Itseez/opencv/tree/master/samples/cpp/openni_capture.cpp diff --git a/modules/androidcamera/camera_wrapper/camera_wrapper.cpp b/modules/androidcamera/camera_wrapper/camera_wrapper.cpp index 03796d1ec..5ca1778a5 100644 --- a/modules/androidcamera/camera_wrapper/camera_wrapper.cpp +++ b/modules/androidcamera/camera_wrapper/camera_wrapper.cpp @@ -686,7 +686,7 @@ void CameraHandler::closeCameraConnect() camera->stopPreview(); #if defined(ANDROID_r4_0_0) || defined(ANDROID_r4_0_3) || defined(ANDROID_r4_1_1) || defined(ANDROID_r4_2_0) \ - || defined(ANDROID_r4_3_0) || defined(ANDROID_r4_3_0) + || defined(ANDROID_r4_3_0) || defined(ANDROID_r4_4_0) camera->setPreviewCallbackFlags(CAMERA_FRAME_CALLBACK_FLAG_NOOP); #endif camera->disconnect(); diff --git a/modules/contrib/doc/facerec/src/facerec_eigenfaces.cpp b/modules/contrib/doc/facerec/src/facerec_eigenfaces.cpp index 9d2847632..81154677c 100644 --- a/modules/contrib/doc/facerec/src/facerec_eigenfaces.cpp +++ b/modules/contrib/doc/facerec/src/facerec_eigenfaces.cpp @@ -70,7 +70,7 @@ int main(int argc, const char *argv[]) { cout << "usage: " << argv[0] << " " << endl; exit(1); } - string output_folder; + string output_folder = "."; if (argc == 3) { output_folder = string(argv[2]); } diff --git a/modules/contrib/doc/facerec/src/facerec_fisherfaces.cpp b/modules/contrib/doc/facerec/src/facerec_fisherfaces.cpp index 9e8988a6e..0b2078930 100644 --- a/modules/contrib/doc/facerec/src/facerec_fisherfaces.cpp +++ b/modules/contrib/doc/facerec/src/facerec_fisherfaces.cpp @@ -70,7 +70,7 @@ int main(int argc, const char *argv[]) { cout << "usage: " << argv[0] << " " << endl; exit(1); } - string output_folder; + string output_folder = "."; if (argc == 3) { output_folder = string(argv[2]); } diff --git a/modules/contrib/doc/facerec/src/facerec_save_load.cpp b/modules/contrib/doc/facerec/src/facerec_save_load.cpp index 583b893b0..4db2d6666 100644 --- a/modules/contrib/doc/facerec/src/facerec_save_load.cpp +++ b/modules/contrib/doc/facerec/src/facerec_save_load.cpp @@ -70,7 +70,7 @@ int main(int argc, const char *argv[]) { cout << "usage: " << argv[0] << " " << endl; exit(1); } - string output_folder; + string output_folder = "."; if (argc == 3) { output_folder = string(argv[2]); } diff --git a/modules/contrib/src/facerec.cpp b/modules/contrib/src/facerec.cpp index 1bea74e89..c9fd97608 100644 --- a/modules/contrib/src/facerec.cpp +++ b/modules/contrib/src/facerec.cpp @@ -602,8 +602,8 @@ inline void elbp_(InputArray _src, OutputArray _dst, int radius, int neighbors) dst.setTo(0); for(int n=0; n(-radius * sin(2.0*CV_PI*n/static_cast(neighbors))); - float y = static_cast(radius * cos(2.0*CV_PI*n/static_cast(neighbors))); + float x = static_cast(radius * cos(2.0*CV_PI*n/static_cast(neighbors))); + float y = static_cast(-radius * sin(2.0*CV_PI*n/static_cast(neighbors))); // relative indices int fx = static_cast(floor(x)); int fy = static_cast(floor(y)); diff --git a/modules/core/doc/basic_structures.rst b/modules/core/doc/basic_structures.rst index 1be3e4d2a..886a886df 100644 --- a/modules/core/doc/basic_structures.rst +++ b/modules/core/doc/basic_structures.rst @@ -3122,5 +3122,5 @@ The above methods are usually enough for users. If you want to make your own alg * Make a class and specify ``Algorithm`` as its base class. * The algorithm parameters should be the class members. See ``Algorithm::get()`` for the list of possible types of the parameters. * Add public virtual method ``AlgorithmInfo* info() const;`` to your class. - * Add constructor function, ``AlgorithmInfo`` instance and implement the ``info()`` method. The simplest way is to take http://code.opencv.org/projects/opencv/repository/revisions/master/entry/modules/ml/src/ml_init.cpp as the reference and modify it according to the list of your parameters. + * Add constructor function, ``AlgorithmInfo`` instance and implement the ``info()`` method. The simplest way is to take https://github.com/Itseez/opencv/tree/master/modules/ml/src/ml_init.cpp as the reference and modify it according to the list of your parameters. * Add some public function (e.g. ``initModule_()``) that calls info() of your algorithm and put it into the same source file as ``info()`` implementation. This is to force C++ linker to include this object file into the target application. See ``Algorithm::create()`` for details. diff --git a/modules/core/src/command_line_parser.cpp b/modules/core/src/command_line_parser.cpp index b082faee6..7a0284f75 100644 --- a/modules/core/src/command_line_parser.cpp +++ b/modules/core/src/command_line_parser.cpp @@ -211,16 +211,15 @@ CommandLineParser::CommandLineParser(int argc, const char* const argv[], const S } impl->apply_params(k_v[0], k_v[1]); } + else if (s.length() > 2 && s[0] == '-' && s[1] == '-') + { + impl->apply_params(s.substr(2), "true"); + } else if (s.length() > 1 && s[0] == '-') { - for (int h = 0; h < 2; h++) - { - if (s[0] == '-') - s = s.substr(1, s.length() - 1); - } - impl->apply_params(s, "true"); + impl->apply_params(s.substr(1), "true"); } - else if (s[0] != '-') + else { impl->apply_params(jj, s); jj++; diff --git a/modules/cuda/CMakeLists.txt b/modules/cuda/CMakeLists.txt index c8047b1b6..a79b7d3bf 100644 --- a/modules/cuda/CMakeLists.txt +++ b/modules/cuda/CMakeLists.txt @@ -1,4 +1,4 @@ -if(ANDROID OR IOS) +if(IOS) ocv_module_disable(cuda) endif() diff --git a/modules/cuda/doc/introduction.rst b/modules/cuda/doc/introduction.rst index a299d7fcc..589a39fdc 100644 --- a/modules/cuda/doc/introduction.rst +++ b/modules/cuda/doc/introduction.rst @@ -58,4 +58,4 @@ While developing algorithms for multiple GPUs, note a data passing overhead. For 3. Merge the results into a single disparity map. -With this algorithm, a dual GPU gave a 180% performance increase comparing to the single Fermi GPU. For a source code example, see http://code.opencv.org/projects/opencv/repository/revisions/master/entry/samples/gpu/. +With this algorithm, a dual GPU gave a 180% performance increase comparing to the single Fermi GPU. For a source code example, see https://github.com/Itseez/opencv/tree/master/samples/gpu/. diff --git a/modules/cudaarithm/CMakeLists.txt b/modules/cudaarithm/CMakeLists.txt index f44c283c0..e3df9d284 100644 --- a/modules/cudaarithm/CMakeLists.txt +++ b/modules/cudaarithm/CMakeLists.txt @@ -1,4 +1,4 @@ -if(ANDROID OR IOS) +if(IOS) ocv_module_disable(cudaarithm) endif() diff --git a/modules/cudabgsegm/CMakeLists.txt b/modules/cudabgsegm/CMakeLists.txt index fbfd2ae49..526e4b185 100644 --- a/modules/cudabgsegm/CMakeLists.txt +++ b/modules/cudabgsegm/CMakeLists.txt @@ -1,4 +1,4 @@ -if(ANDROID OR IOS) +if(IOS) ocv_module_disable(cudabgsegm) endif() diff --git a/modules/cudabgsegm/perf/perf_bgsegm.cpp b/modules/cudabgsegm/perf/perf_bgsegm.cpp index ef2bea864..9d3da2927 100644 --- a/modules/cudabgsegm/perf/perf_bgsegm.cpp +++ b/modules/cudabgsegm/perf/perf_bgsegm.cpp @@ -89,6 +89,8 @@ DEF_PARAM_TEST_1(Video, string); PERF_TEST_P(Video, FGDStatModel, Values(string("gpu/video/768x576.avi"))) { + const int numIters = 10; + declare.time(60); const string inputFile = perf::TestBase::getDataPath(GetParam()); @@ -107,18 +109,36 @@ PERF_TEST_P(Video, FGDStatModel, cv::Ptr d_fgd = cv::cuda::createBackgroundSubtractorFGD(); d_fgd->apply(d_frame, foreground); - for (int i = 0; i < 10; ++i) + int i = 0; + + // collect performance data + for (; i < numIters; ++i) { cap >> frame; ASSERT_FALSE(frame.empty()); d_frame.upload(frame); - startTimer(); next(); + startTimer(); + if(!next()) + break; + d_fgd->apply(d_frame, foreground); + stopTimer(); } + // process last frame in sequence to get data for sanity test + for (; i < numIters; ++i) + { + cap >> frame; + ASSERT_FALSE(frame.empty()); + + d_frame.upload(frame); + + d_fgd->apply(d_frame, foreground); + } + CUDA_SANITY_CHECK(foreground, 1e-2, ERROR_RELATIVE); #ifdef HAVE_OPENCV_CUDAIMGPROC @@ -134,18 +154,36 @@ PERF_TEST_P(Video, FGDStatModel, IplImage ipl_frame = frame; cv::Ptr model(cvCreateFGDStatModel(&ipl_frame)); - for (int i = 0; i < 10; ++i) + int i = 0; + + // collect performance data + for (; i < numIters; ++i) { cap >> frame; ASSERT_FALSE(frame.empty()); ipl_frame = frame; - startTimer(); next(); + startTimer(); + if(!next()) + break; + cvUpdateBGStatModel(&ipl_frame, model); + stopTimer(); } + // process last frame in sequence to get data for sanity test + for (; i < numIters; ++i) + { + cap >> frame; + ASSERT_FALSE(frame.empty()); + + ipl_frame = frame; + + cvUpdateBGStatModel(&ipl_frame, model); + } + const cv::Mat background = cv::cvarrToMat(model->background); const cv::Mat foreground = cv::cvarrToMat(model->foreground); @@ -171,6 +209,8 @@ PERF_TEST_P(Video_Cn_LearningRate, MOG, CUDA_CHANNELS_1_3_4, Values(0.0, 0.01))) { + const int numIters = 10; + const string inputFile = perf::TestBase::getDataPath(GET_PARAM(0)); const int cn = GET_PARAM(1); const float learningRate = static_cast(GET_PARAM(2)); @@ -202,7 +242,10 @@ PERF_TEST_P(Video_Cn_LearningRate, MOG, d_mog->apply(d_frame, foreground, learningRate); - for (int i = 0; i < 10; ++i) + int i = 0; + + // collect performance data + for (; i < numIters; ++i) { cap >> frame; ASSERT_FALSE(frame.empty()); @@ -219,21 +262,17 @@ PERF_TEST_P(Video_Cn_LearningRate, MOG, d_frame.upload(frame); - startTimer(); next(); + startTimer(); + if(!next()) + break; + d_mog->apply(d_frame, foreground, learningRate); + stopTimer(); } - CUDA_SANITY_CHECK(foreground); - } - else - { - cv::Ptr mog = cv::createBackgroundSubtractorMOG(); - cv::Mat foreground; - - mog->apply(frame, foreground, learningRate); - - for (int i = 0; i < 10; ++i) + // process last frame in sequence to get data for sanity test + for (; i < numIters; ++i) { cap >> frame; ASSERT_FALSE(frame.empty()); @@ -248,11 +287,66 @@ PERF_TEST_P(Video_Cn_LearningRate, MOG, cv::swap(temp, frame); } - startTimer(); next(); + d_frame.upload(frame); + + d_mog->apply(d_frame, foreground, learningRate); + } + + CUDA_SANITY_CHECK(foreground); + } + else + { + cv::Ptr mog = cv::createBackgroundSubtractorMOG(); + cv::Mat foreground; + + mog->apply(frame, foreground, learningRate); + + int i = 0; + + // collect performance data + for (; i < numIters; ++i) + { + cap >> frame; + ASSERT_FALSE(frame.empty()); + + if (cn != 3) + { + cv::Mat temp; + if (cn == 1) + cv::cvtColor(frame, temp, cv::COLOR_BGR2GRAY); + else + cv::cvtColor(frame, temp, cv::COLOR_BGR2BGRA); + cv::swap(temp, frame); + } + + startTimer(); + if(!next()) + break; + mog->apply(frame, foreground, learningRate); + stopTimer(); } + // process last frame in sequence to get data for sanity test + for (; i < numIters; ++i) + { + cap >> frame; + ASSERT_FALSE(frame.empty()); + + if (cn != 3) + { + cv::Mat temp; + if (cn == 1) + cv::cvtColor(frame, temp, cv::COLOR_BGR2GRAY); + else + cv::cvtColor(frame, temp, cv::COLOR_BGR2BGRA); + cv::swap(temp, frame); + } + + mog->apply(frame, foreground, learningRate); + } + CPU_SANITY_CHECK(foreground); } } @@ -266,10 +360,12 @@ PERF_TEST_P(Video_Cn_LearningRate, MOG, DEF_PARAM_TEST(Video_Cn, string, int); -PERF_TEST_P(Video_Cn, MOG2, +PERF_TEST_P(Video_Cn, DISABLED_MOG2, Combine(Values("gpu/video/768x576.avi", "gpu/video/1920x1080.avi"), CUDA_CHANNELS_1_3_4)) { + const int numIters = 10; + const string inputFile = perf::TestBase::getDataPath(GET_PARAM(0)); const int cn = GET_PARAM(1); @@ -301,7 +397,10 @@ PERF_TEST_P(Video_Cn, MOG2, d_mog2->apply(d_frame, foreground); - for (int i = 0; i < 10; ++i) + int i = 0; + + // collect performance data + for (; i < numIters; ++i) { cap >> frame; ASSERT_FALSE(frame.empty()); @@ -318,23 +417,17 @@ PERF_TEST_P(Video_Cn, MOG2, d_frame.upload(frame); - startTimer(); next(); + startTimer(); + if(!next()) + break; + d_mog2->apply(d_frame, foreground); + stopTimer(); } - CUDA_SANITY_CHECK(foreground); - } - else - { - cv::Ptr mog2 = cv::createBackgroundSubtractorMOG2(); - mog2->setDetectShadows(false); - - cv::Mat foreground; - - mog2->apply(frame, foreground); - - for (int i = 0; i < 10; ++i) + // process last frame in sequence to get data for sanity test + for (; i < numIters; ++i) { cap >> frame; ASSERT_FALSE(frame.empty()); @@ -349,11 +442,68 @@ PERF_TEST_P(Video_Cn, MOG2, cv::swap(temp, frame); } - startTimer(); next(); + d_frame.upload(frame); + + d_mog2->apply(d_frame, foreground); + } + + CUDA_SANITY_CHECK(foreground); + } + else + { + cv::Ptr mog2 = cv::createBackgroundSubtractorMOG2(); + mog2->setDetectShadows(false); + + cv::Mat foreground; + + mog2->apply(frame, foreground); + + int i = 0; + + // collect performance data + for (; i < numIters; ++i) + { + cap >> frame; + ASSERT_FALSE(frame.empty()); + + if (cn != 3) + { + cv::Mat temp; + if (cn == 1) + cv::cvtColor(frame, temp, cv::COLOR_BGR2GRAY); + else + cv::cvtColor(frame, temp, cv::COLOR_BGR2BGRA); + cv::swap(temp, frame); + } + + startTimer(); + if(!next()) + break; + mog2->apply(frame, foreground); + stopTimer(); } + // process last frame in sequence to get data for sanity test + for (; i < numIters; ++i) + { + cap >> frame; + ASSERT_FALSE(frame.empty()); + + if (cn != 3) + { + cv::Mat temp; + if (cn == 1) + cv::cvtColor(frame, temp, cv::COLOR_BGR2GRAY); + else + cv::cvtColor(frame, temp, cv::COLOR_BGR2BGRA); + cv::swap(temp, frame); + } + + mog2->apply(frame, foreground); + } + CPU_SANITY_CHECK(foreground); } } @@ -455,6 +605,8 @@ PERF_TEST_P(Video_Cn_MaxFeatures, GMG, CUDA_CHANNELS_1_3_4, Values(20, 40, 60))) { + const int numIters = 150; + const std::string inputFile = perf::TestBase::getDataPath(GET_PARAM(0)); const int cn = GET_PARAM(1); const int maxFeatures = GET_PARAM(2); @@ -486,7 +638,10 @@ PERF_TEST_P(Video_Cn_MaxFeatures, GMG, d_gmg->apply(d_frame, foreground); - for (int i = 0; i < 150; ++i) + int i = 0; + + // collect performance data + for (; i < numIters; ++i) { cap >> frame; if (frame.empty()) @@ -508,24 +663,17 @@ PERF_TEST_P(Video_Cn_MaxFeatures, GMG, d_frame.upload(frame); - startTimer(); next(); + startTimer(); + if(!next()) + break; + d_gmg->apply(d_frame, foreground); + stopTimer(); } - CUDA_SANITY_CHECK(foreground); - } - else - { - cv::Mat foreground; - cv::Mat zeros(frame.size(), CV_8UC1, cv::Scalar::all(0)); - - cv::Ptr gmg = cv::createBackgroundSubtractorGMG(); - gmg->setMaxFeatures(maxFeatures); - - gmg->apply(frame, foreground); - - for (int i = 0; i < 150; ++i) + // process last frame in sequence to get data for sanity test + for (; i < numIters; ++i) { cap >> frame; if (frame.empty()) @@ -545,11 +693,79 @@ PERF_TEST_P(Video_Cn_MaxFeatures, GMG, cv::swap(temp, frame); } - startTimer(); next(); + d_frame.upload(frame); + + d_gmg->apply(d_frame, foreground); + } + + CUDA_SANITY_CHECK(foreground); + } + else + { + cv::Mat foreground; + cv::Mat zeros(frame.size(), CV_8UC1, cv::Scalar::all(0)); + + cv::Ptr gmg = cv::createBackgroundSubtractorGMG(); + gmg->setMaxFeatures(maxFeatures); + + gmg->apply(frame, foreground); + + int i = 0; + + // collect performance data + for (; i < numIters; ++i) + { + cap >> frame; + if (frame.empty()) + { + cap.release(); + cap.open(inputFile); + cap >> frame; + } + + if (cn != 3) + { + cv::Mat temp; + if (cn == 1) + cv::cvtColor(frame, temp, cv::COLOR_BGR2GRAY); + else + cv::cvtColor(frame, temp, cv::COLOR_BGR2BGRA); + cv::swap(temp, frame); + } + + startTimer(); + if(!next()) + break; + gmg->apply(frame, foreground); + stopTimer(); } + // process last frame in sequence to get data for sanity test + for (; i < numIters; ++i) + { + cap >> frame; + if (frame.empty()) + { + cap.release(); + cap.open(inputFile); + cap >> frame; + } + + if (cn != 3) + { + cv::Mat temp; + if (cn == 1) + cv::cvtColor(frame, temp, cv::COLOR_BGR2GRAY); + else + cv::cvtColor(frame, temp, cv::COLOR_BGR2BGRA); + cv::swap(temp, frame); + } + + gmg->apply(frame, foreground); + } + CPU_SANITY_CHECK(foreground); } } diff --git a/modules/cudacodec/CMakeLists.txt b/modules/cudacodec/CMakeLists.txt index 1dd4c92e5..30d95bacb 100644 --- a/modules/cudacodec/CMakeLists.txt +++ b/modules/cudacodec/CMakeLists.txt @@ -1,4 +1,4 @@ -if(ANDROID OR IOS OR APPLE) +if(IOS OR APPLE) ocv_module_disable(cudacodec) endif() diff --git a/modules/cudafeatures2d/CMakeLists.txt b/modules/cudafeatures2d/CMakeLists.txt index 9bca959f3..69eba34b1 100644 --- a/modules/cudafeatures2d/CMakeLists.txt +++ b/modules/cudafeatures2d/CMakeLists.txt @@ -1,4 +1,4 @@ -if(ANDROID OR IOS) +if(IOS) ocv_module_disable(cudafeatures2d) endif() diff --git a/modules/cudafilters/CMakeLists.txt b/modules/cudafilters/CMakeLists.txt index 35b943274..858988115 100644 --- a/modules/cudafilters/CMakeLists.txt +++ b/modules/cudafilters/CMakeLists.txt @@ -1,4 +1,4 @@ -if(ANDROID OR IOS) +if(IOS) ocv_module_disable(cudafilters) endif() diff --git a/modules/cudaimgproc/CMakeLists.txt b/modules/cudaimgproc/CMakeLists.txt index bfb8f3527..961702966 100644 --- a/modules/cudaimgproc/CMakeLists.txt +++ b/modules/cudaimgproc/CMakeLists.txt @@ -1,4 +1,4 @@ -if(ANDROID OR IOS) +if(IOS) ocv_module_disable(cudaimgproc) endif() diff --git a/modules/cudaoptflow/CMakeLists.txt b/modules/cudaoptflow/CMakeLists.txt index c72fde062..27dbc6a51 100644 --- a/modules/cudaoptflow/CMakeLists.txt +++ b/modules/cudaoptflow/CMakeLists.txt @@ -1,4 +1,4 @@ -if(ANDROID OR IOS) +if(IOS) ocv_module_disable(cudaoptflow) endif() diff --git a/modules/cudastereo/CMakeLists.txt b/modules/cudastereo/CMakeLists.txt index bf485ea50..6f63add8d 100644 --- a/modules/cudastereo/CMakeLists.txt +++ b/modules/cudastereo/CMakeLists.txt @@ -1,4 +1,4 @@ -if(ANDROID OR IOS) +if(IOS) ocv_module_disable(cudastereo) endif() diff --git a/modules/cudawarping/CMakeLists.txt b/modules/cudawarping/CMakeLists.txt index 6aedc2851..a6b38f954 100644 --- a/modules/cudawarping/CMakeLists.txt +++ b/modules/cudawarping/CMakeLists.txt @@ -1,4 +1,4 @@ -if(ANDROID OR IOS) +if(IOS) ocv_module_disable(cudawarping) endif() diff --git a/modules/highgui/doc/reading_and_writing_images_and_video.rst b/modules/highgui/doc/reading_and_writing_images_and_video.rst index 95d3e05c1..539b31e86 100644 --- a/modules/highgui/doc/reading_and_writing_images_and_video.rst +++ b/modules/highgui/doc/reading_and_writing_images_and_video.rst @@ -250,7 +250,7 @@ VideoCapture constructors. .. ocv:cfunction:: CvCapture* cvCaptureFromCAM( int device ) .. ocv:cfunction:: CvCapture* cvCaptureFromFile( const char* filename ) - :param filename: name of the opened video file (eg. video.avi) or image sequence (eg. img%02d.jpg) + :param filename: name of the opened video file (eg. video.avi) or image sequence (eg. img_%02d.jpg, which will read samples like img_00.jpg, img_01.jpg, img_02.jpg, ...) :param device: id of the opened video capturing device (i.e. a camera index). If there is a single camera connected, just pass 0. @@ -267,7 +267,7 @@ Open video file or a capturing device for video capturing .. ocv:pyfunction:: cv2.VideoCapture.open(filename) -> retval .. ocv:pyfunction:: cv2.VideoCapture.open(device) -> retval - :param filename: name of the opened video file (eg. video.avi) or image sequence (eg. img%02d.jpg) + :param filename: name of the opened video file (eg. video.avi) or image sequence (eg. img_%02d.jpg, which will read samples like img_00.jpg, img_01.jpg, img_02.jpg, ...) :param device: id of the opened video capturing device (i.e. a camera index). @@ -313,7 +313,7 @@ The methods/functions grab the next frame from video file or camera and return t The primary use of the function is in multi-camera environments, especially when the cameras do not have hardware synchronization. That is, you call ``VideoCapture::grab()`` for each camera and after that call the slower method ``VideoCapture::retrieve()`` to decode and get frame from each camera. This way the overhead on demosaicing or motion jpeg decompression etc. is eliminated and the retrieved frames from different cameras will be closer in time. -Also, when a connected camera is multi-head (for example, a stereo camera or a Kinect device), the correct way of retrieving data from it is to call `VideoCapture::grab` first and then call :ocv:func:`VideoCapture::retrieve` one or more times with different values of the ``channel`` parameter. See http://code.opencv.org/projects/opencv/repository/revisions/master/entry/samples/cpp/kinect_maps.cpp +Also, when a connected camera is multi-head (for example, a stereo camera or a Kinect device), the correct way of retrieving data from it is to call `VideoCapture::grab` first and then call :ocv:func:`VideoCapture::retrieve` one or more times with different values of the ``channel`` parameter. See https://github.com/Itseez/opencv/tree/master/samples/cpp/openni_capture.cpp VideoCapture::retrieve diff --git a/modules/highgui/doc/user_interface.rst b/modules/highgui/doc/user_interface.rst index 8e9a4c307..8b655a1c8 100644 --- a/modules/highgui/doc/user_interface.rst +++ b/modules/highgui/doc/user_interface.rst @@ -203,7 +203,7 @@ Sets mouse handler for the specified window :param winname: Window name - :param onMouse: Mouse callback. See OpenCV samples, such as http://code.opencv.org/projects/opencv/repository/revisions/master/entry/samples/cpp/ffilldemo.cpp, on how to specify and use the callback. + :param onMouse: Mouse callback. See OpenCV samples, such as https://github.com/Itseez/opencv/tree/master/samples/cpp/ffilldemo.cpp, on how to specify and use the callback. :param userdata: The optional parameter passed to the callback. diff --git a/modules/imgproc/doc/structural_analysis_and_shape_descriptors.rst b/modules/imgproc/doc/structural_analysis_and_shape_descriptors.rst index 3e019d4f9..9dd1d9f2f 100644 --- a/modules/imgproc/doc/structural_analysis_and_shape_descriptors.rst +++ b/modules/imgproc/doc/structural_analysis_and_shape_descriptors.rst @@ -236,7 +236,7 @@ Approximates a polygonal curve(s) with the specified precision. The functions ``approxPolyDP`` approximate a curve or a polygon with another curve/polygon with less vertices so that the distance between them is less or equal to the specified precision. It uses the Douglas-Peucker algorithm http://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm -See http://code.opencv.org/projects/opencv/repository/revisions/master/entry/samples/cpp/contours.cpp for the function usage model. +See https://github.com/Itseez/opencv/tree/master/samples/cpp/contours2.cpp for the function usage model. ApproxChains diff --git a/modules/objdetect/doc/cascade_classification.rst b/modules/objdetect/doc/cascade_classification.rst index b7a986229..ecd27c793 100644 --- a/modules/objdetect/doc/cascade_classification.rst +++ b/modules/objdetect/doc/cascade_classification.rst @@ -21,7 +21,7 @@ The word "cascade" in the classifier name means that the resultant classifier co The feature used in a particular classifier is specified by its shape (1a, 2b etc.), position within the region of interest and the scale (this scale is not the same as the scale used at the detection stage, though these two scales are multiplied). For example, in the case of the third line feature (2c) the response is calculated as the difference between the sum of image pixels under the rectangle covering the whole feature (including the two white stripes and the black stripe in the middle) and the sum of the image pixels under the black stripe multiplied by 3 in order to compensate for the differences in the size of areas. The sums of pixel values over a rectangular regions are calculated rapidly using integral images (see below and the :ocv:func:`integral` description). To see the object detector at work, have a look at the facedetect demo: -http://code.opencv.org/projects/opencv/repository/revisions/master/entry/samples/cpp/dbt_face_detection.cpp +https://github.com/Itseez/opencv/tree/master/samples/cpp/dbt_face_detection.cpp The following reference is for the detection part only. There is a separate application called ``opencv_traincascade`` that can train a cascade of boosted classifiers from a set of samples. diff --git a/modules/ocl/include/opencv2/ocl/matrix_operations.hpp b/modules/ocl/include/opencv2/ocl/matrix_operations.hpp index 33748c0a5..76db47903 100644 --- a/modules/ocl/include/opencv2/ocl/matrix_operations.hpp +++ b/modules/ocl/include/opencv2/ocl/matrix_operations.hpp @@ -44,6 +44,8 @@ #ifndef __OPENCV_OCL_MATRIX_OPERATIONS_HPP__ #define __OPENCV_OCL_MATRIX_OPERATIONS_HPP__ +#include "opencv2/ocl.hpp" + namespace cv { diff --git a/modules/ocl/src/cl_context.cpp b/modules/ocl/src/cl_context.cpp index aa3260fbe..76e7eda19 100644 --- a/modules/ocl/src/cl_context.cpp +++ b/modules/ocl/src/cl_context.cpp @@ -189,11 +189,8 @@ static bool parseOpenCLDeviceConfiguration(const std::string& configurationStr, return true; } -static bool __deviceSelected = false; static bool selectOpenCLDevice() { - __deviceSelected = true; - std::string platform; std::vector deviceTypes; std::string deviceName; @@ -528,26 +525,38 @@ private: static ContextImpl* currentContext = NULL; +static bool __deviceSelected = false; + Context* Context::getContext() { if (currentContext == NULL) { - if (!__initialized || !__deviceSelected) + static bool defaultInitiaization = false; + if (!defaultInitiaization) { cv::AutoLock lock(getInitializationMutex()); - if (!__initialized) + try { - if (initializeOpenCLDevices() == 0) + if (!__initialized) { - CV_Error(Error::OpenCLInitError, "OpenCL not available"); + if (initializeOpenCLDevices() == 0) + { + CV_Error(Error::OpenCLInitError, "OpenCL not available"); + } } + if (!__deviceSelected) + { + if (!selectOpenCLDevice()) + { + CV_Error(Error::OpenCLInitError, "Can't select OpenCL device"); + } + } + defaultInitiaization = true; } - if (!__deviceSelected) + catch (...) { - if (!selectOpenCLDevice()) - { - CV_Error(Error::OpenCLInitError, "Can't select OpenCL device"); - } + defaultInitiaization = true; + throw; } } CV_Assert(currentContext != NULL); @@ -744,10 +753,16 @@ int getOpenCLDevices(std::vector &devices, int deviceType, co void setDevice(const DeviceInfo* info) { - if (!__deviceSelected) + try + { + ContextImpl::setContext(info); __deviceSelected = true; - - ContextImpl::setContext(info); + } + catch (...) + { + __deviceSelected = true; + throw; + } } bool supportsFeature(FEATURE_TYPE featureType) diff --git a/modules/ocl/src/cl_operations.cpp b/modules/ocl/src/cl_operations.cpp index 802f2d80f..1e4157723 100644 --- a/modules/ocl/src/cl_operations.cpp +++ b/modules/ocl/src/cl_operations.cpp @@ -192,6 +192,7 @@ void openCLMallocPitchEx(Context *ctx, void **dev_ptr, size_t *pitch, clFinish(getClCommandQueue(ctx)); #endif CheckBuffers data(mainBuffer, size, widthInBytes, height); + cv::AutoLock lock(getInitializationMutex()); __check_buffers.insert(std::pair((cl_mem)*dev_ptr, data)); } #endif @@ -253,10 +254,17 @@ void openCLFree(void *devPtr) bool failBefore = false, failAfter = false; #endif CheckBuffers data; - std::map::iterator i = __check_buffers.find((cl_mem)devPtr); - if (i != __check_buffers.end()) { - data = i->second; + cv::AutoLock lock(getInitializationMutex()); + std::map::iterator i = __check_buffers.find((cl_mem)devPtr); + if (i != __check_buffers.end()) + { + data = i->second; + __check_buffers.erase(i); + } + } + if (data.mainBuffer != NULL) + { #ifdef CHECK_MEMORY_CORRUPTION Context* ctx = Context::getContext(); std::vector checkBefore(__memory_corruption_guard_bytes); @@ -286,7 +294,6 @@ void openCLFree(void *devPtr) clFinish(getClCommandQueue(ctx)); #endif openCLSafeCall(clReleaseMemObject(data.mainBuffer)); - __check_buffers.erase(i); } #if defined(CHECK_MEMORY_CORRUPTION) if (failBefore) diff --git a/modules/ocl/src/haar.cpp b/modules/ocl/src/haar.cpp index 00dfb52e4..7c3277e99 100644 --- a/modules/ocl/src/haar.cpp +++ b/modules/ocl/src/haar.cpp @@ -923,7 +923,7 @@ void OclCascadeClassifier::detectMultiScale(oclMat &gimg, CV_OUT std::vectororig_window_size.width); // check that maximal value is less than maximal unsigned short - assert(DATA_SIZE_X*cascade->orig_window_size.height+cascade->orig_window_size.width < USHRT_MAX); + assert(DATA_SIZE_X*cascade->orig_window_size.height+cascade->orig_window_size.width < (int)USHRT_MAX); for(int i = 0;i (example mask: example_%%02d.jpg)\n" + << "Usage: " << argv[0] << " (example mask: example_%02d.jpg)\n" << "Image mask defines the name variation for the input images that have to be read as a sequence. \n" - << "Using the mask example_%%02d.jpg will read in images labeled as 'example_00.jpg', 'example_01.jpg', etc." + << "Using the mask example_%02d.jpg will read in images labeled as 'example_00.jpg', 'example_01.jpg', etc." << endl; } diff --git a/samples/cpp/tutorial_code/ImgTrans/HoughCircle_Demo.cpp b/samples/cpp/tutorial_code/ImgTrans/HoughCircle_Demo.cpp index b4cda82f1..29648ceca 100644 --- a/samples/cpp/tutorial_code/ImgTrans/HoughCircle_Demo.cpp +++ b/samples/cpp/tutorial_code/ImgTrans/HoughCircle_Demo.cpp @@ -7,50 +7,102 @@ #include "opencv2/highgui/highgui.hpp" #include "opencv2/imgproc/imgproc.hpp" #include -#include using namespace std; using namespace cv; -/** - * @function main - */ -int main(int, char** argv) +namespace { - Mat src, src_gray; + // windows and trackbars name + const std::string windowName = "Hough Circle Detection Demo"; + const std::string cannyThresholdTrackbarName = "Canny threshold"; + const std::string accumulatorThresholdTrackbarName = "Accumulator Threshold"; + const std::string usage = "Usage : tutorial_HoughCircle_Demo \n"; - /// Read the image - src = imread( argv[1], 1 ); + // initial and max values of the parameters of interests. + const int cannyThresholdInitialValue = 200; + const int accumulatorThresholdInitialValue = 50; + const int maxAccumulatorThreshold = 200; + const int maxCannyThreshold = 255; - if( !src.data ) - { return -1; } - - /// Convert it to gray - cvtColor( src, src_gray, COLOR_BGR2GRAY ); - - /// Reduce the noise so we avoid false circle detection - GaussianBlur( src_gray, src_gray, Size(9, 9), 2, 2 ); - - vector circles; - - /// Apply the Hough Transform to find the circles - HoughCircles( src_gray, circles, HOUGH_GRADIENT, 1, src_gray.rows/8, 200, 100, 0, 0 ); - - /// Draw the circles detected - for( size_t i = 0; i < circles.size(); i++ ) + void HoughDetection(const Mat& src_gray, const Mat& src_display, int cannyThreshold, int accumulatorThreshold) { - Point center(cvRound(circles[i][0]), cvRound(circles[i][1])); - int radius = cvRound(circles[i][2]); - // circle center - circle( src, center, 3, Scalar(0,255,0), -1, 8, 0 ); - // circle outline - circle( src, center, radius, Scalar(0,0,255), 3, 8, 0 ); + // will hold the results of the detection + std::vector circles; + // runs the actual detection + HoughCircles( src_gray, circles, HOUGH_GRADIENT, 1, src_gray.rows/8, cannyThreshold, accumulatorThreshold, 0, 0 ); + + // clone the colour, input image for displaying purposes + Mat display = src_display.clone(); + for( size_t i = 0; i < circles.size(); i++ ) + { + Point center(cvRound(circles[i][0]), cvRound(circles[i][1])); + int radius = cvRound(circles[i][2]); + // circle center + circle( display, center, 3, Scalar(0,255,0), -1, 8, 0 ); + // circle outline + circle( display, center, radius, Scalar(0,0,255), 3, 8, 0 ); + } + + // shows the results + imshow( windowName, display); + } +} + + +int main(int argc, char** argv) +{ + Mat src, src_gray; + + if (argc < 2) + { + std::cerr<<"No input image specified\n"; + std::cout< good_matches; for( int i = 0; i < descriptors_1.rows; i++ ) - { if( matches[i].distance <= 2*min_dist ) + { if( matches[i].distance <= max(2*min_dist, 0.02) ) { good_matches.push_back( matches[i]); } } diff --git a/samples/cpp/tutorial_code/gpu/gpu-basics-similarity/gpu-basics-similarity.cpp b/samples/cpp/tutorial_code/gpu/gpu-basics-similarity/gpu-basics-similarity.cpp index b9e38797f..501f87c48 100644 --- a/samples/cpp/tutorial_code/gpu/gpu-basics-similarity/gpu-basics-similarity.cpp +++ b/samples/cpp/tutorial_code/gpu/gpu-basics-similarity/gpu-basics-similarity.cpp @@ -73,7 +73,7 @@ int main(int, char *argv[]) BufferPSNR bufferPSNR; BufferMSSIM bufferMSSIM; - int TIMES; + int TIMES = 10; stringstream sstr(argv[3]); sstr >> TIMES; double time, result = 0; diff --git a/samples/winrt/OcvImageProcessing/OcvImageProcessing.sln b/samples/winrt/OcvImageProcessing/OcvImageProcessing.sln new file mode 100644 index 000000000..11bf904bc --- /dev/null +++ b/samples/winrt/OcvImageProcessing/OcvImageProcessing.sln @@ -0,0 +1,38 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OcvImageProcessing", "OcvImageProcessing\OcvImageProcessing.vcxproj", "{A5555EA2-F9E8-4078-90F5-D428F2C0D6D1}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|ARM = Debug|ARM + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|ARM = Release|ARM + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {A5555EA2-F9E8-4078-90F5-D428F2C0D6D1}.Debug|ARM.ActiveCfg = Debug|ARM + {A5555EA2-F9E8-4078-90F5-D428F2C0D6D1}.Debug|ARM.Build.0 = Debug|ARM + {A5555EA2-F9E8-4078-90F5-D428F2C0D6D1}.Debug|ARM.Deploy.0 = Debug|ARM + {A5555EA2-F9E8-4078-90F5-D428F2C0D6D1}.Debug|Win32.ActiveCfg = Debug|Win32 + {A5555EA2-F9E8-4078-90F5-D428F2C0D6D1}.Debug|Win32.Build.0 = Debug|Win32 + {A5555EA2-F9E8-4078-90F5-D428F2C0D6D1}.Debug|Win32.Deploy.0 = Debug|Win32 + {A5555EA2-F9E8-4078-90F5-D428F2C0D6D1}.Debug|x64.ActiveCfg = Debug|x64 + {A5555EA2-F9E8-4078-90F5-D428F2C0D6D1}.Debug|x64.Build.0 = Debug|x64 + {A5555EA2-F9E8-4078-90F5-D428F2C0D6D1}.Debug|x64.Deploy.0 = Debug|x64 + {A5555EA2-F9E8-4078-90F5-D428F2C0D6D1}.Release|ARM.ActiveCfg = Release|ARM + {A5555EA2-F9E8-4078-90F5-D428F2C0D6D1}.Release|ARM.Build.0 = Release|ARM + {A5555EA2-F9E8-4078-90F5-D428F2C0D6D1}.Release|ARM.Deploy.0 = Release|ARM + {A5555EA2-F9E8-4078-90F5-D428F2C0D6D1}.Release|Win32.ActiveCfg = Release|Win32 + {A5555EA2-F9E8-4078-90F5-D428F2C0D6D1}.Release|Win32.Build.0 = Release|Win32 + {A5555EA2-F9E8-4078-90F5-D428F2C0D6D1}.Release|Win32.Deploy.0 = Release|Win32 + {A5555EA2-F9E8-4078-90F5-D428F2C0D6D1}.Release|x64.ActiveCfg = Release|x64 + {A5555EA2-F9E8-4078-90F5-D428F2C0D6D1}.Release|x64.Build.0 = Release|x64 + {A5555EA2-F9E8-4078-90F5-D428F2C0D6D1}.Release|x64.Deploy.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/samples/winrt/OcvImageProcessing/OcvImageProcessing/App.xaml b/samples/winrt/OcvImageProcessing/OcvImageProcessing/App.xaml new file mode 100644 index 000000000..78409d511 --- /dev/null +++ b/samples/winrt/OcvImageProcessing/OcvImageProcessing/App.xaml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + diff --git a/samples/winrt/OcvImageProcessing/OcvImageProcessing/App.xaml.cpp b/samples/winrt/OcvImageProcessing/OcvImageProcessing/App.xaml.cpp new file mode 100644 index 000000000..228e24a1f --- /dev/null +++ b/samples/winrt/OcvImageProcessing/OcvImageProcessing/App.xaml.cpp @@ -0,0 +1,107 @@ +// +// App.xaml.cpp +// Implementation of the App class. +// + +#include "pch.h" +#include "MainPage.xaml.h" + +using namespace OcvImageProcessing; + +using namespace Platform; +using namespace Windows::ApplicationModel; +using namespace Windows::ApplicationModel::Activation; +using namespace Windows::Foundation; +using namespace Windows::Foundation::Collections; +using namespace Windows::UI::Xaml; +using namespace Windows::UI::Xaml::Controls; +using namespace Windows::UI::Xaml::Controls::Primitives; +using namespace Windows::UI::Xaml::Data; +using namespace Windows::UI::Xaml::Input; +using namespace Windows::UI::Xaml::Interop; +using namespace Windows::UI::Xaml::Media; +using namespace Windows::UI::Xaml::Navigation; + +// The Blank Application template is documented at http://go.microsoft.com/fwlink/?LinkId=234227 + +/// +/// Initializes the singleton application object. This is the first line of authored code +/// executed, and as such is the logical equivalent of main() or WinMain(). +/// +App::App() +{ + InitializeComponent(); + Suspending += ref new SuspendingEventHandler(this, &App::OnSuspending); +} + +/// +/// Invoked when the application is launched normally by the end user. Other entry points +/// will be used when the application is launched to open a specific file, to display +/// search results, and so forth. +/// +/// Details about the launch request and process. +void App::OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ args) +{ + auto rootFrame = dynamic_cast(Window::Current->Content); + + // Do not repeat app initialization when the Window already has content, + // just ensure that the window is active + if (rootFrame == nullptr) + { + // Create a Frame to act as the navigation context and associate it with + // a SuspensionManager key + rootFrame = ref new Frame(); + + if (args->PreviousExecutionState == ApplicationExecutionState::Terminated) + { + // TODO: Restore the saved session state only when appropriate, scheduling the + // final launch steps after the restore is complete + + } + + if (rootFrame->Content == nullptr) + { + // When the navigation stack isn't restored navigate to the first page, + // configuring the new page by passing required information as a navigation + // parameter + if (!rootFrame->Navigate(TypeName(MainPage::typeid), args->Arguments)) + { + throw ref new FailureException("Failed to create initial page"); + } + } + // Place the frame in the current Window + Window::Current->Content = rootFrame; + // Ensure the current window is active + Window::Current->Activate(); + } + else + { + if (rootFrame->Content == nullptr) + { + // When the navigation stack isn't restored navigate to the first page, + // configuring the new page by passing required information as a navigation + // parameter + if (!rootFrame->Navigate(TypeName(MainPage::typeid), args->Arguments)) + { + throw ref new FailureException("Failed to create initial page"); + } + } + // Ensure the current window is active + Window::Current->Activate(); + } +} + +/// +/// Invoked when application execution is being suspended. Application state is saved +/// without knowing whether the application will be terminated or resumed with the contents +/// of memory still intact. +/// +/// The source of the suspend request. +/// Details about the suspend request. +void App::OnSuspending(Object^ sender, SuspendingEventArgs^ e) +{ + (void) sender; // Unused parameter + (void) e; // Unused parameter + + //TODO: Save application state and stop any background activity +} diff --git a/samples/winrt/OcvImageProcessing/OcvImageProcessing/App.xaml.h b/samples/winrt/OcvImageProcessing/OcvImageProcessing/App.xaml.h new file mode 100644 index 000000000..8e16532bc --- /dev/null +++ b/samples/winrt/OcvImageProcessing/OcvImageProcessing/App.xaml.h @@ -0,0 +1,24 @@ +// +// App.xaml.h +// Declaration of the App class. +// + +#pragma once + +#include "App.g.h" + +namespace OcvImageProcessing +{ + /// + /// Provides application-specific behavior to supplement the default Application class. + /// + ref class App sealed + { + public: + App(); + virtual void OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ args) override; + + private: + void OnSuspending(Platform::Object^ sender, Windows::ApplicationModel::SuspendingEventArgs^ e); + }; +} diff --git a/samples/winrt/OcvImageProcessing/OcvImageProcessing/Assets/Lena.png b/samples/winrt/OcvImageProcessing/OcvImageProcessing/Assets/Lena.png new file mode 100644 index 000000000..3e8668734 Binary files /dev/null and b/samples/winrt/OcvImageProcessing/OcvImageProcessing/Assets/Lena.png differ diff --git a/samples/winrt/OcvImageProcessing/OcvImageProcessing/Assets/Logo.png b/samples/winrt/OcvImageProcessing/OcvImageProcessing/Assets/Logo.png new file mode 100644 index 000000000..ea685d651 Binary files /dev/null and b/samples/winrt/OcvImageProcessing/OcvImageProcessing/Assets/Logo.png differ diff --git a/samples/winrt/OcvImageProcessing/OcvImageProcessing/Assets/SmallLogo.png b/samples/winrt/OcvImageProcessing/OcvImageProcessing/Assets/SmallLogo.png new file mode 100644 index 000000000..efaf5468a Binary files /dev/null and b/samples/winrt/OcvImageProcessing/OcvImageProcessing/Assets/SmallLogo.png differ diff --git a/samples/winrt/OcvImageProcessing/OcvImageProcessing/Assets/SplashScreen.png b/samples/winrt/OcvImageProcessing/OcvImageProcessing/Assets/SplashScreen.png new file mode 100644 index 000000000..901c3b085 Binary files /dev/null and b/samples/winrt/OcvImageProcessing/OcvImageProcessing/Assets/SplashScreen.png differ diff --git a/samples/winrt/OcvImageProcessing/OcvImageProcessing/Assets/StoreLogo.png b/samples/winrt/OcvImageProcessing/OcvImageProcessing/Assets/StoreLogo.png new file mode 100644 index 000000000..af64bf00a Binary files /dev/null and b/samples/winrt/OcvImageProcessing/OcvImageProcessing/Assets/StoreLogo.png differ diff --git a/samples/winrt/OcvImageProcessing/OcvImageProcessing/Common/StandardStyles.xaml b/samples/winrt/OcvImageProcessing/OcvImageProcessing/Common/StandardStyles.xaml new file mode 100644 index 000000000..4def039e5 --- /dev/null +++ b/samples/winrt/OcvImageProcessing/OcvImageProcessing/Common/StandardStyles.xaml @@ -0,0 +1,1828 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Mouse + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/winrt/OcvImageProcessing/OcvImageProcessing/MainPage.xaml b/samples/winrt/OcvImageProcessing/OcvImageProcessing/MainPage.xaml new file mode 100644 index 000000000..86db7b825 --- /dev/null +++ b/samples/winrt/OcvImageProcessing/OcvImageProcessing/MainPage.xaml @@ -0,0 +1,23 @@ + + + + +