Skip to content

Commit ae5d66a

Browse files
committed
Merge branch '4.x' into remap_relative
2 parents 4260a93 + c950656 commit ae5d66a

File tree

43 files changed

+850
-148
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+850
-148
lines changed

modules/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ $ cmake -D OPENCV_EXTRA_MODULES_PATH=<opencv_contrib>/modules -D BUILD_opencv_<r
7272

7373
- **saliency**: Saliency API -- Where humans would look in a scene. Has routines for static, motion and "objectness" saliency.
7474

75+
- **signal**: Signal processing algorithms
76+
7577
- **sfm**: Structure from Motion -- This module contains algorithms to perform 3d reconstruction from 2d images. The core of the module is a light version of Libmv.
7678

7779
- **shape**: Shape Distance and Matching

modules/ccalib/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
set(the_description "Custom Calibration Pattern")
2-
ocv_define_module(ccalib opencv_core opencv_imgproc opencv_calib3d opencv_features2d opencv_highgui WRAP python)
2+
ocv_define_module(ccalib opencv_core opencv_imgproc opencv_calib3d opencv_features2d opencv_highgui opencv_imgcodecs WRAP python)

modules/ccalib/src/precomp.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
#include <opencv2/core.hpp>
4747
#include <opencv2/calib3d.hpp>
4848
#include <opencv2/features2d.hpp>
49+
#include "opencv2/imgcodecs.hpp"
4950
#include "opencv2/imgproc.hpp"
5051
#include "opencv2/highgui.hpp"
5152
#include <vector>

modules/cudaarithm/CMakeLists.txt

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,35 @@ set(the_description "CUDA-accelerated Operations on Matrices")
66

77
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4127 /wd4324 /wd4512 -Wundef -Wmissing-declarations -Wshadow)
88

9-
ocv_add_module(cudaarithm opencv_core OPTIONAL opencv_cudev WRAP python)
9+
set(extra_dependencies "")
10+
set(optional_dependencies "")
11+
if(ENABLE_CUDA_FIRST_CLASS_LANGUAGE)
12+
list(APPEND extra_dependencies CUDA::cudart_static CUDA::nppial${CUDA_LIB_EXT} CUDA::nppc${CUDA_LIB_EXT} CUDA::nppitc${CUDA_LIB_EXT} CUDA::nppig${CUDA_LIB_EXT} CUDA::nppist${CUDA_LIB_EXT} CUDA::nppidei${CUDA_LIB_EXT})
13+
if(HAVE_CUBLAS)
14+
list(APPEND optional_dependencies CUDA::cublas${CUDA_LIB_EXT})
15+
if(NOT CUDA_VERSION VERSION_LESS 10.1)
16+
list(APPEND optional_dependencies CUDA::cublasLt${CUDA_LIB_EXT})
17+
endif()
18+
endif()
19+
if(HAVE_CUFFT)
20+
# static version requires seperable compilation which is incompatible with opencv's current library structure
21+
list(APPEND optional_dependencies CUDA::cufft)
22+
endif()
23+
else()
24+
if(HAVE_CUBLAS)
25+
list(APPEND optional_dependencies ${CUDA_cublas_LIBRARY})
26+
endif()
27+
if(HAVE_CUFFT)
28+
list(APPEND optional_dependencies ${CUDA_cufft_LIBRARY})
29+
endif()
30+
endif()
31+
32+
ocv_add_module(cudaarithm opencv_core ${extra_dependencies} OPTIONAL opencv_cudev ${optional_dependencies} WRAP python)
1033

1134
ocv_module_include_directories()
1235
ocv_glob_module_sources()
1336

14-
set(extra_libs "")
15-
16-
if(HAVE_CUBLAS)
17-
list(APPEND extra_libs ${CUDA_cublas_LIBRARY})
18-
endif()
19-
20-
if(HAVE_CUFFT)
21-
list(APPEND extra_libs ${CUDA_cufft_LIBRARY})
22-
endif()
23-
24-
ocv_create_module(${extra_libs})
37+
ocv_create_module()
2538

2639
ocv_add_accuracy_tests(DEPENDS_ON opencv_imgproc)
2740
ocv_add_perf_tests(DEPENDS_ON opencv_imgproc)

modules/cudabgsegm/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,7 @@ endif()
55
set(the_description "CUDA-accelerated Background Segmentation")
66

77
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4127 /wd4324 /wd4512 -Wundef -Wmissing-declarations -Wshadow)
8-
8+
if(ENABLE_CUDA_FIRST_CLASS_LANGUAGE)
9+
ocv_module_include_directories(${CUDAToolkit_INCLUDE_DIRS})
10+
endif()
911
ocv_define_module(cudabgsegm opencv_video WRAP python)

modules/cudacodec/CMakeLists.txt

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ endif()
44

55
set(the_description "CUDA-accelerated Video Encoding/Decoding")
66

7-
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4127 /wd4324 /wd4512 -Wundef -Wshadow)
7+
if(WIN32)
8+
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4127 /wd4324 /wd4512)
9+
else()
10+
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wundef -Wshadow -Wsign-compare -Wenum-compare)
11+
endif()
812

913
set(required_dependencies opencv_core opencv_videoio opencv_cudaarithm opencv_cudawarping)
1014
if(HAVE_NVCUVENC)
@@ -18,10 +22,25 @@ ocv_glob_module_sources()
1822

1923
set(extra_libs "")
2024

25+
if(WITH_NVCUVID AND NOT HAVE_NVCUVID)
26+
message(WARNING "cudacodec::VideoReader requires Nvidia Video Codec SDK. Please resolve dependency or disable WITH_NVCUVID=OFF")
27+
endif()
28+
29+
if(WITH_NVCUVENC AND NOT HAVE_NVCUVENC)
30+
message(WARNING "cudacodec::VideoWriter requires Nvidia Video Codec SDK. Please resolve dependency or disable WITH_NVCUVENC=OFF")
31+
endif()
32+
2133
if(HAVE_NVCUVID OR HAVE_NVCUVENC)
22-
list(APPEND extra_libs ${CUDA_CUDA_LIBRARY})
34+
if(ENABLE_CUDA_FIRST_CLASS_LANGUAGE)
35+
list(APPEND extra_libs CUDA::cuda_driver)
36+
else()
37+
list(APPEND extra_libs ${CUDA_CUDA_LIBRARY})
38+
endif()
2339
if(HAVE_NVCUVID)
2440
list(APPEND extra_libs ${CUDA_nvcuvid_LIBRARY})
41+
if(ENABLE_CUDA_FIRST_CLASS_LANGUAGE)
42+
list(APPEND extra_libs CUDA::nppicc${CUDA_LIB_EXT})
43+
endif()
2544
endif()
2645
if(HAVE_NVCUVENC)
2746
if(WIN32)

modules/cudacodec/src/ffmpeg_video_source.cpp

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -66,55 +66,9 @@ static std::string fourccToString(int fourcc)
6666
(i32_c.c[3] >= ' ' && i32_c.c[3] < 128) ? i32_c.c[3] : '?');
6767
}
6868

69-
// handle old FFmpeg backend - remove when windows shared library is updated
70-
#ifdef _WIN32
71-
static
72-
Codec FourccToCodecWin32Old(int codec)
73-
{
74-
switch (codec)
75-
{
76-
case CV_FOURCC_MACRO('m', 'p', 'e', 'g'): // fallthru
77-
case CV_FOURCC_MACRO('m', 'p', 'g', '1'): // fallthru
78-
case CV_FOURCC_MACRO('M', 'P', 'G', '1'): return MPEG1;
79-
case CV_FOURCC_MACRO('m', 'p', 'g', '2'): // fallthru
80-
case CV_FOURCC_MACRO('M', 'P', 'G', '2'): return MPEG2;
81-
case CV_FOURCC_MACRO('X', 'V', 'I', 'D'): // fallthru
82-
case CV_FOURCC_MACRO('m', 'p', '4', 'v'): // fallthru
83-
case CV_FOURCC_MACRO('D', 'I', 'V', 'X'): return MPEG4;
84-
case CV_FOURCC_MACRO('W', 'V', 'C', '1'): return VC1;
85-
case CV_FOURCC_MACRO('H', '2', '6', '4'): // fallthru
86-
case CV_FOURCC_MACRO('h', '2', '6', '4'): // fallthru
87-
case CV_FOURCC_MACRO('a', 'v', 'c', '1'): return H264;
88-
case CV_FOURCC_MACRO('H', '2', '6', '5'): // fallthru
89-
case CV_FOURCC_MACRO('h', '2', '6', '5'): // fallthru
90-
case CV_FOURCC_MACRO('h', 'e', 'v', 'c'): return HEVC;
91-
case CV_FOURCC_MACRO('M', 'J', 'P', 'G'): return JPEG;
92-
case CV_FOURCC_MACRO('v', 'p', '8', '0'): // fallthru
93-
case CV_FOURCC_MACRO('V', 'P', '8', '0'): // fallthru
94-
case CV_FOURCC_MACRO('v', 'p', '0', '8'): // fallthru
95-
case CV_FOURCC_MACRO('V', 'P', '0', '8'): return VP8;
96-
case CV_FOURCC_MACRO('v', 'p', '9', '0'): // fallthru
97-
case CV_FOURCC_MACRO('V', 'P', '9', '0'): // fallthru
98-
case CV_FOURCC_MACRO('V', 'P', '0', '9'): // fallthru
99-
case CV_FOURCC_MACRO('v', 'p', '0', '9'): return VP9;
100-
case CV_FOURCC_MACRO('a', 'v', '1', '0'): // fallthru
101-
case CV_FOURCC_MACRO('A', 'V', '1', '0'): // fallthru
102-
case CV_FOURCC_MACRO('a', 'v', '0', '1'): // fallthru
103-
case CV_FOURCC_MACRO('A', 'V', '0', '1'): return AV1;
104-
default:
105-
return NumCodecs;
106-
}
107-
}
108-
#endif
109-
11069
static
11170
Codec FourccToCodec(int codec)
11271
{
113-
#ifdef _WIN32 // handle old FFmpeg backend - remove when windows shared library is updated
114-
Codec win32OldCodec = FourccToCodecWin32Old(codec);
115-
if(win32OldCodec != NumCodecs)
116-
return win32OldCodec;
117-
#endif
11872
switch (codec)
11973
{
12074
case CV_FOURCC_MACRO('m', 'p', 'g', '1'): return MPEG1;

modules/cudacodec/src/video_writer.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -402,13 +402,10 @@ Ptr<VideoWriter> createVideoWriter(const String& fileName, const Size frameSize,
402402
{
403403
CV_Assert(params.idrPeriod >= params.gopLength);
404404
if (!encoderCallback) {
405-
// required until PR for raw video encapsulation is merged and windows dll is updated
406-
#ifndef WIN32 // remove #define and keep code once merged
407405
try {
408406
encoderCallback = new FFmpegVideoWriter(fileName, codec, fps, frameSize, params.idrPeriod);
409407
}
410408
catch (...)
411-
#endif
412409
{
413410
encoderCallback = new RawVideoWriter(fileName);
414411
}

modules/cudacodec/test/test_video.cpp

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -611,9 +611,6 @@ CUDA_TEST_P(CheckInitParams, Reader)
611611

612612
CUDA_TEST_P(Seek, Reader)
613613
{
614-
#if defined(WIN32)
615-
throw SkipTestException("Test disabled on Windows until the FFMpeg wrapper is updated to include PR24012.");
616-
#endif
617614
std::string inputFile = std::string(cvtest::TS::ptr()->get_data_path()) + "../highgui/video/big_buck_bunny.mp4";
618615
// seek to a non key frame
619616
const int firstFrameIdx = 18;
@@ -660,13 +657,7 @@ CUDA_TEST_P(TransCode, H264ToH265)
660657
constexpr cv::cudacodec::ColorFormat colorFormat = cv::cudacodec::ColorFormat::NV_NV12;
661658
constexpr double fps = 25;
662659
const cudacodec::Codec codec = cudacodec::Codec::HEVC;
663-
// required until PR for raw video encapsulation is merged and windows dll is updated
664-
#ifdef WIN32
665-
const std::string ext = ".hevc";
666-
#else
667-
// use this after update
668660
const std::string ext = ".mp4";
669-
#endif
670661
const std::string outputFile = cv::tempfile(ext.c_str());
671662
constexpr int nFrames = 5;
672663
Size frameSz;
@@ -743,13 +734,7 @@ CUDA_TEST_P(Write, Writer)
743734
const cudacodec::Codec codec = GET_PARAM(2);
744735
const double fps = GET_PARAM(3);
745736
const cv::cudacodec::ColorFormat colorFormat = GET_PARAM(4);
746-
// required until PR for raw video encapsulation is merged and windows dll is updated
747-
#ifdef WIN32
748-
const std::string ext = codec == cudacodec::Codec::H264 ? ".h264" : ".hevc";
749-
#else
750-
// use this after update
751737
const std::string ext = ".mp4";
752-
#endif
753738
const std::string outputFile = cv::tempfile(ext.c_str());
754739
constexpr int nFrames = 5;
755740
Size frameSz;
@@ -827,13 +812,7 @@ CUDA_TEST_P(EncoderParams, Writer)
827812
const std::string inputFile = std::string(cvtest::TS::ptr()->get_data_path()) + "../highgui/video/big_buck_bunny.mp4";
828813
constexpr double fps = 25.0;
829814
constexpr cudacodec::Codec codec = cudacodec::Codec::H264;
830-
// required until PR for raw video encapsulation is merged and windows dll is updated
831-
#ifdef WIN32
832-
const std::string ext = ".h264";
833-
#else
834-
// use this after update
835815
const std::string ext = ".mp4";
836-
#endif
837816
const std::string outputFile = cv::tempfile(ext.c_str());
838817
Size frameSz;
839818
const int nFrames = max(params.gopLength, params.idrPeriod) + 1;

modules/cudafeatures2d/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,7 @@ endif()
55
set(the_description "CUDA-accelerated Feature Detection and Description")
66

77
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4127 /wd4100 /wd4324 /wd4512 /wd4515 -Wundef -Wmissing-declarations -Wshadow -Wunused-parameter -Wshadow)
8-
8+
if(ENABLE_CUDA_FIRST_CLASS_LANGUAGE)
9+
ocv_module_include_directories(${CUDAToolkit_INCLUDE_DIRS})
10+
endif()
911
ocv_define_module(cudafeatures2d opencv_features2d opencv_cudafilters opencv_cudawarping WRAP python)

0 commit comments

Comments
 (0)