Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions modules/cudafilters/include/opencv2/cudafilters.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -359,13 +359,18 @@ CV_EXPORTS_W Ptr<Filter> 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.

Expand Down
9 changes: 9 additions & 0 deletions modules/cudaimgproc/doc/cudaimgproc.bib
Original file line number Diff line number Diff line change
Expand Up @@ -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}
}
Binary file added modules/cudaimgproc/doc/pics/gammacorrection.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions modules/cudaimgproc/include/opencv2/cudaimgproc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 &gamma;=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());

Expand Down
12 changes: 12 additions & 0 deletions modules/cudaimgproc/src/histogram.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ void cv::cuda::histRange(InputArray, GpuMat*, const GpuMat*, Stream&) { throw_no

#else /* !defined (HAVE_CUDA) */

#include <opencv2/core/utils/logger.hpp>

////////////////////////////////////////////////////////////////////////
// calcHist

Expand Down Expand Up @@ -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_;
Expand Down
2 changes: 1 addition & 1 deletion modules/saliency/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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\<Vec4i\> objectnessBoundingBox* returned by the algorithm (in
Expand Down
11 changes: 1 addition & 10 deletions modules/saliency/src/BING/objectnessBING.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -448,21 +448,12 @@ bool ObjectnessBING::matRead( const std::string& filename, Mat& _M )
M.copyTo( _M );
return true;
}

std::vector<float> ObjectnessBING::getobjectnessValues()
{
return objectnessValues;
}

void ObjectnessBING::read()
{

}

void ObjectnessBING::write() const
{

}

bool ObjectnessBING::computeSaliencyImpl( InputArray image, OutputArray objectnessBoundingBox )
{
ValStructVec<float, Vec4i> finalBoxes;
Expand Down
Loading