Let CLAHE_OCL reuse cv::CLAHE abstract class.

This commit is contained in:
peng xiao 2013-06-26 10:50:51 +08:00
parent 381057eaad
commit cc3fb3d182
2 changed files with 9 additions and 16 deletions

View File

@ -516,20 +516,8 @@ namespace cv
CV_EXPORTS void equalizeHist(const oclMat &mat_src, oclMat &mat_dst); CV_EXPORTS void equalizeHist(const oclMat &mat_src, oclMat &mat_dst);
//! only 8UC1 is supported now //! only 8UC1 is supported now
class CV_EXPORTS CLAHE class CV_EXPORTS CLAHE : public cv::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::ocl::CLAHE> createCLAHE(double clipLimit = 40.0, Size tileGridSize = Size(8, 8));

View File

@ -1598,7 +1598,7 @@ namespace cv
cv::AlgorithmInfo* info() const; cv::AlgorithmInfo* info() const;
void apply(const oclMat &src, oclMat &dst); void apply(cv::InputArray src, cv::OutputArray dst);
void setClipLimit(double clipLimit); void setClipLimit(double clipLimit);
double getClipLimit() const; double getClipLimit() const;
@ -1616,14 +1616,19 @@ namespace cv
oclMat srcExt_; oclMat srcExt_;
oclMat lut_; oclMat lut_;
}; };
CLAHE_Impl::CLAHE_Impl(double clipLimit, int tilesX, int tilesY) : CLAHE_Impl::CLAHE_Impl(double clipLimit, int tilesX, int tilesY) :
clipLimit_(clipLimit), tilesX_(tilesX), tilesY_(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 ); CV_Assert( src.type() == CV_8UC1 );
dst.create( src.size(), src.type() ); dst.create( src.size(), src.type() );