Merge pull request #1050 from pengx17:2.4_clach_mod

This commit is contained in:
Roman Donchenko 2013-06-27 12:22:00 +04:00 committed by OpenCV Buildbot
commit f477696cc5
4 changed files with 14 additions and 24 deletions

View File

@ -516,22 +516,7 @@ namespace cv
CV_EXPORTS void equalizeHist(const oclMat &mat_src, oclMat &mat_dst);
//! only 8UC1 is supported now
class CV_EXPORTS CLAHE
{
public:
virtual void apply(const oclMat &src, oclMat &dst) = 0;
virtual void setClipLimit(double clipLimit) = 0;
virtual double getClipLimit() const = 0;
virtual void setTilesGridSize(Size tileGridSize) = 0;
virtual Size getTilesGridSize() const = 0;
virtual void collectGarbage() = 0;
virtual ~CLAHE() {}
};
CV_EXPORTS Ptr<cv::ocl::CLAHE> createCLAHE(double clipLimit = 40.0, Size tileGridSize = Size(8, 8));
CV_EXPORTS Ptr<cv::CLAHE> createCLAHE(double clipLimit = 40.0, Size tileGridSize = Size(8, 8));
//! bilateralFilter
// supports 8UC1 8UC4

View File

@ -932,8 +932,8 @@ PERFTEST(CLAHE)
double clipLimit = 40.0;
cv::Ptr<cv::CLAHE> clahe = cv::createCLAHE(clipLimit);
cv::Ptr<cv::ocl::CLAHE> d_clahe = cv::ocl::createCLAHE(clipLimit);
cv::Ptr<cv::CLAHE> clahe = cv::createCLAHE(clipLimit);
cv::Ptr<cv::CLAHE> d_clahe = cv::ocl::createCLAHE(clipLimit);
for (int size = Min_Size; size <= Max_Size; size *= Multiple)
{

View File

@ -1591,14 +1591,14 @@ namespace cv
namespace
{
class CLAHE_Impl : public cv::ocl::CLAHE
class CLAHE_Impl : public cv::CLAHE
{
public:
CLAHE_Impl(double clipLimit = 40.0, int tilesX = 8, int tilesY = 8);
cv::AlgorithmInfo* info() const;
void apply(const oclMat &src, oclMat &dst);
void apply(cv::InputArray src, cv::OutputArray dst);
void setClipLimit(double clipLimit);
double getClipLimit() const;
@ -1616,14 +1616,19 @@ namespace cv
oclMat srcExt_;
oclMat lut_;
};
CLAHE_Impl::CLAHE_Impl(double clipLimit, int tilesX, int tilesY) :
clipLimit_(clipLimit), tilesX_(tilesX), tilesY_(tilesY)
{
}
void CLAHE_Impl::apply(const oclMat &src, oclMat &dst)
CV_INIT_ALGORITHM(CLAHE_Impl, "CLAHE_OCL",
obj.info()->addParam(obj, "clipLimit", obj.clipLimit_);
obj.info()->addParam(obj, "tilesX", obj.tilesX_);
obj.info()->addParam(obj, "tilesY", obj.tilesY_))
void CLAHE_Impl::apply(cv::InputArray src_raw, cv::OutputArray dst_raw)
{
oclMat& src = getOclMatRef(src_raw);
oclMat& dst = getOclMatRef(dst_raw);
CV_Assert( src.type() == CV_8UC1 );
dst.create( src.size(), src.type() );
@ -1691,7 +1696,7 @@ namespace cv
}
}
cv::Ptr<cv::ocl::CLAHE> createCLAHE(double clipLimit, cv::Size tileGridSize)
cv::Ptr<cv::CLAHE> createCLAHE(double clipLimit, cv::Size tileGridSize)
{
return new CLAHE_Impl(clipLimit, tileGridSize.width, tileGridSize.height);
}

View File

@ -1425,7 +1425,7 @@ PARAM_TEST_CASE(CLAHE, cv::Size, ClipLimit)
TEST_P(CLAHE, Accuracy)
{
cv::Ptr<cv::ocl::CLAHE> clahe = cv::ocl::createCLAHE(clipLimit);
cv::Ptr<cv::CLAHE> clahe = cv::ocl::createCLAHE(clipLimit);
clahe->apply(g_src, g_dst);
cv::Mat dst(g_dst);