diff --git a/modules/cudafilters/include/opencv2/cudafilters.hpp b/modules/cudafilters/include/opencv2/cudafilters.hpp index d92bdde2ca..c7b29f804f 100644 --- a/modules/cudafilters/include/opencv2/cudafilters.hpp +++ b/modules/cudafilters/include/opencv2/cudafilters.hpp @@ -359,13 +359,18 @@ CV_EXPORTS_W Ptr createColumnSumFilter(int srcType, int dstType, int ksi /** @brief Performs median filtering for each point of the source image. -@param srcType type of of source image. Only CV_8UC1 images are supported for now. +@param srcType type of of source image. Only CV_8UC1 if CUDA_VERSION < 11. CV_8UC1, CV_8UC3, CV_8UC4, CV_16UC1, CV_16UC3, CV_16UC4, CV_32FC1, CV_32FC3 or CV_32FC4 if CUDA_VERSION >= 11. @param windowSize Size of the kernerl used for the filtering. Uses a (windowSize x windowSize) filter. -@param partition Specifies the parallel granularity of the workload. This parameter should be used GPU experts when optimizing performance. +@param partition Specifies the parallel granularity of the workload. Only used if CUDA_VERSION < 11. Outputs an image that has been filtered using a median-filtering formulation. -Details on this algorithm can be found in: +If compiled with CUDA 11 or greater, a wavelet based algorithm is used as described at: +https://cgenglab.github.io/en/publication/sigga22_wmatrix_median/ +Yuji Moroto, Nobuyuki Umetani, 2022, "Constant Time Median Filter Using 2D Wavelet Matrix", + ACM Transactions on Graphics, Volume 41, Issue 6. + +For earlier versions of CUDA, details on the algorithm used can be found in: Green, O., 2017. "Efficient scalable median filtering using histogram-based operations", IEEE Transactions on Image Processing, 27(5), pp.2217-2228. diff --git a/modules/cudaimgproc/doc/cudaimgproc.bib b/modules/cudaimgproc/doc/cudaimgproc.bib index cb36ade7f5..809c2c53f6 100644 --- a/modules/cudaimgproc/doc/cudaimgproc.bib +++ b/modules/cudaimgproc/doc/cudaimgproc.bib @@ -8,3 +8,12 @@ @article{Allegretti2019 year={2019}, publisher={IEEE} } + +@article{BT.709, + title={Recommendation ITU-R BT.709-6}, + author={ITU}, + pages={3}, + year={2015}, + publisher={ITU} + url={https://www.itu.int/dms_pubrec/itu-r/rec/bt/R-REC-BT.709-6-201506-I!!PDF-E.pdf} +} diff --git a/modules/cudaimgproc/doc/pics/gammacorrection.png b/modules/cudaimgproc/doc/pics/gammacorrection.png new file mode 100644 index 0000000000..9dbd000961 Binary files /dev/null and b/modules/cudaimgproc/doc/pics/gammacorrection.png differ diff --git a/modules/cudaimgproc/include/opencv2/cudaimgproc.hpp b/modules/cudaimgproc/include/opencv2/cudaimgproc.hpp index 01e7c41ca9..cc39ebcd22 100644 --- a/modules/cudaimgproc/include/opencv2/cudaimgproc.hpp +++ b/modules/cudaimgproc/include/opencv2/cudaimgproc.hpp @@ -154,6 +154,19 @@ CV_EXPORTS void swapChannels(InputOutputArray image, const int dstOrder[4], Stre @param dst Destination image. @param forward true for forward gamma correction or false for inverse gamma correction. @param stream Stream for the asynchronous version. + +Gamma correction is conformant to BT.709 @cite BT.709 with γ=0.45. + +For the forward transform, RGB values are normalised to fit in the range L=[0..1], then: +- For L < 0.018 + + V = 4.5*L +- For L >= 0.018 + + V = 1.099 * L^0.45 - 0.099 + +With V then being scaled back to [0..255]. + +![image](pics/gammacorrection.png) + */ CV_EXPORTS_W void gammaCorrection(InputArray src, OutputArray dst, bool forward = true, Stream& stream = Stream::Null()); diff --git a/modules/cudaimgproc/src/histogram.cpp b/modules/cudaimgproc/src/histogram.cpp index 9652bed00b..87e5f556eb 100644 --- a/modules/cudaimgproc/src/histogram.cpp +++ b/modules/cudaimgproc/src/histogram.cpp @@ -64,6 +64,8 @@ void cv::cuda::histRange(InputArray, GpuMat*, const GpuMat*, Stream&) { throw_no #else /* !defined (HAVE_CUDA) */ +#include + //////////////////////////////////////////////////////////////////////// // calcHist @@ -163,6 +165,16 @@ namespace void collectGarbage(); + void setBitShift(int) override + { + CV_LOG_WARNING(NULL, "CUDA implementation of CLAHE algorithm does not support bit shift option"); + }; + int getBitShift() const override + { + CV_LOG_WARNING(NULL, "CUDA implementation of CLAHE algorithm does not support bit shift option"); + return 0; + } + private: double clipLimit_; int tilesX_; diff --git a/modules/saliency/CMakeLists.txt b/modules/saliency/CMakeLists.txt index f8713dde5f..9f640846ee 100644 --- a/modules/saliency/CMakeLists.txt +++ b/modules/saliency/CMakeLists.txt @@ -4,6 +4,6 @@ endif() set(the_description "Saliency API") -ocv_define_module(saliency opencv_imgproc opencv_features WRAP python) +ocv_define_module(saliency opencv_imgproc opencv_features WRAP python java) ocv_warnings_disable(CMAKE_CXX_FLAGS -Woverloaded-virtual) diff --git a/modules/saliency/include/opencv2/saliency/saliencySpecializedClasses.hpp b/modules/saliency/include/opencv2/saliency/saliencySpecializedClasses.hpp index 580f6f3840..2a80026f1d 100644 --- a/modules/saliency/include/opencv2/saliency/saliencySpecializedClasses.hpp +++ b/modules/saliency/include/opencv2/saliency/saliencySpecializedClasses.hpp @@ -87,7 +87,7 @@ class CV_EXPORTS_W StaticSaliencySpectralResidual : public StaticSaliency } CV_WRAP void read( const FileNode& fn ) CV_OVERRIDE; - void write( FileStorage& fs ) const CV_OVERRIDE; + CV_WRAP void write( FileStorage& fs ) const CV_OVERRIDE; CV_WRAP int getImageWidth() const { @@ -308,9 +308,6 @@ class CV_EXPORTS_W ObjectnessBING : public Objectness return computeSaliencyImpl( image, saliencyMap ); } - CV_WRAP void read(); - CV_WRAP void write() const; - /** @brief Return the list of the rectangles' objectness value, in the same order as the *vector\ objectnessBoundingBox* returned by the algorithm (in diff --git a/modules/saliency/src/BING/objectnessBING.cpp b/modules/saliency/src/BING/objectnessBING.cpp index 9820f02b51..6890ea0fce 100644 --- a/modules/saliency/src/BING/objectnessBING.cpp +++ b/modules/saliency/src/BING/objectnessBING.cpp @@ -448,21 +448,12 @@ bool ObjectnessBING::matRead( const std::string& filename, Mat& _M ) M.copyTo( _M ); return true; } + std::vector ObjectnessBING::getobjectnessValues() { return objectnessValues; } -void ObjectnessBING::read() -{ - -} - -void ObjectnessBING::write() const -{ - -} - bool ObjectnessBING::computeSaliencyImpl( InputArray image, OutputArray objectnessBoundingBox ) { ValStructVec finalBoxes;