diff --git a/rtdata/languages/default b/rtdata/languages/default
index d0c974fe4..eb220fe35 100644
--- a/rtdata/languages/default
+++ b/rtdata/languages/default
@@ -636,21 +636,20 @@ HISTORY_MSG_403;W - ES - Edge sensitivity
HISTORY_MSG_404;W - ES - Base amplification
HISTORY_MSG_405;W - Denoise - Level 4
HISTORY_MSG_406;W - ES - Neighboring pixels
-HISTORY_MSG_407;Dehaze method
-HISTORY_MSG_408;Dehaze neighboring
-HISTORY_MSG_409;Dehaze gain
-HISTORY_MSG_410;Dehaze offset
-HISTORY_MSG_411;Dehaze strength
-HISTORY_MSG_412;Dehaze scales
-HISTORY_MSG_413;Dehaze variance
-HISTORY_MSG_414;Dehaze histogram Lab
-HISTORY_MSG_415;Dehaze transmission
-HISTORY_MSG_416;Dehaze enabled
-HISTORY_MSG_417;Dehaze Retinex complete
-HISTORY_MSG_418;Dehaze transmission median
-HISTORY_MSG_419;Dehaze threshold
-HISTORY_MSG_420;Dehaze Space
-HISTORY_MSG_421;Dehaze Histogram HSL
+HISTORY_MSG_407;Retinex - Method
+HISTORY_MSG_408;Retinex - Neighboring
+HISTORY_MSG_409;Retinex - Gain
+HISTORY_MSG_410;Retinex - Offset
+HISTORY_MSG_411;Retinex - Strength
+HISTORY_MSG_412;Retinex - Scales
+HISTORY_MSG_413;Retinex - Variance
+HISTORY_MSG_414;Retinex - Histogram - Lab
+HISTORY_MSG_415;Retinex - Transmission
+HISTORY_MSG_416;Retinex
+HISTORY_MSG_417;Retinex - Transmission median
+HISTORY_MSG_418;Retinex - Threshold
+HISTORY_MSG_419;Retinex - Color space
+HISTORY_MSG_420;Retinex - Histogram - HSL
HISTORY_NEWSNAPSHOT;Add
HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: Alt-s
HISTORY_SNAPSHOTS;Snapshots
@@ -802,7 +801,7 @@ PARTIALPASTE_DIRPYREQUALIZER;Contrast by detail levels
PARTIALPASTE_DISTORTION;Distortion correction
PARTIALPASTE_EPD;Tone mapping
PARTIALPASTE_EQUALIZER;Wavelet levels
-PARTIALPASTE_DEHAZ;Dehaze
+PARTIALPASTE_RETINEX;Retinex
PARTIALPASTE_EVERYTHING;Everything
PARTIALPASTE_EXIFCHANGES;Exif
PARTIALPASTE_EXPOSURE;Exposure
@@ -1555,46 +1554,39 @@ TP_LABCURVE_LCREDSK;Restrict LC to red and skin-tones
TP_LABCURVE_LCREDSK_TIP;If enabled, the LC Curve affects only red and skin-tones.\nIf disabled, it applies to all tones.
TP_LABCURVE_RSTPROTECTION;Red and skin-tones protection
TP_LABCURVE_RSTPRO_TOOLTIP;Works on the Chromaticity slider and the CC curve.
-TP_DEHAZ_MLABEL;Restored haze-free Min=%1 Max=%2
-TP_DEHAZ_MLABEL_TOOLTIP;Should be near of min=0 max=32768\nRestored image with no mixture
-TP_DEHAZ_TLABEL;TR m=%1 M=%2 Me=%3 Si=%4 Tm=%5 TM=%6
-TP_DEHAZ_TLABEL_TOOLTIP;Transmission map result\nm=Mini M=Maxi used by Variance\nMe=Mean Si=Sigma\nTm=Min TM=Max of Transmission map
-TP_DEHAZ_LABSPACE;L*a*b*
-TP_DEHAZ_HSLSPACE;HSL-Log
-TP_DEHAZ_HSLSPACELIN;HSL-Lin
-TP_DEHAZ_STR;Strength
-TP_DEHAZ_STR_TOOLTIP;Mixture in proportion to the original image and that obtained by Retinex algoritm
-TP_DEHAZ_RETIN;Complete Retinex algoritm
-TP_DEHAZ_LAB;Retinex
-TP_DEHAZ_LAB_TOOLTIP;Use all component of Retinex algorihm, to improve results
-TP_DEHAZ_LABEL;Dehaze
-TP_DEHAZ_SCAL;Scales
-TP_DEHAZ_SCAL_TOOLTIP;Low scales increase contrast but give relief effect\nHigh scales can increase noise, but give more natural images
-TP_DEHAZ_LIMD;Threshold
-TP_DEHAZ_LIMD_TOOLTIP;Limits in/out - in = image source - out = image Gauss
-TP_DEHAZ_MEDI;Transmission median filter
-TP_DEHAZ_NEIGH;Neighboring pixels
-TP_DEHAZ_NEIGH_TOOLTIP;Take into account, neighboring pixels, by Gauss function
-TP_DEHAZ_GAIN;Gain
-TP_DEHAZ_OFFS;Offset
-TP_DEHAZ_GAIN_TOOLTIP;Acts on the transmission in combination with offset, this is very different from others settings\nUsed for black or white pixels, and for better balance the histogram
-TP_DEHAZE_LAB;Dehaze
-TP_DEHAZ_CONTEDIT;Histogram equalizer L*a*b*
-TP_DEHAZ_CONTEDITH;Histogram equalizer HSL
-TP_DEHAZ_COLORSPACE_TOOLTIP;Choice between L*a*b and HSL\nYou may have to adjust the histogram curve, and adjust other settings differently.\n Prefer restaured Haze-free Min#0 Max#32768
-TP_DEHAZ_CURVEEDITOR_CD;L=f(L)
-TP_DEHAZ_CURVEEDITOR_CD_TOOLTIP;Correct Raw data, to reduce halos and artifacts
-TP_DEHAZ_TRANSMISSION;Transmission map
-TP_DEHAZ_TRANS_TOOLTIP;Modify transmission in function of transmission\nAbscissa : transmission from negatives values (min), mean, and positives values (max)\nOrdonate : amplification - reduction
-TP_DEHAZE_LAB_TOOLTIP;Use Retinex algorithm (Lab) to improve dehaze..defog...
-TP_DEHAZ_VART;Variance
-TP_DEHAZ_VART_TOOLTIP;Low variance increase local contrast and saturation, but can leeds to artifacts
-TP_DEHAZE_MET;Dehaze method
-TP_DEHAZ_MET_TOOLTIP;For Retinex algorithm\nLow :reinforce low light\nUniform :expect to equalize action\nHigh : reinforce high light
-TP_DEHAZ_NONE;None
-TP_DEHAZ_UNI;Uniform
-TP_DEHAZ_LOW;Low
-TP_DEHAZ_HIGH;High
+TP_RETINEX_CONTEDIT_HSL;Histogram equalizer HSL
+TP_RETINEX_CONTEDIT_LAB;Histogram equalizer L*a*b*
+TP_RETINEX_CURVEEDITOR_CD;L=f(L)
+TP_RETINEX_CURVEEDITOR_CD_TOOLTIP;Correct raw data to reduce halos and artifacts
+TP_RETINEX_GAIN;Gain
+TP_RETINEX_GAIN_TOOLTIP;Acts on the transmission in combination with offset, this is very different from others settings. Used for black or white pixels, and for better balance the histogram.
+TP_RETINEX_HIGH;High
+TP_RETINEX_HSLSPACE_LIN;HSL-Linear
+TP_RETINEX_HSLSPACE_LOG;HSL-Logarithmic
+TP_RETINEX_LABEL;Retinex
+TP_RETINEX_LABSPACE;L*a*b*
+TP_RETINEX_LOW;Low
+TP_RETINEX_MEDIAN;Transmission median filter
+TP_RETINEX_METHOD;Method
+TP_RETINEX_METHOD_TOOLTIP;Low: Reinforce low light,\nUniform: Equalize action,\nHigh: Reinforce high light.
+TP_RETINEX_MLABEL;Restored haze-free Min=%1 Max=%2
+TP_RETINEX_MLABEL_TOOLTIP;Should be near min=0 max=32768\nRestored image with no mixture.
+TP_RETINEX_NEIGHBOR;Neighboring pixels
+TP_RETINEX_NONE;None
+TP_RETINEX_OFFSET;Offset
+TP_RETINEX_SCALES;Scales
+TP_RETINEX_SCALES_TOOLTIP;Low scales increase contrast but give relief effect.\nHigh scales can increase noise, but give more natural images.
+TP_RETINEX_SETTINGS;Settings
+TP_RETINEX_STRENGTH;Strength
+TP_RETINEX_THRESHOLD;Threshold
+TP_RETINEX_THRESHOLD_TOOLTIP;Limits in/out - in = image source - out = image Gauss
+TP_RETINEX_TLABEL;TR m=%1 M=%2 Me=%3 Si=%4 Tm=%5 TM=%6
+TP_RETINEX_TLABEL_TOOLTIP;Transmission map result.\nm=Mini M=Maxi used by Variance.\nMe=Mean Si=Sigma\nTm=Min TM=Max of transmission map.
+TP_RETINEX_TRANSMISSION;Transmission map
+TP_RETINEX_TRANSMISSION_TOOLTIP;Modify transmission in function of transmission\nAbscissa : transmission from negatives values (min), mean, and positives values (max)\nOrdonate : amplification - reduction
+TP_RETINEX_UNIFORM;Uniform
+TP_RETINEX_VARIANCE;Variance
+TP_RETINEX_VARIANCE_TOOLTIP;Low variance increase local contrast and saturation, but can lead to artifacts.
TP_LENSGEOM_AUTOCROP;Auto-Crop
TP_LENSGEOM_FILL;Auto-fill
TP_LENSGEOM_LABEL;Lens / Geometry
diff --git a/rtengine/CMakeLists.txt b/rtengine/CMakeLists.txt
index 05c73abd5..231875f95 100644
--- a/rtengine/CMakeLists.txt
+++ b/rtengine/CMakeLists.txt
@@ -18,7 +18,7 @@ set (RTENGINESOURCEFILES safegtk.cc colortemp.cc curves.cc flatcurves.cc diagona
EdgePreservingDecomposition.cc cplx_wavelet_dec.cc FTblockDN.cc
PF_correct_RT.cc previewimage.cc ipwavelet.cc
dirpyr_equalizer.cc
- calc_distort.cc lcp.cc dcp.cc ipdehaz.cc
+ calc_distort.cc lcp.cc dcp.cc ipretinex.cc
cJSON.c camconst.cc
klt/convolve.cc klt/error.cc klt/klt.cc klt/klt_util.cc klt/pnmio.cc klt/pyramid.cc klt/selectGoodFeatures.cc
klt/storeFeatures.cc klt/trackFeatures.cc klt/writeFeatures.cc
diff --git a/rtengine/curves.cc b/rtengine/curves.cc
index 36e777991..d05a9dd12 100644
--- a/rtengine/curves.cc
+++ b/rtengine/curves.cc
@@ -1366,14 +1366,14 @@ void ColorAppearance::Set(Curve *pCurve)
}
//
-DehaztransmissionCurve::DehaztransmissionCurve() {};
+RetinextransmissionCurve::RetinextransmissionCurve() {};
-void DehaztransmissionCurve::Reset()
+void RetinextransmissionCurve::Reset()
{
luttransmission.reset();
}
-void DehaztransmissionCurve::Set(const Curve &pCurve)
+void RetinextransmissionCurve::Set(const Curve &pCurve)
{
if (pCurve.isIdentity()) {
luttransmission.reset(); // raise this value if the quality suffers from this number of samples
@@ -1387,7 +1387,7 @@ void DehaztransmissionCurve::Set(const Curve &pCurve)
}
}
-void DehaztransmissionCurve::Set(const std::vector &curvePoints)
+void RetinextransmissionCurve::Set(const std::vector &curvePoints)
{
if (!curvePoints.empty() && curvePoints[0] > FCT_Linear && curvePoints[0] < FCT_Unchanged) {
FlatCurve tcurve(curvePoints, false, CURVES_MIN_POLY_POINTS / 2);
diff --git a/rtengine/curves.h b/rtengine/curves.h
index 173975838..b85088143 100644
--- a/rtengine/curves.h
+++ b/rtengine/curves.h
@@ -430,15 +430,15 @@ public:
};
};
-class DehaztransmissionCurve
+class RetinextransmissionCurve
{
private:
LUTf luttransmission; // 0xffff range
void Set(const Curve &pCurve);
public:
- virtual ~DehaztransmissionCurve() {};
- DehaztransmissionCurve();
+ virtual ~RetinextransmissionCurve() {};
+ RetinextransmissionCurve();
void Reset();
void Set(const Curve *pCurve);
diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc
index 523171ba2..a97ae7f39 100644
--- a/rtengine/dcrop.cc
+++ b/rtengine/dcrop.cc
@@ -807,7 +807,7 @@ void Crop::update (int todo)
bool wavcontlutili = parent->wavcontlutili;
LUTu dummy;
- int modedehaz;
+ int moderetinex;
// parent->ipf.MSR(labnCrop, labnCrop->W, labnCrop->H, 1);
parent->ipf.chromiLuminanceCurve (this, 1, labnCrop, labnCrop, parent->chroma_acurve, parent->chroma_bcurve, parent->satcurve, parent->lhskcurve, parent->clcurve, parent->lumacurve, utili, autili, butili, ccutili, cclutili, clcutili, dummy, dummy, dummy, dummy);
parent->ipf.vibrance (labnCrop);
diff --git a/rtengine/imagesource.h b/rtengine/imagesource.h
index 3aa230bb0..98730ac1b 100644
--- a/rtengine/imagesource.h
+++ b/rtengine/imagesource.h
@@ -69,14 +69,14 @@ public:
virtual int load (Glib::ustring fname, bool batch = false) = 0;
virtual void preprocess (const RAWParams &raw, const LensProfParams &lensProf, const CoarseTransformParams& coarse) {};
virtual void demosaic (const RAWParams &raw) {};
-// virtual void // dehaz (RAWParams raw, ColorManagementParams cmp, DehazParams lcur, LUTf & cdcurve, bool dehacontlutili) {};
- virtual void dehaz (RAWParams raw, ColorManagementParams cmp, DehazParams deh, LUTf & cdcurve, LUTf & cdHcurve, const DehaztransmissionCurve & dehatransmissionCurve, bool dehacontlutili, bool dehaHcontlutili, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax) {};
+// virtual void // retinex (RAWParams raw, ColorManagementParams cmp, RetinexParams lcur, LUTf & cdcurve, bool dehacontlutili) {};
+ virtual void retinex (RAWParams raw, ColorManagementParams cmp, RetinexParams deh, LUTf & cdcurve, LUTf & cdHcurve, const RetinextransmissionCurve & dehatransmissionCurve, bool dehacontlutili, bool dehaHcontlutili, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax) {};
virtual void flushRawData () {};
virtual void flushRGB () {};
virtual void HLRecovery_Global (ToneCurveParams hrp) {};
virtual void HLRecovery_inpaint (float** red, float** green, float** blue) {};
-// virtual void MSR(LabImage* lab, int width, int height, int skip, DehazParams lcur) {};
- virtual void MSR(LabImage* lab, int width, int height, int skip, DehazParams deh, const DehaztransmissionCurve & dehatransmissionCurve, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax) {};
+// virtual void MSR(LabImage* lab, int width, int height, int skip, RetinexParams lcur) {};
+ virtual void MSR(LabImage* lab, int width, int height, int skip, RetinexParams deh, const RetinextransmissionCurve & dehatransmissionCurve, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax) {};
virtual bool IsrgbSourceModified() = 0; // tracks whether cached rgb output of demosaic has been modified
// virtual void MSR(LabImage* lab, int width, int height, int skip, const LCurveParams &lcur);
diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc
index f53239ca6..6a0933d14 100644
--- a/rtengine/improccoordinator.cc
+++ b/rtengine/improccoordinator.cc
@@ -236,15 +236,15 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall)
highDetailRawComputed = false;
}
- if (params.dehaz.enabled) {
+ if (params.retinex.enabled) {
bool dehacontlutili = false;
bool dehaHcontlutili = false;
- CurveFactory::curveDehaContL (dehacontlutili, params.dehaz.cdcurve, cdcurve, 1);
- CurveFactory::curveDehaHContL (dehaHcontlutili, params.dehaz.cdHcurve, cdHcurve, 1);
- DehazParams DehaParams = params.dehaz;
+ CurveFactory::curveDehaContL (dehacontlutili, params.retinex.cdcurve, cdcurve, 1);
+ CurveFactory::curveDehaHContL (dehaHcontlutili, params.retinex.cdHcurve, cdHcurve, 1);
+ RetinexParams DehaParams = params.retinex;
DehaParams.getCurves(dehatransmissionCurve);
float minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax;
- imgsrc->dehaz( params.raw, params.icm, params.dehaz, cdcurve, cdHcurve, dehatransmissionCurve, dehacontlutili, dehaHcontlutili, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax);//enabled Dehaze
+ imgsrc->retinex( params.raw, params.icm, params.retinex, cdcurve, cdHcurve, dehatransmissionCurve, dehacontlutili, dehaHcontlutili, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax);//enabled Retinex
if(dehaListener) {
dehaListener->minmaxChanged(maxCD, minCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax);
diff --git a/rtengine/improccoordinator.h b/rtengine/improccoordinator.h
index 452df747a..4ba9bc7c9 100644
--- a/rtengine/improccoordinator.h
+++ b/rtengine/improccoordinator.h
@@ -130,7 +130,7 @@ protected:
WavOpacityCurveBY waOpacityCurveBY;
WavOpacityCurveW waOpacityCurveW;
WavOpacityCurveWL waOpacityCurveWL;
- DehaztransmissionCurve dehatransmissionCurve;
+ RetinextransmissionCurve dehatransmissionCurve;
ColorAppearance customColCurve1;
ColorAppearance customColCurve2;
@@ -155,7 +155,7 @@ protected:
AutoColorTonListener* actListener;
AutoChromaListener* adnListener;
WaveletListener* awavListener;
- DehazListener* dehaListener;
+ RetinexListener* dehaListener;
HistogramListener* hListener;
std::vector sizeListeners;
@@ -301,7 +301,7 @@ public:
{
adnListener = adn;
}
- void setDehazListener (DehazListener* adh)
+ void setRetinexListener (RetinexListener* adh)
{
dehaListener = adh;
}
diff --git a/rtengine/ipdehaz.cc b/rtengine/ipretinex.cc
similarity index 93%
rename from rtengine/ipdehaz.cc
rename to rtengine/ipretinex.cc
index 5c0365252..5a3b87213 100644
--- a/rtengine/ipdehaz.cc
+++ b/rtengine/ipretinex.cc
@@ -45,8 +45,8 @@
#include "improcfun.h"
#include "opthelper.h"
#include "StopWatch.h"
-#define MAX_DEHAZE_SCALES 8
-#define clipdehaz( val, minv, maxv ) (( val = (val < minv ? minv : val ) ) > maxv ? maxv : val )
+#define MAX_RETINEX_SCALES 8
+#define clipretinex( val, minv, maxv ) (( val = (val < minv ? minv : val ) ) > maxv ? maxv : val )
#define med3(a0,a1,a2,a3,a4,a5,a6,a7,a8,median) { \
pp[0]=a0; pp[1]=a1; pp[2]=a2; pp[3]=a3; pp[4]=a4; pp[5]=a5; pp[6]=a6; pp[7]=a7; pp[8]=a8; \
@@ -63,9 +63,9 @@ namespace rtengine
extern const Settings* settings;
-static float DehazeScales[MAX_DEHAZE_SCALES];
+static float RetinexScales[MAX_RETINEX_SCALES];
-void dehaze_scales( float* scales, int nscales, int mode, int s)
+void retinex_scales( float* scales, int nscales, int mode, int s)
{
if ( nscales == 1 ) {
scales[0] = (float)s / 2.f;
@@ -198,7 +198,7 @@ void mean_stddv( float **dst, float &mean, float &stddv, int W_L, int H_L, const
stddv = (float)sqrt(stddv);
}
-void RawImageSource::MSR(float** luminance, float** originalLuminance, int width, int height, DehazParams deh, const DehaztransmissionCurve & dehatransmissionCurve, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax)
+void RawImageSource::MSR(float** luminance, float** originalLuminance, int width, int height, RetinexParams deh, const RetinextransmissionCurve & dehatransmissionCurve, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax)
{
if (deh.enabled) {//enabled
StopWatch Stop1("MSR");
@@ -206,8 +206,8 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, int width
// float mini, delta, maxi;
float delta;
float eps = 2.f;
- bool useHsl = deh.dehazcolorspace == "HSL";
- bool useHslLin = deh.dehazcolorspace == "HSLLIN";
+ bool useHsl = deh.retinexcolorspace == "HSLLOG";
+ bool useHslLin = deh.retinexcolorspace == "HSLLIN";
float gain2 = (float) deh.gain / 100.f; //def =1 not use
gain2 = useHslLin ? gain2 * 0.5f : gain2;
float offse = (float) deh.offs; //def = 0 not use
@@ -219,18 +219,18 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, int width
limD = pow(limD, 1.7f);//about 2500 enough
limD *= useHslLin ? 10.f : 1.f;
float ilimD = 1.f / limD;
- int modedehaz = 0; // default to 0 ( deh.dehazmet == "uni" )
+ int moderetinex = 2; // default to 2 ( deh.retinexMethod == "high" )
bool execcur = false;
- if (deh.dehazmet == "low") {
- modedehaz = 1;
+ if (deh.retinexMethod == "uni") {
+ moderetinex = 0;
}
- if (deh.dehazmet == "high") {
- modedehaz = 2;
+ if (deh.retinexMethod == "low") {
+ moderetinex = 1;
}
- dehaze_scales( DehazeScales, scal, modedehaz, nei );
+ retinex_scales( RetinexScales, scal, moderetinex, nei );
int H_L = height;
int W_L = width;
@@ -268,8 +268,8 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, int width
AlignedBufferMP* pBuffer = new AlignedBufferMP (max(W_L, H_L));
for ( int scale = 0; scale < scal; scale++ ) {
- gaussHorizontal (src, out, *pBuffer, W_L, H_L, DehazeScales[scale]);
- gaussVertical (out, out, *pBuffer, W_L, H_L, DehazeScales[scale]);
+ gaussHorizontal (src, out, *pBuffer, W_L, H_L, RetinexScales[scale]);
+ gaussVertical (out, out, *pBuffer, W_L, H_L, RetinexScales[scale]);
#ifdef __SSE2__
vfloat pondv = F2V(pond);
@@ -477,7 +477,7 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, int width
}
- luminance[i][j] = clipdehaz( cd, 0.f, 32768.f ) * strength + (1.f - strength) * originalLuminance[i][j];
+ luminance[i][j] = clipretinex( cd, 0.f, 32768.f ) * strength + (1.f - strength) * originalLuminance[i][j];
}
#ifdef _OPENMP
diff --git a/rtengine/procevents.h b/rtengine/procevents.h
index 9c4552697..c71e8d9f1 100644
--- a/rtengine/procevents.h
+++ b/rtengine/procevents.h
@@ -432,7 +432,7 @@ enum ProcEvent {
EvWavedgeampli = 403,
EvWavlev3nois = 404,
EvWavNPmet = 405,
- Evdehazmet = 406,
+ EvretinexMethod = 406,
EvLneigh = 407,
EvLgain = 408,
EvLoffs = 409,
@@ -440,13 +440,12 @@ enum ProcEvent {
EvLscal = 411,
EvLvart = 412,
EvLCDCurve = 413,
- EvDehaztransmission = 414,
- EvDehazEnabled = 415,
- EvDehazretinex = 416,
- EvDehazmedianmap = 417,
- EvLlimd = 418,
- EvdehazColorSpace = 419,
- EvLCDHCurve = 420,
+ EvRetinextransmission = 414,
+ EvRetinexEnabled = 415,
+ EvRetinexmedianmap = 416,
+ EvLlimd = 417,
+ EvretinexColorSpace = 406, //change to 418 if we want a separate history entry "Retinex - Color space"
+ EvLCDHCurve = 419,
NUMOFEVENTS
};
}
diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc
index a078ba31f..0c9aef7d2 100644
--- a/rtengine/procparams.cc
+++ b/rtengine/procparams.cc
@@ -116,12 +116,12 @@ void CropParams::mapToResized(int resizedWidth, int resizedHeight, int scale, in
}
}
-DehazParams::DehazParams ()
+RetinexParams::RetinexParams ()
{
setDefaults ();
}
-void DehazParams::getDefaulttransmissionCurve(std::vector &curve)
+void RetinexParams::getDefaulttransmissionCurve(std::vector &curve)
{
/* double v[8] = { 0.0, 0.50, 0.35, 0.35,
1.0, 0.50, 0.35, 0.35,
@@ -141,17 +141,16 @@ void DehazParams::getDefaulttransmissionCurve(std::vector &curve)
}
}
-void DehazParams::getDefaultCDCurve(std::vector &curve)
+void RetinexParams::getDefaultCDCurve(std::vector &curve)
{
- double v[12] = { 0.00, 0.00,
- 0.185, 0.,
- 0.235, 0.25,
+ double v[10] = { 0., 0.,
+ 0.25, 0.25,
0.5, 0.5,
- 0.8, 0.8,
- 1.0, 1.0,
+ 0.75, 0.75,
+ 1., 1.,
};
- curve.resize(13);
+ curve.resize(11);
curve.at(0) = double(DCT_NURBS);
for (size_t i = 1; i < curve.size(); ++i) {
@@ -159,7 +158,7 @@ void DehazParams::getDefaultCDCurve(std::vector &curve)
}
}
-void DehazParams::getDefaultCDHCurve(std::vector &curve)
+void RetinexParams::getDefaultCDHCurve(std::vector &curve)
{
double v[6] = { 0.00, 0.00,
0.5, 0.5,
@@ -176,27 +175,26 @@ void DehazParams::getDefaultCDHCurve(std::vector &curve)
-void DehazParams::setDefaults()
+void RetinexParams::setDefaults()
{
enabled = false;
- str = 30;
+ str = 20;
scal = 3;
neigh = 80;
- gain = 100;
+ gain = 50;
offs = 0;
vart = 125;
limd = 8;
getDefaulttransmissionCurve(transmissionCurve);
getDefaultCDCurve(cdcurve);
getDefaultCDHCurve(cdHcurve);
- dehazmet = "uni";
- dehazcolorspace = "Lab";
- retinex = false;
+ retinexMethod = "high";
+ retinexcolorspace = "Lab";
medianmap = true;
}
-void DehazParams::getCurves(DehaztransmissionCurve &transmissionCurveLUT) const
+void RetinexParams::getCurves(RetinextransmissionCurve &transmissionCurveLUT) const
{
transmissionCurveLUT.Set(this->transmissionCurve);
}
@@ -1464,71 +1462,67 @@ int ProcParams::save (Glib::ustring fname, Glib::ustring fname2, bool fnameAbsol
keyFile.set_double_list("Exposure", "Curve2", tcurve);
}
- //save dehaz
+ //save retinex
- if (!pedited || pedited->dehaz.str) {
- keyFile.set_integer ("Dehaz", "Str", dehaz.str);
+ if (!pedited || pedited->retinex.str) {
+ keyFile.set_integer ("Retinex", "Str", retinex.str);
}
- if (!pedited || pedited->dehaz.scal) {
- keyFile.set_integer ("Dehaz", "Scal", dehaz.scal);
+ if (!pedited || pedited->retinex.scal) {
+ keyFile.set_integer ("Retinex", "Scal", retinex.scal);
}
- if (!pedited || pedited->dehaz.enabled) {
- keyFile.set_boolean ("Dehaz", "Enabled", dehaz.enabled);
+ if (!pedited || pedited->retinex.enabled) {
+ keyFile.set_boolean ("Retinex", "Enabled", retinex.enabled);
}
- if (!pedited || pedited->dehaz.retinex) {
- keyFile.set_boolean ("Dehaz", "Retinex", dehaz.retinex);
- }
-
- if (!pedited || pedited->dehaz.medianmap) {
- keyFile.set_boolean ("Dehaz", "Median", dehaz.medianmap);
+ if (!pedited || pedited->retinex.medianmap) {
+ keyFile.set_boolean ("Retinex", "Median", retinex.medianmap);
}
- if (!pedited || pedited->dehaz.neigh) {
- keyFile.set_integer ("Dehaz", "Neigh", dehaz.neigh);
+ if (!pedited || pedited->retinex.neigh) {
+ keyFile.set_integer ("Retinex", "Neigh", retinex.neigh);
}
- if (!pedited || pedited->dehaz.gain) {
- keyFile.set_integer ("Dehaz", "Gain", dehaz.gain);
+ if (!pedited || pedited->retinex.gain) {
+ keyFile.set_integer ("Retinex", "Gain", retinex.gain);
}
- if (!pedited || pedited->dehaz.offs) {
- keyFile.set_integer ("Dehaz", "Offs", dehaz.offs);
+ if (!pedited || pedited->retinex.offs) {
+ keyFile.set_integer ("Retinex", "Offs", retinex.offs);
}
- if (!pedited || pedited->dehaz.vart) {
- keyFile.set_integer ("Dehaz", "Vart", dehaz.vart);
+ if (!pedited || pedited->retinex.vart) {
+ keyFile.set_integer ("Retinex", "Vart", retinex.vart);
}
- if (!pedited || pedited->dehaz.limd) {
- keyFile.set_integer ("Dehaz", "Limd", dehaz.limd);
+ if (!pedited || pedited->retinex.limd) {
+ keyFile.set_integer ("Retinex", "Limd", retinex.limd);
}
- if (!pedited || pedited->dehaz.dehazmet) {
- keyFile.set_string ("Dehaz", "Dehazmet", dehaz.dehazmet);
+ if (!pedited || pedited->retinex.retinexMethod) {
+ keyFile.set_string ("Retinex", "RetinexMethod", retinex.retinexMethod);
}
- if (!pedited || pedited->dehaz.dehazcolorspace) {
- keyFile.set_string ("Dehaz", "Dehazcolorspace", dehaz.dehazcolorspace);
+ if (!pedited || pedited->retinex.retinexcolorspace) {
+ keyFile.set_string ("Retinex", "Retinexcolorspace", retinex.retinexcolorspace);
}
- if (!pedited || pedited->dehaz.cdcurve) {
- Glib::ArrayHandle cdcurve = dehaz.cdcurve;
- keyFile.set_double_list("Dehaz", "CDCurve", cdcurve);
- }
-
- if (!pedited || pedited->dehaz.cdHcurve) {
- Glib::ArrayHandle cdHcurve = dehaz.cdHcurve;
- keyFile.set_double_list("Dehaz", "CDHCurve", cdHcurve);
+ if (!pedited || pedited->retinex.cdcurve) {
+ Glib::ArrayHandle cdcurve = retinex.cdcurve;
+ keyFile.set_double_list("Retinex", "CDCurve", cdcurve);
}
- if (!pedited || pedited->dehaz.transmissionCurve) {
- Glib::ArrayHandle transmissionCurve = dehaz.transmissionCurve;
- keyFile.set_double_list("Dehaz", "TransmissionCurve", transmissionCurve);
+ if (!pedited || pedited->retinex.cdHcurve) {
+ Glib::ArrayHandle cdHcurve = retinex.cdHcurve;
+ keyFile.set_double_list("Retinex", "CDHCurve", cdHcurve);
+ }
+
+ if (!pedited || pedited->retinex.transmissionCurve) {
+ Glib::ArrayHandle transmissionCurve = retinex.transmissionCurve;
+ keyFile.set_double_list("Retinex", "TransmissionCurve", transmissionCurve);
}
// save channel mixer
@@ -3789,126 +3783,118 @@ int ProcParams::load (Glib::ustring fname, ParamsEdited* pedited)
}
}
- //load dehaz
- if (keyFile.has_group ("Dehaz")) {
+ //load retinex
+ if (keyFile.has_group ("Retinex")) {
- if (keyFile.has_key ("Dehaz", "Retinex")) {
- dehaz.retinex = keyFile.get_boolean ("Dehaz", "Retinex");
+ if (keyFile.has_key ("Retinex", "Median")) {
+ retinex.medianmap = keyFile.get_boolean ("Retinex", "Median");
if (pedited) {
- pedited->dehaz.retinex = true;
+ pedited->retinex.medianmap = true;
}
}
- if (keyFile.has_key ("Dehaz", "Median")) {
- dehaz.medianmap = keyFile.get_boolean ("Dehaz", "Median");
+ if (keyFile.has_key ("Retinex", "Retinexmet")) {
+ retinex.retinexMethod = keyFile.get_string ("Retinex", "Retinexmet");
if (pedited) {
- pedited->dehaz.medianmap = true;
+ pedited->retinex.retinexMethod = true;
}
}
- if (keyFile.has_key ("Dehaz", "Dehazmet")) {
- dehaz.dehazmet = keyFile.get_string ("Dehaz", "Dehazmet");
+ if (keyFile.has_key ("Retinex", "Retinexcolorspace")) {
+ retinex.retinexcolorspace = keyFile.get_string ("Retinex", "Retinexcolorspace");
if (pedited) {
- pedited->dehaz.dehazmet = true;
+ pedited->retinex.retinexcolorspace = true;
}
}
- if (keyFile.has_key ("Dehaz", "Dehazcolorspace")) {
- dehaz.dehazcolorspace = keyFile.get_string ("Dehaz", "Dehazcolorspace");
+ if (keyFile.has_key ("Retinex", "Enabled")) {
+ retinex.enabled = keyFile.get_boolean ("Retinex", "Enabled");
if (pedited) {
- pedited->dehaz.dehazcolorspace = true;
+ pedited->retinex.enabled = true;
}
}
- if (keyFile.has_key ("Dehaz", "Enabled")) {
- dehaz.enabled = keyFile.get_boolean ("Dehaz", "Enabled");
+ if (keyFile.has_key ("Retinex", "Neigh")) {
+ retinex.neigh = keyFile.get_integer ("Retinex", "Neigh");
if (pedited) {
- pedited->dehaz.enabled = true;
+ pedited->retinex.neigh = true;
}
}
- if (keyFile.has_key ("Dehaz", "Neigh")) {
- dehaz.neigh = keyFile.get_integer ("Dehaz", "Neigh");
+ if (keyFile.has_key ("Retinex", "Str")) {
+ retinex.str = keyFile.get_integer ("Retinex", "Str");
if (pedited) {
- pedited->dehaz.neigh = true;
+ pedited->retinex.str = true;
}
}
- if (keyFile.has_key ("Dehaz", "Str")) {
- dehaz.str = keyFile.get_integer ("Dehaz", "Str");
+ if (keyFile.has_key ("Retinex", "Scal")) {
+ retinex.scal = keyFile.get_integer ("Retinex", "Scal");
if (pedited) {
- pedited->dehaz.str = true;
+ pedited->retinex.scal = true;
}
}
- if (keyFile.has_key ("Dehaz", "Scal")) {
- dehaz.scal = keyFile.get_integer ("Dehaz", "Scal");
+ if (keyFile.has_key ("Retinex", "Gain")) {
+ retinex.gain = keyFile.get_integer ("Retinex", "Gain");
if (pedited) {
- pedited->dehaz.scal = true;
+ pedited->retinex.gain = true;
}
}
- if (keyFile.has_key ("Dehaz", "Gain")) {
- dehaz.gain = keyFile.get_integer ("Dehaz", "Gain");
+ if (keyFile.has_key ("Retinex", "Offs")) {
+ retinex.offs = keyFile.get_integer ("Retinex", "Offs");
if (pedited) {
- pedited->dehaz.gain = true;
+ pedited->retinex.offs = true;
}
}
- if (keyFile.has_key ("Dehaz", "Offs")) {
- dehaz.offs = keyFile.get_integer ("Dehaz", "Offs");
+ if (keyFile.has_key ("Retinex", "Vart")) {
+ retinex.vart = keyFile.get_integer ("Retinex", "Vart");
if (pedited) {
- pedited->dehaz.offs = true;
+ pedited->retinex.vart = true;
}
}
- if (keyFile.has_key ("Dehaz", "Vart")) {
- dehaz.vart = keyFile.get_integer ("Dehaz", "Vart");
+ if (keyFile.has_key ("Retinex", "Limd")) {
+ retinex.limd = keyFile.get_integer ("Retinex", "Limd");
if (pedited) {
- pedited->dehaz.vart = true;
+ pedited->retinex.limd = true;
}
}
- if (keyFile.has_key ("Dehaz", "Limd")) {
- dehaz.limd = keyFile.get_integer ("Dehaz", "Limd");
+ if (keyFile.has_key ("Retinex", "CDCurve")) {
+ retinex.cdcurve = keyFile.get_double_list ("Retinex", "CDCurve");
if (pedited) {
- pedited->dehaz.limd = true;
+ pedited->retinex.cdcurve = true;
}
}
- if (keyFile.has_key ("Dehaz", "CDCurve")) {
- dehaz.cdcurve = keyFile.get_double_list ("Dehaz", "CDCurve");
+ if (keyFile.has_key ("Retinex", "CDHCurve")) {
+ retinex.cdHcurve = keyFile.get_double_list ("Retinex", "CDHCurve");
if (pedited) {
- pedited->dehaz.cdcurve = true;
- }
- }
-
- if (keyFile.has_key ("Dehaz", "CDHCurve")) {
- dehaz.cdHcurve = keyFile.get_double_list ("Dehaz", "CDHCurve");
-
- if (pedited) {
- pedited->dehaz.cdHcurve = true;
+ pedited->retinex.cdHcurve = true;
}
}
- if (keyFile.has_key ("Dehaz", "TransmissionCurve")) {
- dehaz.transmissionCurve = keyFile.get_double_list ("Dehaz", "TransmissionCurve");
+ if (keyFile.has_key ("Retinex", "TransmissionCurve")) {
+ retinex.transmissionCurve = keyFile.get_double_list ("Retinex", "TransmissionCurve");
if (pedited) {
- pedited->dehaz.transmissionCurve = true;
+ pedited->retinex.transmissionCurve = true;
}
}
}
@@ -7273,21 +7259,20 @@ bool ProcParams::operator== (const ProcParams& other)
&& toneCurve.curveMode2 == other.toneCurve.curveMode2
&& toneCurve.hrenabled == other.toneCurve.hrenabled
&& toneCurve.method == other.toneCurve.method
- && dehaz.cdcurve == other.dehaz.cdcurve
- && dehaz.cdHcurve == other.dehaz.cdHcurve
- && dehaz.transmissionCurve == other.dehaz.transmissionCurve
- && dehaz.str == other.dehaz.str
- && dehaz.scal == other.dehaz.scal
- && dehaz.neigh == other.dehaz.neigh
- && dehaz.gain == other.dehaz.gain
- && dehaz.limd == other.dehaz.limd
- && dehaz.offs == other.dehaz.offs
- && dehaz.dehazmet == other.dehaz.dehazmet
- && dehaz.dehazcolorspace == other.dehaz.dehazcolorspace
- && dehaz.vart == other.dehaz.vart
- && dehaz.medianmap == other.dehaz.medianmap
- && dehaz.enabled == other.dehaz.enabled
- && dehaz.retinex == other.dehaz.retinex
+ && retinex.cdcurve == other.retinex.cdcurve
+ && retinex.cdHcurve == other.retinex.cdHcurve
+ && retinex.transmissionCurve == other.retinex.transmissionCurve
+ && retinex.str == other.retinex.str
+ && retinex.scal == other.retinex.scal
+ && retinex.neigh == other.retinex.neigh
+ && retinex.gain == other.retinex.gain
+ && retinex.limd == other.retinex.limd
+ && retinex.offs == other.retinex.offs
+ && retinex.retinexMethod == other.retinex.retinexMethod
+ && retinex.retinexcolorspace == other.retinex.retinexcolorspace
+ && retinex.vart == other.retinex.vart
+ && retinex.medianmap == other.retinex.medianmap
+ && retinex.enabled == other.retinex.enabled
&& labCurve.lcurve == other.labCurve.lcurve
&& labCurve.acurve == other.labCurve.acurve
&& labCurve.bcurve == other.labCurve.bcurve
diff --git a/rtengine/procparams.h b/rtengine/procparams.h
index c549aaa19..91dfbf7bc 100644
--- a/rtengine/procparams.h
+++ b/rtengine/procparams.h
@@ -39,7 +39,7 @@ class WavOpacityCurveRG;
class WavOpacityCurveBY;
class WavOpacityCurveW;
class WavOpacityCurveWL;
-class DehaztransmissionCurve;
+class RetinextransmissionCurve;
namespace procparams
{
@@ -262,9 +262,9 @@ public:
static bool HLReconstructionNecessary(LUTu &histRedRaw, LUTu &histGreenRaw, LUTu &histBlueRaw);
};
/**
- * Parameters of Dehaz
+ * Parameters of Retinex
*/
-class DehazParams
+class RetinexParams
{
public:
@@ -277,15 +277,14 @@ public:
int neigh;
int gain;
int offs;
- Glib::ustring dehazmet;
- Glib::ustring dehazcolorspace;
+ Glib::ustring retinexMethod;
+ Glib::ustring retinexcolorspace;
int vart;
int limd;
bool medianmap;
- bool retinex;
- DehazParams ();
+ RetinexParams ();
void setDefaults();
- void getCurves(DehaztransmissionCurve &transmissionCurveLUT) const;
+ void getCurves(RetinextransmissionCurve &transmissionCurveLUT) const;
static void getDefaulttransmissionCurve(std::vector &curve);
static void getDefaultCDCurve(std::vector &curve);
@@ -1220,7 +1219,7 @@ class ProcParams
public:
ToneCurveParams toneCurve; ///< Tone curve parameters
LCurveParams labCurve; ///< CIELAB luminance curve parameters
- DehazParams dehaz; ///< Dehaz parameters
+ RetinexParams retinex; ///< Retinex parameters
RGBCurvesParams rgbCurves; ///< RGB curves parameters
ColorToningParams colorToning; ///< Color Toning parameters
SharpeningParams sharpening; ///< Sharpening parameters
diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc
index 2d7bed9c2..e6664dc06 100644
--- a/rtengine/rawimagesource.cc
+++ b/rtengine/rawimagesource.cc
@@ -1801,14 +1801,14 @@ void RawImageSource::demosaic(const RAWParams &raw)
}
}
-void RawImageSource::dehaz(RAWParams raw, ColorManagementParams cmp, DehazParams deh, LUTf & cdcurve, LUTf & cdHcurve, const DehaztransmissionCurve & dehatransmissionCurve, bool dehacontlutili, bool dehaHcontlutili, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax)
+void RawImageSource::retinex(RAWParams raw, ColorManagementParams cmp, RetinexParams deh, LUTf & cdcurve, LUTf & cdHcurve, const RetinextransmissionCurve & dehatransmissionCurve, bool dehacontlutili, bool dehaHcontlutili, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax)
{
MyTime t4, t5;
t4.set();
if (settings->verbose) {
- printf ("Applying DeHaze\n");
+ printf ("Applying Retinex\n");
}
TMatrix wprof = iccStore->workingSpaceMatrix (cmp.working);
@@ -1840,8 +1840,8 @@ void RawImageSource::dehaz(RAWParams raw, ColorManagementParams cmp, DehazParams
labTmp[i] = &labTmpBuffer[i * WNew];
}
- bool useHsl = deh.dehazcolorspace == "HSL";
- bool useHslLin = deh.dehazcolorspace == "HSLLIN";
+ bool useHsl = deh.retinexcolorspace == "HSLLOG";
+ bool useHslLin = deh.retinexcolorspace == "HSLLIN";
if(useHsl || useHslLin) {
for (int i = border; i < H - border; i++ )
for (int j = border; j < W - border; j++) {
@@ -1957,7 +1957,7 @@ void RawImageSource::dehaz(RAWParams raw, ColorManagementParams cmp, DehazParams
t5.set();
if( settings->verbose ) {
- printf("Dehaz=%d usec\n", t5.etime(t4));
+ printf("Retinex=%d usec\n", t5.etime(t4));
}
}
diff --git a/rtengine/rawimagesource.h b/rtengine/rawimagesource.h
index c77fe05a2..5cb0c74a5 100644
--- a/rtengine/rawimagesource.h
+++ b/rtengine/rawimagesource.h
@@ -151,8 +151,8 @@ public:
int load (Glib::ustring fname, bool batch = false);
void preprocess (const RAWParams &raw, const LensProfParams &lensProf, const CoarseTransformParams& coarse);
void demosaic (const RAWParams &raw);
-// void dehaz (RAWParams raw, ColorManagementParams cmp, DehazParams lcur, LUTf & cdcurve, bool dehacontlutili);
- void dehaz (RAWParams raw, ColorManagementParams cmp, DehazParams deh, LUTf & cdcurve, LUTf & cdHcurve, const DehaztransmissionCurve & dehatransmissionCurve, bool dehacontlutili, bool dehaHcontlutili, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax);
+// void retinex (RAWParams raw, ColorManagementParams cmp, RetinexParams lcur, LUTf & cdcurve, bool dehacontlutili);
+ void retinex (RAWParams raw, ColorManagementParams cmp, RetinexParams deh, LUTf & cdcurve, LUTf & cdHcurve, const RetinextransmissionCurve & dehatransmissionCurve, bool dehacontlutili, bool dehaHcontlutili, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax);
void flushRawData ();
void flushRGB ();
void HLRecovery_Global (ToneCurveParams hrp);
@@ -228,8 +228,8 @@ public:
void boxblur2(float** src, float** dst, int H, int W, int box );
void boxblur_resamp(float **src, float **dst, int H, int W, int box, int samp );
- void MSR(float** luminance, float **originalLuminance, int width, int height, DehazParams deh, const DehaztransmissionCurve & dehatransmissionCurve, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax);
-// void MSR(LabImage* lab, int width, int height, int skip, DehazParams deh, const DehaztransmissionCurve & dehatransmissionCurve);
+ void MSR(float** luminance, float **originalLuminance, int width, int height, RetinexParams deh, const RetinextransmissionCurve & dehatransmissionCurve, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax);
+// void MSR(LabImage* lab, int width, int height, int skip, RetinexParams deh, const RetinextransmissionCurve & dehatransmissionCurve);
//void boxblur_resamp(float **red, float **green, float **blue, int H, int W, float thresh[3], float max[3],
// multi_array2D & hfsize, multi_array2D & hilite, int box );
diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc
index aa6de849b..0c4f9bf1d 100644
--- a/rtengine/refreshmap.cc
+++ b/rtengine/refreshmap.cc
@@ -102,7 +102,7 @@ int refreshmap[rtengine::NUMOFEVENTS] = {
RESIZE, // EvResizeHeight
RESIZE, // EvResizeEnabled
ALL, // EvProfileChangeNotification
- RETINEX, // EvShrHighQuality
+// RETINEX, // EvShrHighQuality
TRANSFORM, // EvPerspCorr
DARKFRAME, // EvLCPFile
RGBCURVE, // EvRGBrCurveLumamode
@@ -428,7 +428,7 @@ int refreshmap[rtengine::NUMOFEVENTS] = {
DIRPYREQUALIZER, // EvWavedgeampli
DIRPYREQUALIZER, //EvWavlev3nois
DIRPYREQUALIZER, //EvWavNPmet
- DEMOSAIC, // Evdehazmet
+ DEMOSAIC, // EvretinexMethod
DEMOSAIC, // EvLneigh
DEMOSAIC, // EvLgain
DEMOSAIC, // EvLoffs
@@ -436,12 +436,12 @@ int refreshmap[rtengine::NUMOFEVENTS] = {
DEMOSAIC, // EvLscal
DEMOSAIC, // EvLvart
DEMOSAIC, // EvLCDCurve
- DEMOSAIC, // EvDehazOpacity
- DEMOSAIC, // EvDehazEnabled
- DEMOSAIC, // EvDehazretinex
- DEMOSAIC, // EvDehazmedianmap
+ DEMOSAIC, // EvRetinexOpacity
+ DEMOSAIC, // EvRetinexEnabled
+ DEMOSAIC, // EvRetinexretinex <-- TODO we can probably delete this
+ DEMOSAIC, // EvRetinexmedianmap
DEMOSAIC, // EvLlimd
- DEMOSAIC, // Evdehazcolorspace
+ DEMOSAIC, // Evretinexcolorspace
DEMOSAIC // EvLCDHCurve
diff --git a/rtengine/rtengine.h b/rtengine/rtengine.h
index 54d8d010b..f15778421 100644
--- a/rtengine/rtengine.h
+++ b/rtengine/rtengine.h
@@ -287,10 +287,10 @@ public :
};
-class DehazListener
+class RetinexListener
{
public :
- virtual ~DehazListener() {}
+ virtual ~RetinexListener() {}
virtual void minmaxChanged (double cdma, double cdmin, double mini, double maxi, double Tmean, double Tsigma, double Tmin, double Tmax) {}
};
@@ -413,7 +413,7 @@ public:
virtual void setAutoBWListener (AutoBWListener* l) = 0;
virtual void setAutoColorTonListener (AutoColorTonListener* l) = 0;
virtual void setAutoChromaListener (AutoChromaListener* l) = 0;
- virtual void setDehazListener (DehazListener* l) = 0;
+ virtual void setRetinexListener (RetinexListener* l) = 0;
virtual void setWaveletListener (WaveletListener* l) = 0;
virtual ~StagedImageProcessor () {}
diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc
index 5425bc9fe..a3f18f770 100644
--- a/rtengine/simpleprocess.cc
+++ b/rtengine/simpleprocess.cc
@@ -116,19 +116,19 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p
pl->setProgress (0.30);
}
- if(params.dehaz.enabled) { //enabled Dehaze
+ if(params.retinex.enabled) { //enabled Retinex
LUTf cdcurve (65536, 0);
LUTf cdHcurve (65536, 0);
- DehaztransmissionCurve dehatransmissionCurve;
+ RetinextransmissionCurve dehatransmissionCurve;
bool dehacontlutili = false;
bool dehaHcontlutili = false;
- CurveFactory::curveDehaContL (dehacontlutili, params.dehaz.cdcurve, cdcurve, 1);
- CurveFactory::curveDehaHContL (dehaHcontlutili, params.dehaz.cdHcurve, cdHcurve, 1);
- DehazParams DehaParams = params.dehaz;
+ CurveFactory::curveDehaContL (dehacontlutili, params.retinex.cdcurve, cdcurve, 1);
+ CurveFactory::curveDehaHContL (dehaHcontlutili, params.retinex.cdHcurve, cdHcurve, 1);
+ RetinexParams DehaParams = params.retinex;
DehaParams.getCurves(dehatransmissionCurve);
float minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax;
- imgsrc->dehaz( params.raw, params.icm, params.dehaz, cdcurve, cdHcurve, dehatransmissionCurve, dehacontlutili, dehaHcontlutili, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax);
+ imgsrc->retinex( params.raw, params.icm, params.retinex, cdcurve, cdHcurve, dehatransmissionCurve, dehacontlutili, dehaHcontlutili, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax);
}
if (pl) {
diff --git a/rtgui/CMakeLists.txt b/rtgui/CMakeLists.txt
index d49b2dbe6..5f5dbc1c1 100644
--- a/rtgui/CMakeLists.txt
+++ b/rtgui/CMakeLists.txt
@@ -17,7 +17,7 @@ set (BASESOURCEFILES
previewloader.cc rtimage.cc inspector.cc
histogrampanel.cc history.cc imagearea.cc
imageareapanel.cc iptcpanel.cc labcurve.cc main.cc
- multilangmgr.cc mycurve.cc myflatcurve.cc mydiagonalcurve.cc options.cc dehaz.cc
+ multilangmgr.cc mycurve.cc myflatcurve.cc mydiagonalcurve.cc options.cc retinex.cc
preferences.cc profilepanel.cc saveasdlg.cc
saveformatpanel.cc soundman.cc splash.cc
thumbnail.cc tonecurve.cc toolbar.cc
diff --git a/rtgui/batchtoolpanelcoord.cc b/rtgui/batchtoolpanelcoord.cc
index 7e8c79986..2486f7ea9 100644
--- a/rtgui/batchtoolpanelcoord.cc
+++ b/rtgui/batchtoolpanelcoord.cc
@@ -167,7 +167,7 @@ void BatchToolPanelCoordinator::initSession ()
blackwhite->setAdjusterBehavior (false, false);
colortoning->setAdjusterBehavior (false, false, false, false, false);
filmSimulation->setAdjusterBehavior(false);
- dehaz->setAdjusterBehavior (false, false, false, false, false, false, false);
+ retinex->setAdjusterBehavior (false, false, false, false, false, false, false);
shadowshighlights->setAdjusterBehavior (false, false, false);
dirpyrequalizer->setAdjusterBehavior (false, false, false);
@@ -204,7 +204,7 @@ void BatchToolPanelCoordinator::initSession ()
// colortoning->setAdjusterBehavior (options.baBehav[ADDSET_COLORTONING_SPLIT], options.baBehav[ADDSET_COLORTONING_SATTHRESHOLD], options.baBehav[ADDSET_COLORTONING_SATOPACITY], options.baBehav[ADDSET_COLORTONING_STRPROTECT], options.baBehav[ADDSET_COLORTONING_BALANCE]);
colortoning->setAdjusterBehavior (options.baBehav[ADDSET_COLORTONING_SPLIT], options.baBehav[ADDSET_COLORTONING_SATTHRESHOLD], options.baBehav[ADDSET_COLORTONING_SATOPACITY], options.baBehav[ADDSET_COLORTONING_STRENGTH], options.baBehav[ADDSET_COLORTONING_BALANCE]);
filmSimulation->setAdjusterBehavior(options.baBehav[ADDSET_FILMSIMULATION_STRENGTH]);
- dehaz->setAdjusterBehavior (options.baBehav[ADDSET_DH_STR], options.baBehav[ADDSET_DH_SCAL], options.baBehav[ADDSET_DH_NEIGH], options.baBehav[ADDSET_DH_LIMD], options.baBehav[ADDSET_DH_GAIN], options.baBehav[ADDSET_DH_OFFS], options.baBehav[ADDSET_DH_VART]);
+ retinex->setAdjusterBehavior (options.baBehav[ADDSET_DH_STR], options.baBehav[ADDSET_DH_SCAL], options.baBehav[ADDSET_DH_NEIGH], options.baBehav[ADDSET_DH_LIMD], options.baBehav[ADDSET_DH_GAIN], options.baBehav[ADDSET_DH_OFFS], options.baBehav[ADDSET_DH_VART]);
chmixer->setAdjusterBehavior (options.baBehav[ADDSET_CHMIXER] );
blackwhite->setAdjusterBehavior (options.baBehav[ADDSET_BLACKWHITE_HUES], options.baBehav[ADDSET_BLACKWHITE_GAMMA]);
@@ -579,31 +579,31 @@ void BatchToolPanelCoordinator::initSession ()
}
if (options.baBehav[ADDSET_DH_STR]) {
- pparams.dehaz.str = 0;
+ pparams.retinex.str = 0;
}
if (options.baBehav[ADDSET_DH_SCAL]) {
- pparams.dehaz.scal = 0;
+ pparams.retinex.scal = 0;
}
if (options.baBehav[ADDSET_DH_NEIGH]) {
- pparams.dehaz.neigh = 0;
+ pparams.retinex.neigh = 0;
}
if (options.baBehav[ADDSET_DH_LIMD]) {
- pparams.dehaz.limd = 0;
+ pparams.retinex.limd = 0;
}
if (options.baBehav[ADDSET_DH_GAIN]) {
- pparams.dehaz.gain = 0;
+ pparams.retinex.gain = 0;
}
if (options.baBehav[ADDSET_DH_OFFS]) {
- pparams.dehaz.offs = 0;
+ pparams.retinex.offs = 0;
}
if (options.baBehav[ADDSET_DH_VART]) {
- pparams.dehaz.vart = 0;
+ pparams.retinex.vart = 0;
}
diff --git a/rtgui/dehaz.cc b/rtgui/dehaz.cc
deleted file mode 100644
index 3c3761e83..000000000
--- a/rtgui/dehaz.cc
+++ /dev/null
@@ -1,716 +0,0 @@
-/*
- * This file is part of RawTherapee.
- */
-#include "dehaz.h"
-#include "mycurve.h"
-
-using namespace rtengine;
-using namespace rtengine::procparams;
-
-Dehaz::Dehaz () : FoldableToolPanel(this, "dehaz", M("TP_DEHAZ_LABEL"), false, true)
-{
- CurveListener::setMulti(true);
- std::vector milestones;
- nextmin = 0.;
- nextmax = 0.;
- nextminiT = 0.;
- nextmaxiT = 0.;
- nextmeanT = 0.;
- nextsigma = 0.;
- nextminT = 0.;
- nextmaxT = 0.;
-
- dehazFrame = Gtk::manage (new Gtk::Frame (M("TP_DEHAZ_LAB")) );
- dehazFrame->set_tooltip_text(M("TP_DEHAZ_LAB_TOOLTIP"));
- dehazFrame->set_border_width(0);
- dehazFrame->set_label_align(0.025, 0.5);
-
- Gtk::VBox * dehazVBox = Gtk::manage ( new Gtk::VBox());
- dehazVBox->set_border_width(4);
- dehazVBox->set_spacing(2);
-
- Gtk::VBox * RetiVBox = Gtk::manage ( new Gtk::VBox());
- RetiVBox->set_border_width(4);
- RetiVBox->set_spacing(2);
-
- dhbox = Gtk::manage (new Gtk::HBox ());
- labmdh = Gtk::manage (new Gtk::Label (M("TP_DEHAZE_MET") + ":"));
- dhbox->pack_start (*labmdh, Gtk::PACK_SHRINK, 1);
-
- dehazmet = Gtk::manage (new MyComboBoxText ());
- dehazmet->append_text (M("TP_DEHAZ_LOW"));
- dehazmet->append_text (M("TP_DEHAZ_UNI"));
- dehazmet->append_text (M("TP_DEHAZ_HIGH"));
- dehazmet->set_active(0);
- dehazmetConn = dehazmet->signal_changed().connect ( sigc::mem_fun(*this, &Dehaz::dehazmetChanged) );
- dehazmet->set_tooltip_markup (M("TP_DEHAZ_MET_TOOLTIP"));
-
- dehazcolorspace = Gtk::manage (new MyComboBoxText ());
- dehazcolorspace->append_text (M("TP_DEHAZ_LABSPACE"));
- dehazcolorspace->append_text (M("TP_DEHAZ_HSLSPACE"));
- dehazcolorspace->append_text (M("TP_DEHAZ_HSLSPACELIN"));
- dehazcolorspace->set_active(0);
- dehazmetConn = dehazcolorspace->signal_changed().connect ( sigc::mem_fun(*this, &Dehaz::dehazColorSpaceChanged) );
- dehazcolorspace->set_tooltip_markup (M("TP_DEHAZ_COLORSPACE_TOOLTIP"));
-
-
-
- dhbox->pack_start(*dehazmet);
- dhbox->pack_start(*dehazcolorspace);
- dehazVBox->pack_start(*dhbox);
- std::vector defaultCurve;
-
- curveEditorGD = new CurveEditorGroup (options.lastDehazDir, M("TP_DEHAZ_CONTEDIT"));
- curveEditorGD->setCurveListener (this);
- rtengine::DehazParams::getDefaultCDCurve(defaultCurve);
- cdshape = static_cast(curveEditorGD->addCurve(CT_Diagonal, M("TP_DEHAZ_CURVEEDITOR_CD")));
- cdshape->setResetCurve(DiagonalCurveType(defaultCurve.at(0)), defaultCurve);
- cdshape->setTooltip(M("TP_DEHAZ_CURVEEDITOR_CD_TOOLTIP"));
- std::vector milestones22;
-
- milestones22.push_back( GradientMilestone(0., 0., 0., 0.) );
- milestones22.push_back( GradientMilestone(1., 1., 1., 1.) );
- cdshape->setBottomBarBgGradient(milestones22);
- cdshape->setLeftBarBgGradient(milestones22);
-
- curveEditorGD->curveListComplete();
-
- curveEditorGDH = new CurveEditorGroup (options.lastDehazDir, M("TP_DEHAZ_CONTEDITH"));
- curveEditorGDH->setCurveListener (this);
- rtengine::DehazParams::getDefaultCDHCurve(defaultCurve);
- cdshapeH = static_cast(curveEditorGDH->addCurve(CT_Diagonal, M("TP_DEHAZ_CURVEEDITOR_CD")));
- cdshapeH->setResetCurve(DiagonalCurveType(defaultCurve.at(0)), defaultCurve);
- cdshapeH->setTooltip(M("TP_DEHAZ_CURVEEDITOR_CD_TOOLTIP"));
- std::vector milestones22H;
-
- milestones22H.push_back( GradientMilestone(0., 0., 0., 0.) );
- milestones22H.push_back( GradientMilestone(1., 1., 1., 1.) );
- cdshapeH->setBottomBarBgGradient(milestones22H);
- cdshapeH->setLeftBarBgGradient(milestones22H);
-
- curveEditorGDH->curveListComplete();
-
-
- transmissionCurveEditorG = new CurveEditorGroup (options.lastDehazDir, M("TP_DEHAZ_TRANSMISSION"));
- transmissionCurveEditorG->setCurveListener (this);
-
- rtengine::DehazParams::getDefaulttransmissionCurve(defaultCurve);
- transmissionShape = static_cast(transmissionCurveEditorG->addCurve(CT_Flat, "", NULL, false));
- transmissionShape->setIdentityValue(0.);
- transmissionShape->setResetCurve(FlatCurveType(defaultCurve.at(0)), defaultCurve);
- transmissionShape->setBottomBarBgGradient(milestones);
- transmissionCurveEditorG->set_tooltip_markup (M("TP_DEHAZ_TRANS_TOOLTIP"));
-
- transmissionCurveEditorG->curveListComplete();
-
-
-
- str = Gtk::manage (new Adjuster (M("TP_DEHAZ_STR"), 0, 100., 1., 30.));
- str->set_tooltip_markup (M("TP_DEHAZ_STR_TOOLTIP"));
- neigh = Gtk::manage (new Adjuster (M("TP_DEHAZ_NEIGH"), 6, 100., 1., 80.));
-
- expretinex = new MyExpander (false, M("TP_DEHAZ_RETIN"));
- expretinex->signal_button_release_event().connect_notify( sigc::bind( sigc::mem_fun(this, &Dehaz::foldAllButMe), expretinex) );
-
- retinex = Gtk::manage (new Gtk::CheckButton (M("TP_DEHAZ_RETIN")));
- retinex->set_active (true);
- retinexConn = retinex->signal_toggled().connect( sigc::mem_fun(*this, &Dehaz::retinexChanged) );
-
- dehazVBox->pack_start (*str);
- str->show ();
-
- dehazVBox->pack_start (*neigh);
- neigh->show ();
- neigh->set_tooltip_markup (M("TP_DEHAZ_NEIGH_TOOLTIP"));
-
-// dehazVBox->pack_start (*retinex);
-// retinex->show ();
-
- mMLabels = Gtk::manage(new Gtk::Label("---", Gtk::ALIGN_CENTER));
- mMLabels->set_tooltip_markup (M("TP_DEHAZ_MLABEL_TOOLTIP"));
-
- transLabels = Gtk::manage(new Gtk::Label("---", Gtk::ALIGN_CENTER));
- transLabels->set_tooltip_markup (M("TP_DEHAZ_TLABEL_TOOLTIP"));
-
- scal = Gtk::manage (new Adjuster (M("TP_DEHAZ_SCAL"), 1, 8., 1., 3.));
- gain = Gtk::manage (new Adjuster (M("TP_DEHAZ_GAIN"), 20, 200, 1, 100));//50 150
- offs = Gtk::manage (new Adjuster (M("TP_DEHAZ_OFFS"), -10000, 10000, 1, 0));
- vart = Gtk::manage (new Adjuster (M("TP_DEHAZ_VART"), 50, 500, 1, 125));
- limd = Gtk::manage (new Adjuster (M("TP_DEHAZ_LIMD"), 2, 100, 1, 8));
- gain->set_tooltip_markup (M("TP_DEHAZ_GAIN_TOOLTIP"));
- offs->set_tooltip_markup (M("TP_DEHAZ_GAIN_TOOLTIP"));
- scal->set_tooltip_markup (M("TP_DEHAZ_SCAL_TOOLTIP"));
- vart->set_tooltip_markup (M("TP_DEHAZ_VART_TOOLTIP"));
- limd->set_tooltip_markup (M("TP_DEHAZ_LIMD_TOOLTIP"));
-
- medianmap = Gtk::manage (new Gtk::CheckButton (M("TP_DEHAZ_MEDI")));
- medianmap->set_active (true);
- medianmapConn = medianmap->signal_toggled().connect( sigc::mem_fun(*this, &Dehaz::medianmapChanged) );
-
- RetiVBox->pack_start (*mMLabels);
- mMLabels->show ();
-
- RetiVBox->pack_start (*transLabels);
- transLabels->show ();
-
- RetiVBox->pack_start (*curveEditorGD, Gtk::PACK_SHRINK, 4);
- curveEditorGD->show();
-
- RetiVBox->pack_start (*curveEditorGDH, Gtk::PACK_SHRINK, 4);
- curveEditorGDH->show();
-
- RetiVBox->pack_start (*scal);
- scal->show ();
-
- RetiVBox->pack_start (*gain);
- gain->show ();
-
- RetiVBox->pack_start (*offs);
- offs->show ();
-
- RetiVBox->pack_start (*vart);
- vart->show ();
-
- RetiVBox->pack_start (*limd);
- limd->show ();
-
- RetiVBox->pack_start( *transmissionCurveEditorG, Gtk::PACK_SHRINK, 2);
- transmissionCurveEditorG->show();
-
- RetiVBox->pack_start (*medianmap);
- medianmap->show ();
-
- expretinex->add(*RetiVBox);
-
- str->setAdjusterListener (this);
- scal->setAdjusterListener (this);
- neigh->setAdjusterListener (this);
- gain->setAdjusterListener (this);
- offs->setAdjusterListener (this);
- vart->setAdjusterListener (this);
- limd->setAdjusterListener (this);
- pack_start (*dehazVBox);
-// dehazFrame->add(*RetiVBox);
-// pack_start (*dehazFrame);
-// dehazFrame->hide();
- pack_start (*expretinex);
-
- disableListener();
- retinexChanged();
- dehazColorSpaceChanged();
- medianmapChanged();
- enableListener();
-
-}
-
-Dehaz::~Dehaz()
-{
- delete curveEditorGD;
- delete curveEditorGDH;
- delete transmissionCurveEditorG;
-
-}
-
-void Dehaz::foldAllButMe (GdkEventButton* event, MyExpander *expander)
-{
- if (event->button == 3) {
- expretinex->set_expanded(expretinex == expander);
- }
-}
-
-void Dehaz::writeOptions(std::vector &tpOpen)
-{
- tpOpen.push_back (expretinex->get_expanded ());
-}
-
-void Dehaz::updateToolState(std::vector &tpOpen)
-{
- if(tpOpen.size() == 9) {
- expretinex->set_expanded(tpOpen.at(0));
- }
-}
-
-
-
-
-
-int minmaxChangedUI (void* data)
-{
- GThreadLock lock; // All GUI acces from idle_add callbacks or separate thread HAVE to be protected
- (static_cast(data))->minmaxComputed_ ();
- return 0;
-}
-
-void Dehaz::minmaxChanged (double cdma, double cdmin, double mini, double maxi, double Tmean, double Tsigma, double Tmin, double Tmax)
-{
- nextmin = cdmin;
- nextmax = cdma;
- nextminiT = mini;
- nextmaxiT = maxi;
- nextmeanT = Tmean;
- nextsigma = Tsigma;
- nextminT = Tmin;
- nextmaxT = Tmax;
- g_idle_add (minmaxChangedUI, this);
-
-}
-
-bool Dehaz::minmaxComputed_ ()
-{
-
- disableListener ();
- enableListener ();
- updateLabel ();
- updateTrans ();
- return false;
-
-}
-void Dehaz::updateLabel ()
-{
- if (!batchMode) {
- float nX, nY;
- nX = nextmin;
- nY = nextmax;
- {
- mMLabels->set_text(
- Glib::ustring::compose(M("TP_DEHAZ_MLABEL"),
- Glib::ustring::format(std::fixed, std::setprecision(0), nX),
- Glib::ustring::format(std::fixed, std::setprecision(0), nY))
- );
- }
- }
-}
-
-void Dehaz::updateTrans ()
-{
- if (!batchMode) {
- float nm, nM, nZ, nA, nB, nS;
- nm = nextminiT;
- nM = nextmaxiT;
- nZ = nextmeanT;
- nA = nextminT;
- nB = nextmaxT;
- nS = nextsigma;
- {
- transLabels->set_text(
- Glib::ustring::compose(M("TP_DEHAZ_TLABEL"),
- Glib::ustring::format(std::fixed, std::setprecision(1), nm),
- Glib::ustring::format(std::fixed, std::setprecision(1), nM),
- Glib::ustring::format(std::fixed, std::setprecision(1), nZ),
- Glib::ustring::format(std::fixed, std::setprecision(1), nS),
- Glib::ustring::format(std::fixed, std::setprecision(1), nA),
- Glib::ustring::format(std::fixed, std::setprecision(1), nB))
- );
- }
- }
-}
-
-
-
-void Dehaz::read (const ProcParams* pp, const ParamsEdited* pedited)
-{
- disableListener ();
- dehazmetConn.block(true);
-
-
- if (pedited) {
- scal->setEditedState (pedited->dehaz.scal ? Edited : UnEdited);
- neigh->setEditedState (pedited->dehaz.neigh ? Edited : UnEdited);
- gain->setEditedState (pedited->dehaz.gain ? Edited : UnEdited);
- offs->setEditedState (pedited->dehaz.offs ? Edited : UnEdited);
- vart->setEditedState (pedited->dehaz.vart ? Edited : UnEdited);
- limd->setEditedState (pedited->dehaz.limd ? Edited : UnEdited);
- set_inconsistent (multiImage && !pedited->dehaz.enabled);
- retinex->set_inconsistent (!pedited->dehaz.retinex);
- medianmap->set_inconsistent (!pedited->dehaz.medianmap);
-
-
- if (!pedited->dehaz.dehazmet) {
- dehazmet->set_active_text(M("GENERAL_UNCHANGED"));
- }
-
- if (!pedited->dehaz.dehazcolorspace) {
- dehazcolorspace->set_active_text(M("GENERAL_UNCHANGED"));
- }
-
- cdshape->setUnChanged (!pedited->dehaz.cdcurve);
- cdshapeH->setUnChanged (!pedited->dehaz.cdHcurve);
- transmissionShape->setUnChanged (!pedited->dehaz.transmissionCurve);
-
- }
-
- neigh->setValue (pp->dehaz.neigh);
- gain->setValue (pp->dehaz.gain);
- offs->setValue (pp->dehaz.offs);
- str->setValue (pp->dehaz.str);
- scal->setValue (pp->dehaz.scal);
- vart->setValue (pp->dehaz.vart);
- limd->setValue (pp->dehaz.limd);
-
- setEnabled (pp->dehaz.enabled);
-
- retinexConn.block (true);
- retinex->set_active (pp->dehaz.retinex);
- retinexConn.block (false);
- lastretinex = pp->dehaz.retinex;
-
- medianmapConn.block (true);
- medianmap->set_active (pp->dehaz.medianmap);
- medianmapConn.block (false);
- lastmedianmap = pp->dehaz.medianmap;
-
-
- if (pp->dehaz.dehazmet == "low") {
- dehazmet->set_active (0);
- } else if (pp->dehaz.dehazmet == "uni") {
- dehazmet->set_active (1);
- } else if (pp->dehaz.dehazmet == "high") {
- dehazmet->set_active (2);
- }
-
- dehazmetChanged ();
-
- if (pp->dehaz.dehazcolorspace == "Lab") {
- dehazcolorspace->set_active (0);
- } else if (pp->dehaz.dehazcolorspace == "HSL") {
- dehazcolorspace->set_active (1);
- } else if (pp->dehaz.dehazcolorspace == "HSLLIN") {
- dehazcolorspace->set_active (2);
- }
- retinexConn.block(false);
- retinexChanged ();
- retinexConn.block(false);
-
- medianmapConn.block(false);
- medianmapChanged ();
- medianmapConn.block(false);
-
- cdshape->setCurve (pp->dehaz.cdcurve);
- cdshapeH->setCurve (pp->dehaz.cdHcurve);
- dehazmetConn.block(false);
- dehazColorSpaceConn.block(false);
- dehazColorSpaceChanged();
- dehazColorSpaceConn.block(false);
- transmissionShape->setCurve (pp->dehaz.transmissionCurve);
-
-
- enableListener ();
-}
-void Dehaz::retinexUpdateUI ()
-{
- if (!batchMode) {
- if (retinex->get_active ()) {
- scal->show();
- gain->show();
- offs->show();
- vart->show();
- limd->show();
- medianmap->show();
- mMLabels->show();
- transLabels->show();
- transmissionCurveEditorG->show();
- curveEditorGD->show();
- curveEditorGDH->show();
- dehazFrame->show();
- } else {
- scal->hide();
- gain->hide();
- offs->hide();
- vart->hide();
- limd->hide();
- mMLabels->hide();
- transLabels->hide();
- medianmap->hide();
- transmissionCurveEditorG->hide();
- curveEditorGD->hide();
- curveEditorGDH->hide();
- dehazFrame->hide();
- }
- }
-}
-
-
-
-void Dehaz::write (ProcParams* pp, ParamsEdited* pedited)
-{
-
- pp->dehaz.str = str->getValue ();
- pp->dehaz.scal = (int)scal->getValue ();
- pp->dehaz.neigh = neigh->getValue ();
- pp->dehaz.gain = (int)gain->getValue ();
- pp->dehaz.offs = (int)offs->getValue ();
- pp->dehaz.vart = (int)vart->getValue ();
- pp->dehaz.limd = (int)limd->getValue ();
- pp->dehaz.cdcurve = cdshape->getCurve ();
- pp->dehaz.cdHcurve = cdshapeH->getCurve ();
- pp->dehaz.transmissionCurve = transmissionShape->getCurve ();
- pp->dehaz.enabled = getEnabled();
- pp->dehaz.retinex = retinex->get_active();
- pp->dehaz.medianmap = medianmap->get_active();
-
- if (pedited) {
- pedited->dehaz.dehazmet = dehazmet->get_active_text() != M("GENERAL_UNCHANGED");
- pedited->dehaz.dehazcolorspace = dehazcolorspace->get_active_text() != M("GENERAL_UNCHANGED");
-
- //%%%%%%%%%%%%%%%%%%%%%%
- pedited->dehaz.str = str->getEditedState ();
- pedited->dehaz.scal = scal->getEditedState ();
- pedited->dehaz.neigh = neigh->getEditedState ();
- pedited->dehaz.gain = gain->getEditedState ();
- pedited->dehaz.offs = offs->getEditedState ();
- pedited->dehaz.vart = vart->getEditedState ();
- pedited->dehaz.limd = limd->getEditedState ();
- pedited->dehaz.cdcurve = !cdshape->isUnChanged ();
- pedited->dehaz.cdHcurve = !cdshapeH->isUnChanged ();
- pedited->dehaz.transmissionCurve = !transmissionShape->isUnChanged ();
- pedited->dehaz.enabled = !get_inconsistent();
- pedited->dehaz.retinex = !retinex->get_inconsistent();
- pedited->dehaz.medianmap = !medianmap->get_inconsistent();
-
- }
-
- if (dehazmet->get_active_row_number() == 0) {
- pp->dehaz.dehazmet = "low";
- } else if (dehazmet->get_active_row_number() == 1) {
- pp->dehaz.dehazmet = "uni";
- } else if (dehazmet->get_active_row_number() == 2) {
- pp->dehaz.dehazmet = "high";
- }
-
- if (dehazcolorspace->get_active_row_number() == 0) {
- pp->dehaz.dehazcolorspace = "Lab";
- } else if (dehazcolorspace->get_active_row_number() == 1) {
- pp->dehaz.dehazcolorspace = "HSL";
- } else if (dehazcolorspace->get_active_row_number() == 2) {
- pp->dehaz.dehazcolorspace = "HSLLIN";
- }
-}
-
-void Dehaz::dehazmetChanged()
-{
- if (listener) {
- listener->panelChanged (Evdehazmet, dehazmet->get_active_text ());
- }
-}
-
-void Dehaz::ColorSpaceUpdateUI ()
-{
- if (!batchMode) {
- if(dehazcolorspace->get_active_row_number() == 0) {
- curveEditorGD->show();
- curveEditorGDH->hide();
- } else if(dehazcolorspace->get_active_row_number() == 1) {
- curveEditorGD->hide();
- curveEditorGDH->show();
- }
- }
-}
-
-
-void Dehaz::dehazColorSpaceChanged()
-{
-
- ColorSpaceUpdateUI();
-
- if (listener) {
- listener->panelChanged (EvdehazColorSpace, dehazcolorspace->get_active_text ());
- }
-}
-
-void Dehaz::retinexChanged ()
-{
- if (batchMode) {
- if (retinex->get_inconsistent()) {
- retinex->set_inconsistent (false);
- retinexConn.block (true);
- retinex->set_active (false);
- retinexConn.block (false);
- } else if (lastretinex) {
- retinex->set_inconsistent (true);
- }
-
- lastretinex = retinex->get_active ();
- }
-
- retinexUpdateUI();
-
- if (listener) {
- if (retinex->get_active()) {
- if (getEnabled()) {
- listener->panelChanged (EvDehazretinex, M("GENERAL_ENABLED"));
- }
- } else {
- if (getEnabled()) {
- listener->panelChanged (EvDehazretinex, M("GENERAL_DISABLED"));
- }
- }
-
- }
-}
-
-void Dehaz::medianmapChanged ()
-{
- if (batchMode) {
- if (medianmap->get_inconsistent()) {
- medianmap->set_inconsistent (false);
- medianmapConn.block (true);
- medianmap->set_active (false);
- medianmapConn.block (false);
- } else if (lastmedianmap) {
- medianmap->set_inconsistent (true);
- }
-
- lastmedianmap = medianmap->get_active ();
- }
-
- if (listener) {
- if (medianmap->get_active()) {
- if (getEnabled()) {
- listener->panelChanged (EvDehazmedianmap, M("GENERAL_ENABLED"));
- }
- } else {
- if (getEnabled()) {
- listener->panelChanged (EvDehazmedianmap, M("GENERAL_DISABLED"));
- }
- }
-
- }
-}
-
-
-void Dehaz::setDefaults (const ProcParams* defParams, const ParamsEdited* pedited)
-{
-
- neigh->setDefault (defParams->dehaz.neigh);
- gain->setDefault (defParams->dehaz.gain);
- offs->setDefault (defParams->dehaz.offs);
- str->setDefault (defParams->dehaz.str);
- scal->setDefault (defParams->dehaz.scal);
- vart->setDefault (defParams->dehaz.vart);
- limd->setDefault (defParams->dehaz.limd);
-
- if (pedited) {
- neigh->setDefaultEditedState (pedited->dehaz.neigh ? Edited : UnEdited);
- gain->setDefaultEditedState (pedited->dehaz.gain ? Edited : UnEdited);
- offs->setDefaultEditedState (pedited->dehaz.offs ? Edited : UnEdited);
- str->setDefaultEditedState (pedited->dehaz.str ? Edited : UnEdited);
- scal->setDefaultEditedState (pedited->dehaz.scal ? Edited : UnEdited);
- vart->setDefaultEditedState (pedited->dehaz.vart ? Edited : UnEdited);
- limd->setDefaultEditedState (pedited->dehaz.limd ? Edited : UnEdited);
-
- } else {
- neigh->setDefaultEditedState (Irrelevant);
- gain->setDefaultEditedState (Irrelevant);
- offs->setDefaultEditedState (Irrelevant);
- vart->setDefaultEditedState (Irrelevant);
- limd->setDefaultEditedState (Irrelevant);
- str->setDefaultEditedState (Irrelevant);
- scal->setDefaultEditedState (Irrelevant);
- }
-}
-
-void Dehaz::setAdjusterBehavior (bool strAdd, bool neighAdd, bool scalAdd, bool limdAdd, bool gainAdd, bool offsAdd, bool vartAdd)
- {
-
- str->setAddMode(strAdd);
- neigh->setAddMode(neighAdd);
- scal->setAddMode(scalAdd);
- limd->setAddMode(limdAdd);
- gain->setAddMode(gainAdd);
- offs->setAddMode(offsAdd);
- vart->setAddMode(vartAdd);
- }
-
-
-void Dehaz::adjusterChanged (Adjuster* a, double newval)
-{
-
- if (!listener || !getEnabled()) {
- return;
- }
-
- if (a == neigh) {
- listener->panelChanged (EvLneigh, neigh->getTextValue());
- } else if (a == str) {
- listener->panelChanged (EvLstr, str->getTextValue());
- } else if (a == scal) {
- listener->panelChanged (EvLscal, scal->getTextValue());
- } else if (a == gain) {
- listener->panelChanged (EvLgain, gain->getTextValue());
- } else if (a == offs) {
- listener->panelChanged (EvLoffs, offs->getTextValue());
- } else if (a == vart) {
- listener->panelChanged (EvLvart, vart->getTextValue());
- } else if (a == limd) {
- listener->panelChanged (EvLlimd, limd->getTextValue());
- }
-
-}
-
-
-
-void Dehaz::autoOpenCurve ()
-{
- cdshape->openIfNonlinear();
- cdshapeH->openIfNonlinear();
- transmissionShape->openIfNonlinear();
-
-}
-
-
-void Dehaz::curveChanged (CurveEditor* ce)
-{
- if (listener && getEnabled()) {
- if (ce == cdshape) {
- listener->panelChanged (EvLCDCurve, M("HISTORY_CUSTOMCURVE"));
- } else if (ce == cdshapeH) {
- listener->panelChanged (EvLCDHCurve, M("HISTORY_CUSTOMCURVE"));
- } else if (ce == transmissionShape) {
- listener->panelChanged (EvDehaztransmission, M("HISTORY_CUSTOMCURVE"));
- }
- }
-}
-
-void Dehaz::enabledChanged ()
-{
-
- if (listener) {
- if (get_inconsistent()) {
- listener->panelChanged (EvDehazEnabled, M("GENERAL_UNCHANGED"));
- } else if (getEnabled()) {
- listener->panelChanged (EvDehazEnabled, M("GENERAL_ENABLED"));
- } else {
- listener->panelChanged (EvDehazEnabled, M("GENERAL_DISABLED"));
- }
- }
-}
-
-
-void Dehaz::trimValues (rtengine::procparams::ProcParams* pp)
-{
- str->trimValue(pp->dehaz.str);
- scal->trimValue(pp->dehaz.scal);
- neigh->trimValue(pp->dehaz.neigh);
- gain->trimValue(pp->dehaz.gain);
- offs->trimValue(pp->dehaz.offs);
- vart->trimValue(pp->dehaz.vart);
- limd->trimValue(pp->dehaz.limd);
-
-}
-
-void Dehaz::setBatchMode (bool batchMode)
-{
- ToolPanel::setBatchMode (batchMode);
- neigh->showEditedCB ();
- gain->showEditedCB ();
- offs->showEditedCB ();
- str->showEditedCB ();
- scal->showEditedCB ();
- vart->showEditedCB ();
- limd->showEditedCB ();
- curveEditorGD->setBatchMode (batchMode);
- curveEditorGDH->setBatchMode (batchMode);
- transmissionCurveEditorG->setBatchMode (batchMode);
-
-
-}
diff --git a/rtgui/options.cc b/rtgui/options.cc
index 5e0f02e15..681d2bc81 100644
--- a/rtgui/options.cc
+++ b/rtgui/options.cc
@@ -178,8 +178,8 @@ void Options::updatePaths()
lastLabCurvesDir = preferredPath;
}
- if (lastDehazDir.empty() || !safe_file_test (lastDehazDir, Glib::FILE_TEST_EXISTS) || !safe_file_test (lastLabCurvesDir, Glib::FILE_TEST_IS_DIR)) {
- lastDehazDir = preferredPath;
+ if (lastRetinexDir.empty() || !safe_file_test (lastRetinexDir, Glib::FILE_TEST_EXISTS) || !safe_file_test (lastLabCurvesDir, Glib::FILE_TEST_IS_DIR)) {
+ lastRetinexDir = preferredPath;
}
if (lastDenoiseCurvesDir.empty() || !safe_file_test (lastDenoiseCurvesDir, Glib::FILE_TEST_EXISTS) || !safe_file_test (lastDenoiseCurvesDir, Glib::FILE_TEST_IS_DIR)) {
@@ -693,7 +693,7 @@ void Options::setDefaults ()
// at the end of the "updatePaths" method.
lastRgbCurvesDir = "";
lastLabCurvesDir = "";
- lastDehazDir = "";
+ lastRetinexDir = "";
lastDenoiseCurvesDir = "";
lastWaveletCurvesDir = "";
lastPFCurvesDir = "";
@@ -1745,7 +1745,7 @@ int Options::readFromFile (Glib::ustring fname)
safeDirGet(keyFile, "Dialogs", "LastFlatfieldDir", lastFlatfieldDir);
safeDirGet(keyFile, "Dialogs", "LastRgbCurvesDir", lastRgbCurvesDir);
safeDirGet(keyFile, "Dialogs", "LastLabCurvesDir", lastLabCurvesDir);
- safeDirGet(keyFile, "Dialogs", "LastDehazDir", lastDehazDir);
+ safeDirGet(keyFile, "Dialogs", "LastRetinexDir", lastRetinexDir);
safeDirGet(keyFile, "Dialogs", "LastDenoiseCurvesDir", lastDenoiseCurvesDir);
safeDirGet(keyFile, "Dialogs", "LastWaveletCurvesDir", lastWaveletCurvesDir);
safeDirGet(keyFile, "Dialogs", "LastPFCurvesDir", lastPFCurvesDir);
@@ -2082,7 +2082,7 @@ int Options::saveToFile (Glib::ustring fname)
keyFile.set_string ("Dialogs", "LastFlatfieldDir", lastFlatfieldDir);
keyFile.set_string ("Dialogs", "LastRgbCurvesDir", lastRgbCurvesDir);
keyFile.set_string ("Dialogs", "LastLabCurvesDir", lastLabCurvesDir);
- keyFile.set_string ("Dialogs", "LastDehazDir", lastDehazDir);
+ keyFile.set_string ("Dialogs", "LastRetinexDir", lastRetinexDir);
keyFile.set_string ("Dialogs", "LastDenoiseCurvesDir", lastDenoiseCurvesDir);
keyFile.set_string ("Dialogs", "LastWaveletCurvesDir", lastWaveletCurvesDir);
keyFile.set_string ("Dialogs", "LastPFCurvesDir", lastPFCurvesDir);
diff --git a/rtgui/options.h b/rtgui/options.h
index f619a9455..9c2385ffb 100644
--- a/rtgui/options.h
+++ b/rtgui/options.h
@@ -278,7 +278,7 @@ public:
Glib::ustring lastFlatfieldDir;
Glib::ustring lastRgbCurvesDir;
Glib::ustring lastLabCurvesDir;
- Glib::ustring lastDehazDir;
+ Glib::ustring lastRetinexDir;
Glib::ustring lastDenoiseCurvesDir;
Glib::ustring lastWaveletCurvesDir;
Glib::ustring lastPFCurvesDir;
diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc
index 8d786bb69..77f2d50f8 100644
--- a/rtgui/paramsedited.cc
+++ b/rtgui/paramsedited.cc
@@ -49,21 +49,21 @@ void ParamsEdited::set (bool v)
toneCurve.expcomp = v;
toneCurve.hrenabled = v;
toneCurve.method = v;
- dehaz.cdcurve = v;
- dehaz.cdHcurve = v;
- dehaz.dehazmet = v;
- dehaz.dehazcolorspace = v;
- dehaz.enabled = v;
- dehaz.str = v;
- dehaz.scal = v;
- dehaz.neigh = v;
- dehaz.gain = v;
- dehaz.offs = v;
- dehaz.vart = v;
- dehaz.limd = v;
- dehaz.medianmap = v;
- dehaz.transmissionCurve = v;
- dehaz.retinex = v;
+ retinex.cdcurve = v;
+ retinex.cdHcurve = v;
+ retinex.retinexMethod = v;
+ retinex.retinexcolorspace = v;
+ retinex.enabled = v;
+ retinex.str = v;
+ retinex.scal = v;
+ retinex.neigh = v;
+ retinex.gain = v;
+ retinex.offs = v;
+ retinex.vart = v;
+ retinex.limd = v;
+ retinex.medianmap = v;
+ retinex.transmissionCurve = v;
+ retinex.retinex = v;
labCurve.lcurve = v;
labCurve.acurve = v;
labCurve.bcurve = v;
@@ -519,21 +519,20 @@ void ParamsEdited::initFrom (const std::vector
toneCurve.expcomp = toneCurve.expcomp && p.toneCurve.expcomp == other.toneCurve.expcomp;
toneCurve.hrenabled = toneCurve.hrenabled && p.toneCurve.hrenabled == other.toneCurve.hrenabled;
toneCurve.method = toneCurve.method && p.toneCurve.method == other.toneCurve.method;
- dehaz.cdcurve = dehaz.cdcurve && p.dehaz.cdcurve == other.dehaz.cdcurve;
- dehaz.cdHcurve = dehaz.cdHcurve && p.dehaz.cdHcurve == other.dehaz.cdHcurve;
- dehaz.transmissionCurve = dehaz.transmissionCurve && p.dehaz.transmissionCurve == other.dehaz.transmissionCurve;
- dehaz.dehazmet = dehaz.dehazmet && p.dehaz.dehazmet == other.dehaz.dehazmet;
- dehaz.dehazcolorspace = dehaz.dehazcolorspace && p.dehaz.dehazcolorspace == other.dehaz.dehazcolorspace;
- dehaz.str = dehaz.str && p.dehaz.str == other.dehaz.str;
- dehaz.scal = dehaz.scal && p.dehaz.scal == other.dehaz.scal;
- dehaz.neigh = dehaz.neigh && p.dehaz.neigh == other.dehaz.neigh;
- dehaz.gain = dehaz.gain && p.dehaz.gain == other.dehaz.gain;
- dehaz.offs = dehaz.offs && p.dehaz.offs == other.dehaz.offs;
- dehaz.vart = dehaz.vart && p.dehaz.vart == other.dehaz.vart;
- dehaz.limd = dehaz.limd && p.dehaz.limd == other.dehaz.limd;
- dehaz.medianmap = dehaz.medianmap && p.dehaz.medianmap == other.dehaz.medianmap;
- dehaz.enabled = dehaz.enabled && p.dehaz.enabled == other.dehaz.enabled;
- dehaz.retinex = dehaz.retinex && p.dehaz.retinex == other.dehaz.retinex;
+ retinex.cdcurve = retinex.cdcurve && p.retinex.cdcurve == other.retinex.cdcurve;
+ retinex.cdHcurve = retinex.cdHcurve && p.retinex.cdHcurve == other.retinex.cdHcurve;
+ retinex.transmissionCurve = retinex.transmissionCurve && p.retinex.transmissionCurve == other.retinex.transmissionCurve;
+ retinex.retinexMethod = retinex.retinexMethod && p.retinex.retinexMethod == other.retinex.retinexMethod;
+ retinex.retinexcolorspace = retinex.retinexcolorspace && p.retinex.retinexcolorspace == other.retinex.retinexcolorspace;
+ retinex.str = retinex.str && p.retinex.str == other.retinex.str;
+ retinex.scal = retinex.scal && p.retinex.scal == other.retinex.scal;
+ retinex.neigh = retinex.neigh && p.retinex.neigh == other.retinex.neigh;
+ retinex.gain = retinex.gain && p.retinex.gain == other.retinex.gain;
+ retinex.offs = retinex.offs && p.retinex.offs == other.retinex.offs;
+ retinex.vart = retinex.vart && p.retinex.vart == other.retinex.vart;
+ retinex.limd = retinex.limd && p.retinex.limd == other.retinex.limd;
+ retinex.medianmap = retinex.medianmap && p.retinex.medianmap == other.retinex.medianmap;
+ retinex.enabled = retinex.enabled && p.retinex.enabled == other.retinex.enabled;
labCurve.lcurve = labCurve.lcurve && p.labCurve.lcurve == other.labCurve.lcurve;
labCurve.acurve = labCurve.acurve && p.labCurve.acurve == other.labCurve.acurve;
labCurve.bcurve = labCurve.bcurve && p.labCurve.bcurve == other.labCurve.bcurve;
@@ -1025,64 +1024,60 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten
toEdit.toneCurve.method = mods.toneCurve.method;
}
- if (dehaz.enabled) {
- toEdit.dehaz.enabled = mods.dehaz.enabled;
+ if (retinex.enabled) {
+ toEdit.retinex.enabled = mods.retinex.enabled;
}
- if (dehaz.cdcurve) {
- toEdit.dehaz.cdcurve = mods.dehaz.cdcurve;
- }
-
- if (dehaz.cdHcurve) {
- toEdit.dehaz.cdHcurve = mods.dehaz.cdHcurve;
+ if (retinex.cdcurve) {
+ toEdit.retinex.cdcurve = mods.retinex.cdcurve;
}
- if (dehaz.transmissionCurve) {
- toEdit.dehaz.transmissionCurve = mods.dehaz.transmissionCurve;
+ if (retinex.cdHcurve) {
+ toEdit.retinex.cdHcurve = mods.retinex.cdHcurve;
}
- if (dehaz.dehazmet) {
- toEdit.dehaz.dehazmet = mods.dehaz.dehazmet;
+ if (retinex.transmissionCurve) {
+ toEdit.retinex.transmissionCurve = mods.retinex.transmissionCurve;
}
- if (dehaz.dehazcolorspace) {
- toEdit.dehaz.dehazcolorspace = mods.dehaz.dehazcolorspace;
+ if (retinex.retinexMethod) {
+ toEdit.retinex.retinexMethod = mods.retinex.retinexMethod;
}
- if (dehaz.str) {
- toEdit.dehaz.str = dontforceSet && options.baBehav[ADDSET_DH_STR] ? toEdit.dehaz.str + mods.dehaz.str : mods.dehaz.str;
+ if (retinex.retinexcolorspace) {
+ toEdit.retinex.retinexcolorspace = mods.retinex.retinexcolorspace;
}
- if (dehaz.scal) {
- toEdit.dehaz.scal = dontforceSet && options.baBehav[ADDSET_DH_SCAL] ? toEdit.dehaz.scal + mods.dehaz.scal : mods.dehaz.scal;
+ if (retinex.str) {
+ toEdit.retinex.str = dontforceSet && options.baBehav[ADDSET_DH_STR] ? toEdit.retinex.str + mods.retinex.str : mods.retinex.str;
}
- if (dehaz.retinex) {
- toEdit.dehaz.retinex = mods.dehaz.retinex;
+ if (retinex.scal) {
+ toEdit.retinex.scal = dontforceSet && options.baBehav[ADDSET_DH_SCAL] ? toEdit.retinex.scal + mods.retinex.scal : mods.retinex.scal;
}
- if (dehaz.medianmap) {
- toEdit.dehaz.medianmap = mods.dehaz.medianmap;
+ if (retinex.medianmap) {
+ toEdit.retinex.medianmap = mods.retinex.medianmap;
}
- if (dehaz.neigh) {
- toEdit.dehaz.neigh = dontforceSet && options.baBehav[ADDSET_DH_NEIGH] ? toEdit.dehaz.neigh + mods.dehaz.neigh : mods.dehaz.neigh;
+ if (retinex.neigh) {
+ toEdit.retinex.neigh = dontforceSet && options.baBehav[ADDSET_DH_NEIGH] ? toEdit.retinex.neigh + mods.retinex.neigh : mods.retinex.neigh;
}
- if (dehaz.limd) {
- toEdit.dehaz.limd = dontforceSet && options.baBehav[ADDSET_DH_LIMD] ? toEdit.dehaz.limd + mods.dehaz.limd : mods.dehaz.limd;
+ if (retinex.limd) {
+ toEdit.retinex.limd = dontforceSet && options.baBehav[ADDSET_DH_LIMD] ? toEdit.retinex.limd + mods.retinex.limd : mods.retinex.limd;
}
- if (dehaz.gain) {
- toEdit.dehaz.gain = dontforceSet && options.baBehav[ADDSET_DH_GAIN] ? toEdit.dehaz.gain + mods.dehaz.gain : mods.dehaz.gain;
+ if (retinex.gain) {
+ toEdit.retinex.gain = dontforceSet && options.baBehav[ADDSET_DH_GAIN] ? toEdit.retinex.gain + mods.retinex.gain : mods.retinex.gain;
}
- if (dehaz.offs) {
- toEdit.dehaz.offs = dontforceSet && options.baBehav[ADDSET_DH_OFFS] ? toEdit.dehaz.offs + mods.dehaz.offs : mods.dehaz.offs;
+ if (retinex.offs) {
+ toEdit.retinex.offs = dontforceSet && options.baBehav[ADDSET_DH_OFFS] ? toEdit.retinex.offs + mods.retinex.offs : mods.retinex.offs;
}
- if (dehaz.vart) {
- toEdit.dehaz.vart = dontforceSet && options.baBehav[ADDSET_DH_VART] ? toEdit.dehaz.vart + mods.dehaz.vart : mods.dehaz.vart;
+ if (retinex.vart) {
+ toEdit.retinex.vart = dontforceSet && options.baBehav[ADDSET_DH_VART] ? toEdit.retinex.vart + mods.retinex.vart : mods.retinex.vart;
}
if (labCurve.lcurve) {
@@ -1117,8 +1112,8 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten
toEdit.labCurve.lccurve = mods.labCurve.lccurve;
}
-// if (labCurve.dehazmet) {
-// toEdit.labCurve.dehazmet = mods.labCurve.dehazmet;
+// if (labCurve.retinexMethod) {
+// toEdit.labCurve.retinexMethod = mods.labCurve.retinexMethod;
// }
if (labCurve.clcurve) {
toEdit.labCurve.clcurve = mods.labCurve.clcurve;
diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h
index 2346965bc..7600b3bb1 100644
--- a/rtgui/paramsedited.h
+++ b/rtgui/paramsedited.h
@@ -55,7 +55,7 @@ public:
bool method;
};
-class DehazParamsEdited
+class RetinexParamsEdited
{
public:
bool enabled;
@@ -64,8 +64,8 @@ public:
bool neigh;
bool gain;
bool offs;
- bool dehazmet;
- bool dehazcolorspace;
+ bool retinexMethod;
+ bool retinexcolorspace;
bool vart;
bool limd;
bool method;
@@ -721,7 +721,7 @@ public:
LCurveParamsEdited labCurve;
RGBCurvesParamsEdited rgbCurves;
ColorToningEdited colorToning;
- DehazParamsEdited dehaz;
+ RetinexParamsEdited retinex;
SharpeningParamsEdited sharpening;
SharpeningParamsEdited prsharpening;
SharpenEdgeParamsEdited sharpenEdge;
diff --git a/rtgui/partialpastedlg.cc b/rtgui/partialpastedlg.cc
index 78dfd6803..046a9ccab 100644
--- a/rtgui/partialpastedlg.cc
+++ b/rtgui/partialpastedlg.cc
@@ -52,7 +52,7 @@ PartialPasteDlg::PartialPasteDlg (Glib::ustring title)
exposure = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_EXPOSURE")));
sh = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_SHADOWSHIGHLIGHTS")));
epd = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_EPD")));
- dehaz = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_DEHAZ")));
+ retinex = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_RETINEX")));
pcvignette = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_PCVIGNETTE")));
gradient = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_GRADIENT")));
labcurve = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_LABCURVE")));
@@ -142,7 +142,7 @@ PartialPasteDlg::PartialPasteDlg (Glib::ustring title)
vboxes[0]->pack_start (*exposure, Gtk::PACK_SHRINK, 2);
vboxes[0]->pack_start (*sh, Gtk::PACK_SHRINK, 2);
vboxes[0]->pack_start (*epd, Gtk::PACK_SHRINK, 2);
- vboxes[0]->pack_start (*dehaz, Gtk::PACK_SHRINK, 2);
+ vboxes[0]->pack_start (*retinex, Gtk::PACK_SHRINK, 2);
vboxes[0]->pack_start (*pcvignette, Gtk::PACK_SHRINK, 2);
vboxes[0]->pack_start (*gradient, Gtk::PACK_SHRINK, 2);
vboxes[0]->pack_start (*labcurve, Gtk::PACK_SHRINK, 2);
@@ -296,7 +296,7 @@ PartialPasteDlg::PartialPasteDlg (Glib::ustring title)
exposureConn = exposure->signal_toggled().connect (sigc::bind (sigc::mem_fun(*basic, &Gtk::CheckButton::set_inconsistent), true));
shConn = sh->signal_toggled().connect (sigc::bind (sigc::mem_fun(*basic, &Gtk::CheckButton::set_inconsistent), true));
epdConn = epd->signal_toggled().connect (sigc::bind (sigc::mem_fun(*basic, &Gtk::CheckButton::set_inconsistent), true));
- dehazConn = dehaz->signal_toggled().connect (sigc::bind (sigc::mem_fun(*basic, &Gtk::CheckButton::set_inconsistent), true));
+ retinexConn = retinex->signal_toggled().connect (sigc::bind (sigc::mem_fun(*basic, &Gtk::CheckButton::set_inconsistent), true));
pcvignetteConn = pcvignette->signal_toggled().connect (sigc::bind (sigc::mem_fun(*basic, &Gtk::CheckButton::set_inconsistent), true));
gradientConn = gradient->signal_toggled().connect (sigc::bind (sigc::mem_fun(*basic, &Gtk::CheckButton::set_inconsistent), true));
labcurveConn = labcurve->signal_toggled().connect (sigc::bind (sigc::mem_fun(*basic, &Gtk::CheckButton::set_inconsistent), true));
diff --git a/rtgui/partialpastedlg.h b/rtgui/partialpastedlg.h
index ffa748040..57a235f35 100644
--- a/rtgui/partialpastedlg.h
+++ b/rtgui/partialpastedlg.h
@@ -46,7 +46,7 @@ public:
Gtk::CheckButton* exposure;
Gtk::CheckButton* sh;
Gtk::CheckButton* epd;
- Gtk::CheckButton* dehaz;
+ Gtk::CheckButton* retinex;
Gtk::CheckButton* pcvignette;
Gtk::CheckButton* gradient;
Gtk::CheckButton* labcurve;
@@ -124,7 +124,7 @@ public:
sigc::connection everythingConn, basicConn, detailConn, colorConn, lensConn, compositionConn, metaConn, rawConn, wavConn;
sigc::connection wbConn, exposureConn, shConn, pcvignetteConn, gradientConn, labcurveConn, colorappearanceConn;
- sigc::connection sharpenConn, gradsharpenConn, microcontrastConn, impdenConn, dirpyrdenConn, defringeConn, epdConn, dirpyreqConn, waveletConn, dehazConn;
+ sigc::connection sharpenConn, gradsharpenConn, microcontrastConn, impdenConn, dirpyrdenConn, defringeConn, epdConn, dirpyreqConn, waveletConn, retinexConn;
sigc::connection vibranceConn, chmixerConn, hsveqConn, rgbcurvesConn, chmixerbwConn, colortoningConn, filmSimulationConn;
sigc::connection distortionConn, cacorrConn, vignettingConn, lcpConn;
sigc::connection coarserotConn, finerotConn, cropConn, resizeConn, perspectiveConn, commonTransConn;
diff --git a/rtgui/preferences.cc b/rtgui/preferences.cc
index afc5dd6b8..47a641634 100644
--- a/rtgui/preferences.cc
+++ b/rtgui/preferences.cc
@@ -171,14 +171,14 @@ Gtk::Widget* Preferences::getBatchProcPanel ()
appendBehavList (mi, M("TP_EXPOSURE_SATURATION"), ADDSET_TC_SATURATION, false);
mi = behModel->append ();
- mi->set_value (behavColumns.label, M("TP_DEHAZ_LABEL"));
- appendBehavList (mi, M("TP_DEHAZ_STR"), ADDSET_DH_STR, false);
- appendBehavList (mi, M("TP_DEHAZ_NEIGH"), ADDSET_DH_NEIGH, false);
- appendBehavList (mi, M("TP_DEHAZ_SCAL"), ADDSET_DH_SCAL, false);
- appendBehavList (mi, M("TP_DEHAZ_GAIN"), ADDSET_DH_GAIN, false);
- appendBehavList (mi, M("TP_DEHAZ_OFFS"), ADDSET_DH_OFFS, false);
- appendBehavList (mi, M("TP_DEHAZ_LIMD"), ADDSET_DH_LIMD, false);
- appendBehavList (mi, M("TP_DEHAZ_VART"), ADDSET_DH_VART, false);
+ mi->set_value (behavColumns.label, M("TP_RETINEX_LABEL"));
+ appendBehavList (mi, M("TP_RETINEX_STRENGTH"), ADDSET_DH_STR, false);
+ appendBehavList (mi, M("TP_RETINEX_NEIGH"), ADDSET_DH_NEIGH, false);
+ appendBehavList (mi, M("TP_RETINEX_SCAL"), ADDSET_DH_SCAL, false);
+ appendBehavList (mi, M("TP_RETINEX_GAIN"), ADDSET_DH_GAIN, false);
+ appendBehavList (mi, M("TP_RETINEX_OFFS"), ADDSET_DH_OFFS, false);
+ appendBehavList (mi, M("TP_RETINEX_LIMD"), ADDSET_DH_LIMD, false);
+ appendBehavList (mi, M("TP_RETINEX_VART"), ADDSET_DH_VART, false);
mi = behModel->append ();
mi->set_value (behavColumns.label, M("TP_SHADOWSHLIGHTS_LABEL"));
diff --git a/rtgui/retinex.cc b/rtgui/retinex.cc
new file mode 100644
index 000000000..f15f7d276
--- /dev/null
+++ b/rtgui/retinex.cc
@@ -0,0 +1,622 @@
+/*
+ * This file is part of RawTherapee.
+ */
+#include "retinex.h"
+#include "mycurve.h"
+
+using namespace rtengine;
+using namespace rtengine::procparams;
+
+Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"), false, true)
+{
+ CurveListener::setMulti(true);
+ std::vector milestones;
+ nextmin = 0.;
+ nextmax = 0.;
+ nextminiT = 0.;
+ nextmaxiT = 0.;
+ nextmeanT = 0.;
+ nextsigma = 0.;
+ nextminT = 0.;
+ nextmaxT = 0.;
+
+ Gtk::VBox * retinexVBox = Gtk::manage ( new Gtk::VBox());
+ retinexVBox->set_border_width(4);
+ retinexVBox->set_spacing(2);
+
+ Gtk::VBox * settingsVBox = Gtk::manage ( new Gtk::VBox());
+ settingsVBox->set_border_width(4);
+ settingsVBox->set_spacing(2);
+
+ dhbox = Gtk::manage (new Gtk::HBox ());
+ labmdh = Gtk::manage (new Gtk::Label (M("TP_RETINEX_METHOD") + ":"));
+ dhbox->pack_start (*labmdh, Gtk::PACK_SHRINK, 1);
+
+ retinexMethod = Gtk::manage (new MyComboBoxText ());
+ retinexMethod->append_text (M("TP_RETINEX_LOW"));
+ retinexMethod->append_text (M("TP_RETINEX_UNIFORM"));
+ retinexMethod->append_text (M("TP_RETINEX_HIGH"));
+ retinexMethod->set_active(0);
+ retinexMethodConn = retinexMethod->signal_changed().connect ( sigc::mem_fun(*this, &Retinex::retinexMethodChanged) );
+ retinexMethod->set_tooltip_markup (M("TP_RETINEX_METHOD_TOOLTIP"));
+
+ retinexcolorspace = Gtk::manage (new MyComboBoxText ());
+ retinexcolorspace->append_text (M("TP_RETINEX_LABSPACE"));
+ retinexcolorspace->append_text (M("TP_RETINEX_HSLSPACE_LOG"));
+ retinexcolorspace->append_text (M("TP_RETINEX_HSLSPACE_LIN"));
+ retinexcolorspace->set_active(0);
+ retinexColorSpaceConn = retinexcolorspace->signal_changed().connect ( sigc::mem_fun(*this, &Retinex::retinexColorSpaceChanged) );
+
+
+ dhbox->pack_start(*retinexMethod);
+ dhbox->pack_start(*retinexcolorspace);
+ retinexVBox->pack_start(*dhbox);
+ std::vector defaultCurve;
+
+ curveEditorGD = new CurveEditorGroup (options.lastRetinexDir, M("TP_RETINEX_CONTEDIT_LAB"));
+ curveEditorGD->setCurveListener (this);
+ rtengine::RetinexParams::getDefaultCDCurve(defaultCurve);
+ cdshape = static_cast(curveEditorGD->addCurve(CT_Diagonal, M("TP_RETINEX_CURVEEDITOR_CD")));
+ cdshape->setResetCurve(DiagonalCurveType(defaultCurve.at(0)), defaultCurve);
+ cdshape->setTooltip(M("TP_RETINEX_CURVEEDITOR_CD_TOOLTIP"));
+ std::vector milestones22;
+
+ milestones22.push_back( GradientMilestone(0., 0., 0., 0.) );
+ milestones22.push_back( GradientMilestone(1., 1., 1., 1.) );
+ cdshape->setBottomBarBgGradient(milestones22);
+ cdshape->setLeftBarBgGradient(milestones22);
+
+ curveEditorGD->curveListComplete();
+
+ curveEditorGDH = new CurveEditorGroup (options.lastRetinexDir, M("TP_RETINEX_CONTEDIT_HSL"));
+ curveEditorGDH->setCurveListener (this);
+ rtengine::RetinexParams::getDefaultCDHCurve(defaultCurve);
+ cdshapeH = static_cast(curveEditorGDH->addCurve(CT_Diagonal, M("TP_RETINEX_CURVEEDITOR_CD")));
+ cdshapeH->setResetCurve(DiagonalCurveType(defaultCurve.at(0)), defaultCurve);
+ cdshapeH->setTooltip(M("TP_RETINEX_CURVEEDITOR_CD_TOOLTIP"));
+ std::vector milestones22H;
+
+ milestones22H.push_back( GradientMilestone(0., 0., 0., 0.) );
+ milestones22H.push_back( GradientMilestone(1., 1., 1., 1.) );
+ cdshapeH->setBottomBarBgGradient(milestones22H);
+ cdshapeH->setLeftBarBgGradient(milestones22H);
+
+ curveEditorGDH->curveListComplete();
+
+
+ transmissionCurveEditorG = new CurveEditorGroup (options.lastRetinexDir, M("TP_RETINEX_TRANSMISSION"));
+ transmissionCurveEditorG->setCurveListener (this);
+
+ rtengine::RetinexParams::getDefaulttransmissionCurve(defaultCurve);
+ transmissionShape = static_cast(transmissionCurveEditorG->addCurve(CT_Flat, "", NULL, false));
+ transmissionShape->setIdentityValue(0.);
+ transmissionShape->setResetCurve(FlatCurveType(defaultCurve.at(0)), defaultCurve);
+ transmissionShape->setBottomBarBgGradient(milestones);
+ transmissionCurveEditorG->set_tooltip_markup (M("TP_RETINEX_TRANSMISSION_TOOLTIP"));
+
+ transmissionCurveEditorG->curveListComplete();
+
+
+
+ str = Gtk::manage (new Adjuster (M("TP_RETINEX_STRENGTH"), 0, 100., 1., 20.));
+ neigh = Gtk::manage (new Adjuster (M("TP_RETINEX_NEIGHBOR"), 6, 100., 1., 80.));
+
+ expsettings = new MyExpander (false, M("TP_RETINEX_SETTINGS"));
+ expsettings->signal_button_release_event().connect_notify( sigc::bind( sigc::mem_fun(this, &Retinex::foldAllButMe), expsettings) );
+
+ retinexVBox->pack_start (*str);
+ str->show ();
+
+ retinexVBox->pack_start (*neigh);
+ neigh->show ();
+
+ mMLabels = Gtk::manage(new Gtk::Label("---", Gtk::ALIGN_CENTER));
+ mMLabels->set_tooltip_markup (M("TP_RETINEX_MLABEL_TOOLTIP"));
+
+ transLabels = Gtk::manage(new Gtk::Label("---", Gtk::ALIGN_CENTER));
+ transLabels->set_tooltip_markup (M("TP_RETINEX_TLABEL_TOOLTIP"));
+
+ scal = Gtk::manage (new Adjuster (M("TP_RETINEX_SCALES"), 1, 8., 1., 3.));
+ gain = Gtk::manage (new Adjuster (M("TP_RETINEX_GAIN"), 20, 200, 1, 50));
+ offs = Gtk::manage (new Adjuster (M("TP_RETINEX_OFFSET"), -10000, 10000, 1, 0));
+ vart = Gtk::manage (new Adjuster (M("TP_RETINEX_VARIANCE"), 50, 500, 1, 125));
+ limd = Gtk::manage (new Adjuster (M("TP_RETINEX_THRESHOLD"), 2, 100, 1, 8));
+ gain->set_tooltip_markup (M("TP_RETINEX_GAIN_TOOLTIP"));
+ scal->set_tooltip_markup (M("TP_RETINEX_SCALES_TOOLTIP"));
+ vart->set_tooltip_markup (M("TP_RETINEX_VARIANCE_TOOLTIP"));
+ limd->set_tooltip_markup (M("TP_RETINEX_THRESHOLD_TOOLTIP"));
+
+ medianmap = Gtk::manage (new Gtk::CheckButton (M("TP_RETINEX_MEDIAN")));
+ medianmap->set_active (true);
+ medianmapConn = medianmap->signal_toggled().connect( sigc::mem_fun(*this, &Retinex::medianmapChanged) );
+
+ settingsVBox->pack_start (*mMLabels);
+ mMLabels->show ();
+
+ settingsVBox->pack_start (*transLabels);
+ transLabels->show ();
+
+ settingsVBox->pack_start (*curveEditorGD, Gtk::PACK_SHRINK, 4);
+ curveEditorGD->show();
+
+ settingsVBox->pack_start (*curveEditorGDH, Gtk::PACK_SHRINK, 4);
+ curveEditorGDH->show();
+
+ settingsVBox->pack_start (*scal);
+ scal->show ();
+
+ settingsVBox->pack_start (*gain);
+ gain->show ();
+
+ settingsVBox->pack_start (*offs);
+ offs->show ();
+
+ settingsVBox->pack_start (*vart);
+ vart->show ();
+
+ settingsVBox->pack_start (*limd);
+ limd->show ();
+
+ settingsVBox->pack_start( *transmissionCurveEditorG, Gtk::PACK_SHRINK, 2);
+ transmissionCurveEditorG->show();
+
+ settingsVBox->pack_start (*medianmap);
+ medianmap->show ();
+
+ expsettings->add(*settingsVBox);
+
+ str->setAdjusterListener (this);
+ scal->setAdjusterListener (this);
+ neigh->setAdjusterListener (this);
+ gain->setAdjusterListener (this);
+ offs->setAdjusterListener (this);
+ vart->setAdjusterListener (this);
+ limd->setAdjusterListener (this);
+ pack_start (*retinexVBox);
+ pack_start (*expsettings);
+
+ disableListener();
+ retinexColorSpaceChanged();
+ medianmapChanged();
+ enableListener();
+
+}
+
+Retinex::~Retinex()
+{
+ delete curveEditorGD;
+ delete curveEditorGDH;
+ delete transmissionCurveEditorG;
+
+}
+
+void Retinex::foldAllButMe (GdkEventButton* event, MyExpander *expander)
+{
+ if (event->button == 3) {
+ expsettings->set_expanded(expsettings == expander);
+ }
+}
+
+void Retinex::writeOptions(std::vector &tpOpen)
+{
+ tpOpen.push_back (expsettings->get_expanded ());
+}
+
+void Retinex::updateToolState(std::vector &tpOpen)
+{
+ if(tpOpen.size() == 9) {
+ expsettings->set_expanded(tpOpen.at(0));
+ }
+}
+
+
+
+
+
+int minmaxChangedUI (void* data)
+{
+ GThreadLock lock; // All GUI access from idle_add callbacks or separate thread HAVE to be protected
+ (static_cast(data))->minmaxComputed_ ();
+ return 0;
+}
+
+void Retinex::minmaxChanged (double cdma, double cdmin, double mini, double maxi, double Tmean, double Tsigma, double Tmin, double Tmax)
+{
+ nextmin = cdmin;
+ nextmax = cdma;
+ nextminiT = mini;
+ nextmaxiT = maxi;
+ nextmeanT = Tmean;
+ nextsigma = Tsigma;
+ nextminT = Tmin;
+ nextmaxT = Tmax;
+ g_idle_add (minmaxChangedUI, this);
+
+}
+
+bool Retinex::minmaxComputed_ ()
+{
+
+ disableListener ();
+ enableListener ();
+ updateLabel ();
+ updateTrans ();
+ return false;
+
+}
+void Retinex::updateLabel ()
+{
+ if (!batchMode) {
+ float nX, nY;
+ nX = nextmin;
+ nY = nextmax;
+ {
+ mMLabels->set_text(
+ Glib::ustring::compose(M("TP_RETINEX_MLABEL"),
+ Glib::ustring::format(std::fixed, std::setprecision(0), nX),
+ Glib::ustring::format(std::fixed, std::setprecision(0), nY))
+ );
+ }
+ }
+}
+
+void Retinex::updateTrans ()
+{
+ if (!batchMode) {
+ float nm, nM, nZ, nA, nB, nS;
+ nm = nextminiT;
+ nM = nextmaxiT;
+ nZ = nextmeanT;
+ nA = nextminT;
+ nB = nextmaxT;
+ nS = nextsigma;
+ {
+ transLabels->set_text(
+ Glib::ustring::compose(M("TP_RETINEX_TLABEL"),
+ Glib::ustring::format(std::fixed, std::setprecision(1), nm),
+ Glib::ustring::format(std::fixed, std::setprecision(1), nM),
+ Glib::ustring::format(std::fixed, std::setprecision(1), nZ),
+ Glib::ustring::format(std::fixed, std::setprecision(1), nS),
+ Glib::ustring::format(std::fixed, std::setprecision(1), nA),
+ Glib::ustring::format(std::fixed, std::setprecision(1), nB))
+ );
+ }
+ }
+}
+
+
+
+void Retinex::read (const ProcParams* pp, const ParamsEdited* pedited)
+{
+ disableListener ();
+ retinexMethodConn.block(true);
+ retinexColorSpaceConn.block(true);
+
+
+ if (pedited) {
+ scal->setEditedState (pedited->retinex.scal ? Edited : UnEdited);
+ neigh->setEditedState (pedited->retinex.neigh ? Edited : UnEdited);
+ gain->setEditedState (pedited->retinex.gain ? Edited : UnEdited);
+ offs->setEditedState (pedited->retinex.offs ? Edited : UnEdited);
+ vart->setEditedState (pedited->retinex.vart ? Edited : UnEdited);
+ limd->setEditedState (pedited->retinex.limd ? Edited : UnEdited);
+ set_inconsistent (multiImage && !pedited->retinex.enabled);
+ medianmap->set_inconsistent (!pedited->retinex.medianmap);
+
+
+ if (!pedited->retinex.retinexMethod) {
+ retinexMethod->set_active_text(M("GENERAL_UNCHANGED"));
+ }
+
+ if (!pedited->retinex.retinexcolorspace) {
+ retinexcolorspace->set_active_text(M("GENERAL_UNCHANGED"));
+ }
+
+ cdshape->setUnChanged (!pedited->retinex.cdcurve);
+ cdshapeH->setUnChanged (!pedited->retinex.cdHcurve);
+ transmissionShape->setUnChanged (!pedited->retinex.transmissionCurve);
+
+ }
+
+ neigh->setValue (pp->retinex.neigh);
+ gain->setValue (pp->retinex.gain);
+ offs->setValue (pp->retinex.offs);
+ str->setValue (pp->retinex.str);
+ scal->setValue (pp->retinex.scal);
+ vart->setValue (pp->retinex.vart);
+ limd->setValue (pp->retinex.limd);
+
+ setEnabled (pp->retinex.enabled);
+
+ medianmapConn.block (true);
+ medianmap->set_active (pp->retinex.medianmap);
+ medianmapConn.block (false);
+ lastmedianmap = pp->retinex.medianmap;
+
+ if (pp->retinex.retinexMethod == "low") {
+ retinexMethod->set_active (0);
+ } else if (pp->retinex.retinexMethod == "uni") {
+ retinexMethod->set_active (1);
+ } else if (pp->retinex.retinexMethod == "high") {
+ retinexMethod->set_active (2);
+ }
+
+
+ if (pp->retinex.retinexcolorspace == "Lab") {
+ retinexcolorspace->set_active (0);
+ } else if (pp->retinex.retinexcolorspace == "HSLLOG") {
+ retinexcolorspace->set_active (1);
+ } else if (pp->retinex.retinexcolorspace == "HSLLIN") {
+ retinexcolorspace->set_active (2);
+ }
+
+ retinexMethodChanged ();
+ retinexColorSpaceChanged();
+
+ medianmapConn.block(true);
+ medianmapChanged ();
+ medianmapConn.block(false);
+
+ cdshape->setCurve (pp->retinex.cdcurve);
+ cdshapeH->setCurve (pp->retinex.cdHcurve);
+
+ retinexMethodConn.block(false);
+ retinexColorSpaceConn.block(false);
+ transmissionShape->setCurve (pp->retinex.transmissionCurve);
+
+
+ enableListener ();
+}
+
+
+
+void Retinex::write (ProcParams* pp, ParamsEdited* pedited)
+{
+
+ pp->retinex.str = str->getValue ();
+ pp->retinex.scal = (int)scal->getValue ();
+ pp->retinex.neigh = neigh->getValue ();
+ pp->retinex.gain = (int)gain->getValue ();
+ pp->retinex.offs = (int)offs->getValue ();
+ pp->retinex.vart = (int)vart->getValue ();
+ pp->retinex.limd = (int)limd->getValue ();
+ pp->retinex.cdcurve = cdshape->getCurve ();
+ pp->retinex.cdHcurve = cdshapeH->getCurve ();
+ pp->retinex.transmissionCurve = transmissionShape->getCurve ();
+ pp->retinex.enabled = getEnabled();
+ pp->retinex.medianmap = medianmap->get_active();
+
+ if (pedited) {
+ pedited->retinex.retinexMethod = retinexMethod->get_active_text() != M("GENERAL_UNCHANGED");
+ pedited->retinex.retinexcolorspace = retinexcolorspace->get_active_text() != M("GENERAL_UNCHANGED");
+
+ //%%%%%%%%%%%%%%%%%%%%%%
+ pedited->retinex.str = str->getEditedState ();
+ pedited->retinex.scal = scal->getEditedState ();
+ pedited->retinex.neigh = neigh->getEditedState ();
+ pedited->retinex.gain = gain->getEditedState ();
+ pedited->retinex.offs = offs->getEditedState ();
+ pedited->retinex.vart = vart->getEditedState ();
+ pedited->retinex.limd = limd->getEditedState ();
+ pedited->retinex.cdcurve = !cdshape->isUnChanged ();
+ pedited->retinex.cdHcurve = !cdshapeH->isUnChanged ();
+ pedited->retinex.transmissionCurve = !transmissionShape->isUnChanged ();
+ pedited->retinex.enabled = !get_inconsistent();
+ pedited->retinex.medianmap = !medianmap->get_inconsistent();
+
+ }
+
+ if (retinexMethod->get_active_row_number() == 0) {
+ pp->retinex.retinexMethod = "low";
+ } else if (retinexMethod->get_active_row_number() == 1) {
+ pp->retinex.retinexMethod = "uni";
+ } else if (retinexMethod->get_active_row_number() == 2) {
+ pp->retinex.retinexMethod = "high";
+ }
+
+ if (retinexcolorspace->get_active_row_number() == 0) {
+ pp->retinex.retinexcolorspace = "Lab";
+ } else if (retinexcolorspace->get_active_row_number() == 1) {
+ pp->retinex.retinexcolorspace = "HSLLOG";
+ } else if (retinexcolorspace->get_active_row_number() == 2) {
+ pp->retinex.retinexcolorspace = "HSLLIN";
+ }
+}
+
+void Retinex::retinexMethodChanged()
+{
+ if (listener) {
+ listener->panelChanged (EvretinexMethod, retinexMethod->get_active_text ());
+ }
+}
+
+void Retinex::ColorSpaceUpdateUI ()
+{
+ if (!batchMode) {
+ if(retinexcolorspace->get_active_row_number() == 0) {
+ curveEditorGD->show();
+ curveEditorGDH->hide();
+ } else if(retinexcolorspace->get_active_row_number() == 1) {
+ curveEditorGD->hide();
+ curveEditorGDH->show();
+ }
+ }
+}
+
+
+void Retinex::retinexColorSpaceChanged()
+{
+
+ ColorSpaceUpdateUI();
+
+ if (listener) {
+ listener->panelChanged (EvretinexColorSpace, retinexcolorspace->get_active_text ());
+ }
+}
+
+void Retinex::medianmapChanged ()
+{
+ if (batchMode) {
+ if (medianmap->get_inconsistent()) {
+ medianmap->set_inconsistent (false);
+ medianmapConn.block (true);
+ medianmap->set_active (false);
+ medianmapConn.block (false);
+ } else if (lastmedianmap) {
+ medianmap->set_inconsistent (true);
+ }
+
+ lastmedianmap = medianmap->get_active ();
+ }
+
+ if (listener) {
+ if (medianmap->get_active()) {
+ if (getEnabled()) {
+ listener->panelChanged (EvRetinexmedianmap, M("GENERAL_ENABLED"));
+ }
+ } else {
+ if (getEnabled()) {
+ listener->panelChanged (EvRetinexmedianmap, M("GENERAL_DISABLED"));
+ }
+ }
+
+ }
+}
+
+
+void Retinex::setDefaults (const ProcParams* defParams, const ParamsEdited* pedited)
+{
+
+ neigh->setDefault (defParams->retinex.neigh);
+ gain->setDefault (defParams->retinex.gain);
+ offs->setDefault (defParams->retinex.offs);
+ str->setDefault (defParams->retinex.str);
+ scal->setDefault (defParams->retinex.scal);
+ vart->setDefault (defParams->retinex.vart);
+ limd->setDefault (defParams->retinex.limd);
+
+ if (pedited) {
+ neigh->setDefaultEditedState (pedited->retinex.neigh ? Edited : UnEdited);
+ gain->setDefaultEditedState (pedited->retinex.gain ? Edited : UnEdited);
+ offs->setDefaultEditedState (pedited->retinex.offs ? Edited : UnEdited);
+ str->setDefaultEditedState (pedited->retinex.str ? Edited : UnEdited);
+ scal->setDefaultEditedState (pedited->retinex.scal ? Edited : UnEdited);
+ vart->setDefaultEditedState (pedited->retinex.vart ? Edited : UnEdited);
+ limd->setDefaultEditedState (pedited->retinex.limd ? Edited : UnEdited);
+
+ } else {
+ neigh->setDefaultEditedState (Irrelevant);
+ gain->setDefaultEditedState (Irrelevant);
+ offs->setDefaultEditedState (Irrelevant);
+ vart->setDefaultEditedState (Irrelevant);
+ limd->setDefaultEditedState (Irrelevant);
+ str->setDefaultEditedState (Irrelevant);
+ scal->setDefaultEditedState (Irrelevant);
+ }
+}
+
+void Retinex::setAdjusterBehavior (bool strAdd, bool neighAdd, bool scalAdd, bool limdAdd, bool gainAdd, bool offsAdd, bool vartAdd)
+ {
+
+ str->setAddMode(strAdd);
+ neigh->setAddMode(neighAdd);
+ scal->setAddMode(scalAdd);
+ limd->setAddMode(limdAdd);
+ gain->setAddMode(gainAdd);
+ offs->setAddMode(offsAdd);
+ vart->setAddMode(vartAdd);
+ }
+
+
+void Retinex::adjusterChanged (Adjuster* a, double newval)
+{
+
+ if (!listener || !getEnabled()) {
+ return;
+ }
+
+ if (a == neigh) {
+ listener->panelChanged (EvLneigh, neigh->getTextValue());
+ } else if (a == str) {
+ listener->panelChanged (EvLstr, str->getTextValue());
+ } else if (a == scal) {
+ listener->panelChanged (EvLscal, scal->getTextValue());
+ } else if (a == gain) {
+ listener->panelChanged (EvLgain, gain->getTextValue());
+ } else if (a == offs) {
+ listener->panelChanged (EvLoffs, offs->getTextValue());
+ } else if (a == vart) {
+ listener->panelChanged (EvLvart, vart->getTextValue());
+ } else if (a == limd) {
+ listener->panelChanged (EvLlimd, limd->getTextValue());
+ }
+
+}
+
+
+
+void Retinex::autoOpenCurve ()
+{
+ cdshape->openIfNonlinear();
+ cdshapeH->openIfNonlinear();
+ transmissionShape->openIfNonlinear();
+
+}
+
+
+void Retinex::curveChanged (CurveEditor* ce)
+{
+ if (listener && getEnabled()) {
+ if (ce == cdshape) {
+ listener->panelChanged (EvLCDCurve, M("HISTORY_CUSTOMCURVE"));
+ } else if (ce == cdshapeH) {
+ listener->panelChanged (EvLCDHCurve, M("HISTORY_CUSTOMCURVE"));
+ } else if (ce == transmissionShape) {
+ listener->panelChanged (EvRetinextransmission, M("HISTORY_CUSTOMCURVE"));
+ }
+ }
+}
+
+void Retinex::enabledChanged ()
+{
+
+ if (listener) {
+ if (get_inconsistent()) {
+ listener->panelChanged (EvRetinexEnabled, M("GENERAL_UNCHANGED"));
+ } else if (getEnabled()) {
+ listener->panelChanged (EvRetinexEnabled, M("GENERAL_ENABLED"));
+ } else {
+ listener->panelChanged (EvRetinexEnabled, M("GENERAL_DISABLED"));
+ }
+ }
+}
+
+
+void Retinex::trimValues (rtengine::procparams::ProcParams* pp)
+{
+ str->trimValue(pp->retinex.str);
+ scal->trimValue(pp->retinex.scal);
+ neigh->trimValue(pp->retinex.neigh);
+ gain->trimValue(pp->retinex.gain);
+ offs->trimValue(pp->retinex.offs);
+ vart->trimValue(pp->retinex.vart);
+ limd->trimValue(pp->retinex.limd);
+
+}
+
+void Retinex::setBatchMode (bool batchMode)
+{
+ ToolPanel::setBatchMode (batchMode);
+ neigh->showEditedCB ();
+ gain->showEditedCB ();
+ offs->showEditedCB ();
+ str->showEditedCB ();
+ scal->showEditedCB ();
+ vart->showEditedCB ();
+ limd->showEditedCB ();
+ curveEditorGD->setBatchMode (batchMode);
+ curveEditorGDH->setBatchMode (batchMode);
+ transmissionCurveEditorG->setBatchMode (batchMode);
+
+
+}
diff --git a/rtgui/dehaz.h b/rtgui/retinex.h
similarity index 77%
rename from rtgui/dehaz.h
rename to rtgui/retinex.h
index 13de88b1b..d2c71e083 100644
--- a/rtgui/dehaz.h
+++ b/rtgui/retinex.h
@@ -1,8 +1,8 @@
/*
* This file is part of RawTherapee.
*/
-#ifndef _DEHAZ_H_
-#define _DEHAZ_H_
+#ifndef _RETINEX_H_
+#define _RETINEX_H_
#include
#include "adjuster.h"
@@ -13,7 +13,7 @@
#include "thresholdadjuster.h"
#include "colorprovider.h"
-class Dehaz : public ToolParamBlock, public FoldableToolPanel, public rtengine::DehazListener, public CurveListener,
+class Retinex : public ToolParamBlock, public FoldableToolPanel, public rtengine::RetinexListener, public CurveListener,
public AdjusterListener
{
@@ -28,14 +28,12 @@ protected:
Adjuster* offs;
Adjuster* vart;
Adjuster* limd;
- MyExpander* expretinex;
+ MyExpander* expsettings;
Gtk::Label* labmdh;
Gtk::HBox* dhbox;
- MyComboBoxText* dehazmet;
- MyComboBoxText* dehazcolorspace;
- Gtk::CheckButton* retinex;
- Gtk::Frame* dehazFrame;
+ MyComboBoxText* retinexMethod;
+ MyComboBoxText* retinexcolorspace;
Gtk::CheckButton* medianmap;
double nextmin;
double nextmax;
@@ -52,15 +50,15 @@ protected:
DiagonalCurveEditor* cdshape;
DiagonalCurveEditor* cdshapeH;
CurveEditorGroup* transmissionCurveEditorG;
- sigc::connection dehazmetConn;
- sigc::connection dehazColorSpaceConn;
+ sigc::connection retinexMethodConn;
+ sigc::connection retinexColorSpaceConn;
FlatCurveEditor* transmissionShape;
- bool lastretinex, lastmedianmap;
- sigc::connection retinexConn, medianmapConn;
+ bool lastmedianmap;
+ sigc::connection medianmapConn;
public:
- Dehaz ();
- ~Dehaz ();
+ Retinex ();
+ ~Retinex ();
void read (const rtengine::procparams::ProcParams* pp, const ParamsEdited* pedited = NULL);
void write (rtengine::procparams::ProcParams* pp, ParamsEdited* pedited = NULL);
@@ -69,7 +67,6 @@ public:
void trimValues (rtengine::procparams::ProcParams* pp);
void adjusterChanged (Adjuster* a, double newval);
void autoOpenCurve ();
- void retinexChanged ();
void medianmapChanged ();
void minmaxChanged (double cdma, double cdmin, double mini, double maxi, double Tmean, double Tsigma, double Tmin, double Tmax);
bool minmaxComputed_ ();
@@ -78,14 +75,13 @@ public:
void enabledChanged ();
void curveChanged (CurveEditor* ce);
- void dehazmetChanged();
- void dehazColorSpaceChanged();
- void retinexUpdateUI();
+ void retinexMethodChanged();
+ void retinexColorSpaceChanged();
void ColorSpaceUpdateUI();
void writeOptions (std::vector &tpOpen);
void updateToolState (std::vector &tpOpen);
void setAdjusterBehavior (bool strAdd, bool neighAdd, bool scalAdd, bool limdAdd, bool gainAdd, bool offsAdd, bool vartAdd);
-
+
private:
void foldAllButMe (GdkEventButton* event, MyExpander *expander);
diff --git a/rtgui/toolpanelcoord.cc b/rtgui/toolpanelcoord.cc
index 5d1615e03..b93f2e98a 100644
--- a/rtgui/toolpanelcoord.cc
+++ b/rtgui/toolpanelcoord.cc
@@ -59,7 +59,7 @@ ToolPanelCoordinator::ToolPanelCoordinator () : ipc(NULL)
colorappearance = Gtk::manage (new ColorAppearance ());
whitebalance = Gtk::manage (new WhiteBalance ());
vignetting = Gtk::manage (new Vignetting ());
- dehaz = Gtk::manage (new Dehaz ());
+ retinex = Gtk::manage (new Retinex ());
gradient = Gtk::manage (new Gradient ());
pcvignette = Gtk::manage (new PCVignette ());
perspective = Gtk::manage (new PerspCorrection ());
@@ -126,8 +126,8 @@ ToolPanelCoordinator::ToolPanelCoordinator () : ipc(NULL)
toolPanels.push_back (colortoning);
addPanel (exposurePanel, epd);
toolPanels.push_back (epd);
- addPanel (exposurePanel, dehaz);
- toolPanels.push_back (dehaz);
+ addPanel (exposurePanel, retinex);
+ toolPanels.push_back (retinex);
addPanel (exposurePanel, pcvignette);
toolPanels.push_back (pcvignette);
addPanel (exposurePanel, gradient);
@@ -478,7 +478,7 @@ void ToolPanelCoordinator::initImage (rtengine::StagedImageProcessor* ipc_, bool
ipc->setAutoColorTonListener (colortoning);
ipc->setAutoChromaListener (dirpyrdenoise);
ipc->setWaveletListener (wavelet);
- ipc->setDehazListener (dehaz);
+ ipc->setRetinexListener (retinex);
ipc->setSizeListener (crop);
ipc->setSizeListener (resize);
diff --git a/rtgui/toolpanelcoord.h b/rtgui/toolpanelcoord.h
index 868fad258..01717d903 100644
--- a/rtgui/toolpanelcoord.h
+++ b/rtgui/toolpanelcoord.h
@@ -51,7 +51,7 @@
#include "perspective.h"
#include "rotate.h"
#include "vignetting.h"
-#include "dehaz.h"
+#include "retinex.h"
#include "gradient.h"
#include "pcvignette.h"
#include "toolbar.h"
@@ -102,7 +102,7 @@ protected:
WhiteBalance* whitebalance;
Vignetting* vignetting;
Gradient* gradient;
- Dehaz* dehaz;
+ Retinex* retinex;
PCVignette* pcvignette;
LensGeometry* lensgeom;
LensProfilePanel* lensProf;