diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 4f1453a2ff..e72c70d8c3 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -1,6 +1,6 @@ diff --git a/3rdparty/carotene/src/resize.cpp b/3rdparty/carotene/src/resize.cpp index 3a80d472df..184deb1205 100644 --- a/3rdparty/carotene/src/resize.cpp +++ b/3rdparty/carotene/src/resize.cpp @@ -432,7 +432,7 @@ inline void resizeAreaRounding(const Size2D &ssize, const Size2D &dsize, vSum = vaddq_u16(vSum, vaddl_u8(vLane4.val[0], vLane4.val[1])); vSum = vaddq_u16(vSum, vaddl_u8(vLane4.val[2], vLane4.val[3])); - vst1_u8(dst_row + dj, areaDownsamplingDivision(vSum)); + vst1_u8(dst_row + dj, (areaDownsamplingDivision(vSum))); } for ( ; dj < dsize.width; ++dj, sj += 4) @@ -706,7 +706,7 @@ inline void resizeAreaRounding(const Size2D &ssize, const Size2D &dsize, uint16x8_t v_sum = vcombine_u16(vadd_u16(vget_low_u16(v_sum0), vget_high_u16(v_sum0)), vadd_u16(vget_low_u16(v_sum1), vget_high_u16(v_sum1))); - vst1_u8(dst_row + dj, areaDownsamplingDivision(v_sum)); + vst1_u8(dst_row + dj, (areaDownsamplingDivision(v_sum))); } for (size_t dwidth = dsize.width << 2; dj < dwidth; dj += 4, sj += 16) diff --git a/3rdparty/ffmpeg/ffmpeg.cmake b/3rdparty/ffmpeg/ffmpeg.cmake index 448ad2bb2c..193b5d8905 100644 --- a/3rdparty/ffmpeg/ffmpeg.cmake +++ b/3rdparty/ffmpeg/ffmpeg.cmake @@ -1,11 +1,11 @@ -# Binary branch name: ffmpeg/master_20150703 -# Binaries were created for OpenCV: e379ea6ed60b0caad4d4e3eea096e9d850cb8c86 -set(FFMPEG_BINARIES_COMMIT "8aeefc4efe3215de89d8c7e114ae6f7a6091b8eb") -set(FFMPEG_FILE_HASH_BIN32 "89c783eee1c47bfc733f08334ec2e31c") -set(FFMPEG_FILE_HASH_BIN64 "35fe6ccdda6d7a04e9056b0d73b98e76") -set(FFMPEG_FILE_HASH_CMAKE "8606f947a780071f8fcce8cbf39ceef5") +# Binary branch name: ffmpeg/master_20160715 +# Binaries were created for OpenCV: 0e6aa189cb9a9642b0ae7983d301693516faad5d +set(FFMPEG_BINARIES_COMMIT "7eef9080d3271c7547d303fa839a62e1124ff1e6") +set(FFMPEG_FILE_HASH_BIN32 "3bb2a8388af90adf6c762210e696400d") +set(FFMPEG_FILE_HASH_BIN64 "ebcfc963f0a94f7e83d58d60eaf23849") +set(FFMPEG_FILE_HASH_CMAKE "f99941d10c1e87bf16b9055e8fc91ab2") -set(FFMPEG_DOWNLOAD_URL ${OPENCV_FFMPEG_URL};$ENV{OPENCV_FFMPEG_URL};https://raw.githubusercontent.com/Itseez/opencv_3rdparty/${FFMPEG_BINARIES_COMMIT}/ffmpeg/) +set(FFMPEG_DOWNLOAD_URL ${OPENCV_FFMPEG_URL};$ENV{OPENCV_FFMPEG_URL};https://raw.githubusercontent.com/opencv/opencv_3rdparty/${FFMPEG_BINARIES_COMMIT}/ffmpeg/) ocv_download(PACKAGE opencv_ffmpeg.dll HASH ${FFMPEG_FILE_HASH_BIN32} diff --git a/3rdparty/ippicv/downloader.cmake b/3rdparty/ippicv/downloader.cmake index a6016dbe10..e20804d7b4 100644 --- a/3rdparty/ippicv/downloader.cmake +++ b/3rdparty/ippicv/downloader.cmake @@ -64,7 +64,7 @@ function(_icv_downloader) if(DEFINED ENV{OPENCV_ICV_URL}) set(OPENCV_ICV_URL $ENV{OPENCV_ICV_URL}) else() - set(OPENCV_ICV_URL "https://raw.githubusercontent.com/Itseez/opencv_3rdparty/${IPPICV_BINARIES_COMMIT}/ippicv") + set(OPENCV_ICV_URL "https://raw.githubusercontent.com/opencv/opencv_3rdparty/${IPPICV_BINARIES_COMMIT}/ippicv") endif() endif() diff --git a/CMakeLists.txt b/CMakeLists.txt index 7ea42680b9..05d88544c8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -164,6 +164,8 @@ endif() # OpenCV cmake options # ---------------------------------------------------------------------------- +OCV_OPTION(OPENCV_ENABLE_NONFREE "Enable non-free algorithms" OFF) + # Optional 3rd party components # =================================================== OCV_OPTION(WITH_1394 "Include IEEE1394 support" ON IF (NOT ANDROID AND NOT IOS AND NOT WINRT) ) @@ -191,6 +193,7 @@ OCV_OPTION(WITH_OPENGL "Include OpenGL support" OFF OCV_OPTION(WITH_OPENNI "Include OpenNI support" OFF IF (NOT ANDROID AND NOT IOS AND NOT WINRT) ) OCV_OPTION(WITH_OPENNI2 "Include OpenNI2 support" OFF IF (NOT ANDROID AND NOT IOS AND NOT WINRT) ) OCV_OPTION(WITH_PNG "Include PNG support" ON) +OCV_OPTION(WITH_GDCM "Include DICOM support" OFF) OCV_OPTION(WITH_PVAPI "Include Prosilica GigE support" OFF IF (NOT ANDROID AND NOT IOS AND NOT WINRT) ) OCV_OPTION(WITH_GIGEAPI "Include Smartek GigE support" OFF IF (NOT ANDROID AND NOT IOS AND NOT WINRT) ) OCV_OPTION(WITH_QT "Build with Qt Backend support" OFF IF (NOT ANDROID AND NOT IOS AND NOT WINRT) ) @@ -221,7 +224,7 @@ OCV_OPTION(WITH_VA "Include VA support" OFF OCV_OPTION(WITH_VA_INTEL "Include Intel VA-API/OpenCL support" OFF IF (UNIX AND NOT ANDROID) ) OCV_OPTION(WITH_GDAL "Include GDAL Support" OFF IF (NOT ANDROID AND NOT IOS AND NOT WINRT) ) OCV_OPTION(WITH_GPHOTO2 "Include gPhoto2 library support" ON IF (UNIX AND NOT ANDROID) ) -OCV_OPTION(WITH_LAPACK "Include Lapack library support" ON IF (UNIX AND NOT ANDROID) ) +OCV_OPTION(WITH_LAPACK "Include Lapack library support" ON IF (NOT ANDROID) ) # OpenCV build components # =================================================== @@ -913,6 +916,11 @@ status(" Disabled:" OPENCV_MODULES_DISABLED_USER THEN ${OPENCV status(" Disabled by dependency:" OPENCV_MODULES_DISABLED_AUTO THEN ${OPENCV_MODULES_DISABLED_AUTO_ST} ELSE "-") status(" Unavailable:" OPENCV_MODULES_DISABLED_FORCE THEN ${OPENCV_MODULES_DISABLED_FORCE_ST} ELSE "-") +if(OPENCV_ENABLE_NONFREE) + status("") + status(" Non-free algorithms are enabled") +endif() + # ========================== Android details ========================== if(ANDROID) status("") @@ -1008,6 +1016,7 @@ if(WITH_PNG) else() status(" PNG:" "NO") endif() + if(WITH_TIFF) if(TIFF_VERSION_STRING AND TIFF_FOUND) status(" TIFF:" "${TIFF_LIBRARY} (ver ${TIFF_VERSION} - ${TIFF_VERSION_STRING})") @@ -1034,6 +1043,12 @@ else() status(" GDAL:" "NO") endif() +if(WITH_GDCM) + status(" GDCM:" GDCM_FOUND THEN "YES (ver ${GDCM_VERSION})" ELSE "NO") +else() + status(" GDCM:" "NO") +endif() + # ========================== VIDEO IO ========================== status("") status(" Video I/O:") diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1e13c89969..318e9ac8fc 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,3 +1,3 @@ ## Contributing guidelines -All guidelines for contributing to the OpenCV repository can be found at [`How to contribute guideline`](https://github.com/Itseez/opencv/wiki/How_to_contribute). +All guidelines for contributing to the OpenCV repository can be found at [`How to contribute guideline`](https://github.com/opencv/opencv/wiki/How_to_contribute). diff --git a/README.md b/README.md index 7dbc823200..37543b6e5d 100644 --- a/README.md +++ b/README.md @@ -5,11 +5,11 @@ * Homepage: * Docs: * Q&A forum: -* Issue tracking: +* Issue tracking: #### Contributing -Please read before starting work on a pull request: +Please read before starting work on a pull request: Summary of guidelines: diff --git a/apps/CMakeLists.txt b/apps/CMakeLists.txt index 497bb7d1f5..e24bd4beff 100644 --- a/apps/CMakeLists.txt +++ b/apps/CMakeLists.txt @@ -5,3 +5,4 @@ add_subdirectory(traincascade) add_subdirectory(createsamples) add_subdirectory(annotation) add_subdirectory(visualisation) +add_subdirectory(interactive-calibration) diff --git a/apps/annotation/opencv_annotation.cpp b/apps/annotation/opencv_annotation.cpp index d8ff61d209..febe9fc95d 100644 --- a/apps/annotation/opencv_annotation.cpp +++ b/apps/annotation/opencv_annotation.cpp @@ -224,29 +224,30 @@ vector get_annotations(Mat input_image) int main( int argc, const char** argv ) { - // If no arguments are given, then supply some information on how this tool works - if( argc == 1 ){ - cout << "Usage: " << argv[0] << endl; - cout << " -images [example - /data/testimages/]" << endl; - cout << " -annotations [example - /data/annotations.txt]" << endl; - cout << "TIP: Use absolute paths to avoid any problems with the software!" << endl; + // Use the cmdlineparser to process input arguments + CommandLineParser parser(argc, argv, + "{ help h usage ? | | show this message }" + "{ images i | | (required) path to image folder [example - /data/testimages/] }" + "{ annotations a | | (required) path to annotations txt file [example - /data/annotations.txt] }" + "{ maxWindowHeight m | -1 | (optional) images larger in height than this value will be scaled down }" + "{ resizeFactor r | 2 | (optional) factor for scaling down [default = half the size] }" + ); + // Read in the input arguments + if (parser.has("help")){ + parser.printMessage(); + cerr << "TIP: Use absolute paths to avoid any problems with the software!" << endl; + return 0; + } + string image_folder(parser.get("images")); + string annotations_file(parser.get("annotations")); + if (image_folder.empty() || annotations_file.empty()){ + parser.printMessage(); + cerr << "TIP: Use absolute paths to avoid any problems with the software!" << endl; return -1; } - // Read in the input arguments - string image_folder; - string annotations_file; - for(int i = 1; i < argc; ++i ) - { - if( !strcmp( argv[i], "-images" ) ) - { - image_folder = argv[++i]; - } - else if( !strcmp( argv[i], "-annotations" ) ) - { - annotations_file = argv[++i]; - } - } + int resizeFactor = parser.get("resizeFactor"); + int const maxWindowHeight = parser.get("maxWindowHeight") > 0 ? parser.get("maxWindowHeight") : -1; // Check if the folder actually exists // If -1 is returned then the folder actually exists, and thus you can continue @@ -282,6 +283,7 @@ int main( int argc, const char** argv ) for (size_t i = 0; i < filenames.size(); i++){ // Read in an image Mat current_image = imread(filenames[i]); + bool const resize_bool = (maxWindowHeight > 0) && (current_image.rows > maxWindowHeight); // Check if the image is actually read - avoid other files in the folder, because glob() takes them all // If not then simply skip this iteration @@ -289,8 +291,21 @@ int main( int argc, const char** argv ) continue; } + if(resize_bool){ + resize(current_image, current_image, Size(current_image.cols/resizeFactor, current_image.rows/resizeFactor)); + } + // Perform annotations & store the result inside the vectorized structure + // If the image was resized before, then resize the found annotations back to original dimensions vector current_annotations = get_annotations(current_image); + if(resize_bool){ + for(int j =0; j < (int)current_annotations.size(); j++){ + current_annotations[j].x = current_annotations[j].x * resizeFactor; + current_annotations[j].y = current_annotations[j].y * resizeFactor; + current_annotations[j].width = current_annotations[j].width * resizeFactor; + current_annotations[j].height = current_annotations[j].height * resizeFactor; + } + } annotations.push_back(current_annotations); // Check if the ESC key was hit, then exit earlier then expected diff --git a/apps/createsamples/createsamples.cpp b/apps/createsamples/createsamples.cpp index 9f05e416bd..1660adee44 100644 --- a/apps/createsamples/createsamples.cpp +++ b/apps/createsamples/createsamples.cpp @@ -76,6 +76,7 @@ int main( int argc, char* argv[] ) double scale = 4.0; int width = 24; int height = 24; + double maxscale = -1.0; srand((unsigned int)time(0)); @@ -92,9 +93,10 @@ int main( int argc, char* argv[] ) " [-maxyangle ]\n" " [-maxzangle ]\n" " [-show []]\n" - " [-w ]\n [-h ]\n", + " [-w ]\n [-h ]\n" + " [-maxscale ]\n", argv[0], num, bgcolor, bgthreshold, maxintensitydev, - maxxangle, maxyangle, maxzangle, scale, width, height ); + maxxangle, maxyangle, maxzangle, scale, width, height, maxscale ); return 0; } @@ -172,6 +174,10 @@ int main( int argc, char* argv[] ) { height = atoi( argv[++i] ); } + else if( !strcmp( argv[i], "-maxscale" ) ) + { + maxscale = atof( argv[++i] ); + } } printf( "Info file name: %s\n", ((infoname == NULL) ? nullname : infoname ) ); @@ -194,6 +200,7 @@ int main( int argc, char* argv[] ) } printf( "Width: %d\n", width ); printf( "Height: %d\n", height ); + printf( "Max Scale: %g\n", maxscale); /* determine action */ if( imagename && vecname ) @@ -213,7 +220,7 @@ int main( int argc, char* argv[] ) cvCreateTestSamples( infoname, imagename, bgcolor, bgthreshold, bgfilename, num, invert, maxintensitydev, - maxxangle, maxyangle, maxzangle, showsamples, width, height ); + maxxangle, maxyangle, maxzangle, showsamples, width, height, maxscale); printf( "Done\n" ); } diff --git a/apps/createsamples/utility.cpp b/apps/createsamples/utility.cpp index b5834f3e02..cf2bdebbf9 100644 --- a/apps/createsamples/utility.cpp +++ b/apps/createsamples/utility.cpp @@ -38,7 +38,6 @@ // the use of this software, even if advised of the possibility of such damage. // //M*/ - #include #include @@ -1308,7 +1307,7 @@ void cvCreateTestSamples( const char* infoname, int invert, int maxintensitydev, double maxxangle, double maxyangle, double maxzangle, int showsamples, - int winwidth, int winheight ) + int winwidth, int winheight, double maxscale ) { CvSampleDistortionData data; @@ -1337,7 +1336,6 @@ void cvCreateTestSamples( const char* infoname, int i; int x, y, width, height; float scale; - float maxscale; int inverse; if( showsamples ) @@ -1366,12 +1364,16 @@ void cvCreateTestSamples( const char* infoname, for( i = 0; i < count; i++ ) { icvGetNextFromBackgroundData( cvbgdata, cvbgreader ); - - maxscale = MIN( 0.7F * cvbgreader->src.cols / winwidth, + if( maxscale < 0.0 ) + { + maxscale = MIN( 0.7F * cvbgreader->src.cols / winwidth, 0.7F * cvbgreader->src.rows / winheight ); + } + if( maxscale < 1.0F ) continue; - scale = (maxscale - 1.0F) * rand() / RAND_MAX + 1.0F; + scale = ((float)maxscale - 1.0F) * rand() / RAND_MAX + 1.0F; + width = (int) (scale * winwidth); height = (int) (scale * winheight); x = (int) ((0.1+0.8 * rand()/RAND_MAX) * (cvbgreader->src.cols - width)); diff --git a/apps/createsamples/utility.hpp b/apps/createsamples/utility.hpp index 9367778daf..d04947c9be 100644 --- a/apps/createsamples/utility.hpp +++ b/apps/createsamples/utility.hpp @@ -86,7 +86,7 @@ void cvCreateTestSamples( const char* infoname, int invert, int maxintensitydev, double maxxangle, double maxyangle, double maxzangle, int showsamples, - int winwidth, int winheight ); + int winwidth, int winheight, double maxscale ); /* * cvCreateTrainingSamplesFromInfo diff --git a/apps/interactive-calibration/main.cpp b/apps/interactive-calibration/main.cpp index 06521593f8..f41bcbc371 100644 --- a/apps/interactive-calibration/main.cpp +++ b/apps/interactive-calibration/main.cpp @@ -23,7 +23,7 @@ const std::string keys = "{v | | Input from video file }" "{ci | 0 | Default camera id }" "{flip | false | Vertical flip of input frames }" - "{t | circles | Template for calibration (circles, chessboard, dualCircles, chAruco) }" + "{t | circles | Template for calibration (circles, chessboard, dualCircles, charuco) }" "{sz | 16.3 | Distance between two nearest centers of circles or squares on calibration board}" "{dst | 295 | Distance between white and black parts of daulCircles template}" "{w | | Width of template (in corners or circles)}" diff --git a/apps/traincascade/cascadeclassifier.cpp b/apps/traincascade/cascadeclassifier.cpp index b26daf1211..9c24feb49a 100644 --- a/apps/traincascade/cascadeclassifier.cpp +++ b/apps/traincascade/cascadeclassifier.cpp @@ -310,7 +310,8 @@ bool CvCascadeClassifier::updateTrainingSet( double minimumAcceptanceRatio, doub int proNumNeg = cvRound( ( ((double)numNeg) * ((double)posCount) ) / numPos ); // apply only a fraction of negative samples. double is required since overflow is possible int negCount = fillPassedSamples( posCount, proNumNeg, false, minimumAcceptanceRatio, negConsumed ); if ( !negCount ) - return false; + if ( !(negConsumed > 0 && ((double)negCount+1)/(double)negConsumed <= minimumAcceptanceRatio) ) + return false; curNumSamples = posCount + negCount; acceptanceRatio = negConsumed == 0 ? 0 : ( (double)negCount/(double)(int64)negConsumed ); diff --git a/apps/visualisation/opencv_visualisation.cpp b/apps/visualisation/opencv_visualisation.cpp index 75703bd528..68ebd65902 100644 --- a/apps/visualisation/opencv_visualisation.cpp +++ b/apps/visualisation/opencv_visualisation.cpp @@ -49,13 +49,6 @@ understanding of the used features. USAGE: ./opencv_visualisation --model= --image= --data=