1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-31 08:13:04 +04:00

Tonemap as 3.0 algorithm

This commit is contained in:
Fedor Morozov
2013-07-31 16:05:31 +04:00
parent 258b98d15b
commit 4d2ea847fa
5 changed files with 474 additions and 744 deletions
+33 -46
View File
@@ -59,6 +59,8 @@ enum
INPAINT_TELEA = 1 // A. Telea algorithm
};
CV_EXPORTS_W bool initModule_photo();
//! restores the damaged image areas using one of the available intpainting algorithms
CV_EXPORTS_W void inpaint( InputArray src, InputArray inpaintMask,
OutputArray dst, double inpaintRadius, int flags );
@@ -80,77 +82,62 @@ CV_EXPORTS_W void fastNlMeansDenoisingColoredMulti( InputArrayOfArrays srcImgs,
float h = 3, float hColor = 3,
int templateWindowSize = 7, int searchWindowSize = 21);
CV_EXPORTS_W void makeHDR(InputArrayOfArrays srcImgs, const std::vector<float>& exp_times, OutputArray dst, Mat response = Mat());
CV_EXPORTS_W void exposureFusion(InputArrayOfArrays srcImgs, OutputArray dst, float wc = 1.0f, float ws = 1.0f, float we = 0.0f);
CV_EXPORTS_W void shiftMat(InputArray src, Point shift, OutputArray dst);
CV_EXPORTS_W Point getExpShift(InputArray img0, InputArray img1, int max_bits = 6, int exclude_range = 4);
CV_EXPORTS_W void estimateResponse(InputArrayOfArrays srcImgs, const std::vector<float>& exp_times, OutputArray dst, int samples = 50, float lambda = 10);
CV_EXPORTS_W void alignImages(InputArrayOfArrays src, std::vector<Mat>& dst);
class CV_EXPORTS_W Tonemap : public Algorithm
{
public:
Tonemap(float gamma);
virtual ~Tonemap();
void process(InputArray src, OutputArray dst);
static Ptr<Tonemap> create(const String& name);
protected:
float gamma;
Mat img;
void linearMap();
void gammaCorrection();
CV_WRAP virtual void process(InputArray src, OutputArray dst) = 0;
virtual void tonemap() = 0;
CV_WRAP virtual float getGamma() const = 0;
CV_WRAP virtual void setGamma(float gamma) = 0;
};
class CV_EXPORTS_W TonemapLinear : public Tonemap
{
public:
TonemapLinear(float gamma = 2.2f);
AlgorithmInfo* info() const;
protected:
void tonemap();
};
CV_EXPORTS_W Ptr<TonemapLinear> createTonemapLinear(float gamma = 1.0f);
class CV_EXPORTS_W TonemapDrago : public Tonemap
{
public:
TonemapDrago(float gamma = 2.2f, float bias = 0.85f);
AlgorithmInfo* info() const;
protected:
float bias;
void tonemap();
CV_WRAP virtual float getBias() const = 0;
CV_WRAP virtual void setBias(float bias) = 0;
};
CV_EXPORTS_W Ptr<TonemapDrago> createTonemapDrago(float gamma = 1.0f, float bias = 0.85f);
class CV_EXPORTS_W TonemapDurand : public Tonemap
{
public:
TonemapDurand(float gamma = 2.2f, float contrast = 4.0f, float sigma_color = 2.0f, float sigma_space = 2.0f);
AlgorithmInfo* info() const;
protected:
float contrast;
float sigma_color;
float sigma_space;
void tonemap();
CV_WRAP virtual float getContrast() const = 0;
CV_WRAP virtual void setContrast(float contrast) = 0;
CV_WRAP virtual float getSigmaSpace() const = 0;
CV_WRAP virtual void setSigmaSpace(float sigma_space) = 0;
CV_WRAP virtual float getSigmaColor() const = 0;
CV_WRAP virtual void setSigmaColor(float sigma_color) = 0;
};
CV_EXPORTS_W Ptr<TonemapDurand>
createTonemapDurand(float gamma = 1.0f, float contrast = 4.0f, float sigma_space = 2.0f, float sigma_color = 2.0f);
class CV_EXPORTS_W TonemapReinhardDevlin : public Tonemap
{
public:
TonemapReinhardDevlin(float gamma = 2.2f, float intensity = 0.0f, float color_adapt = 0.0f, float light_adapt = 1.0f);
AlgorithmInfo* info() const;
protected:
float intensity;
float color_adapt;
float light_adapt;
void tonemap();
CV_WRAP virtual float getIntensity() const = 0;
CV_WRAP virtual void setIntensity(float intensity) = 0;
CV_WRAP virtual float getLightAdaptation() const = 0;
CV_WRAP virtual void setLightAdaptation(float light_adapt) = 0;
CV_WRAP virtual float getColorAdaptation() const = 0;
CV_WRAP virtual void setColorAdaptation(float color_adapt) = 0;
};
CV_EXPORTS_W Ptr<TonemapReinhardDevlin>
createTonemapReinhardDevlin(float gamma = 1.0f, float intensity = 0.0f, float light_adapt = 1.0f, float color_adapt = 0.0f);
} // cv
#endif