diff --git a/rtdata/languages/default b/rtdata/languages/default
index 492c7ba56..8f3903770 100644
--- a/rtdata/languages/default
+++ b/rtdata/languages/default
@@ -656,6 +656,7 @@ HISTORY_MSG_423;Retinex - slope
HISTORY_MSG_424;Retinex - HL threshold
HISTORY_MSG_425;Retinex - HL control red
HISTORY_MSG_426;Retinex - HL control GB
+HISTORY_MSG_427;Retinex - Hue equalizer
HISTORY_NEWSNAPSHOT;Add
HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: Alt-s
HISTORY_SNAPSHOTS;Snapshots
@@ -1564,6 +1565,9 @@ 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_CONTEDIT_LH;Hue equalizer
+TP_RETINEX_CURVEEDITOR_LH;Strength=f(H)
+TP_RETINEX_CURVEEDITOR_LH_TOOLTIP;Equalize strength in function of hue\nIf Reinex method='highlight' also acts on the chroma
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_GAM;Gamma retinex
@@ -1590,7 +1594,7 @@ 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\nHighLight: Try to remove magenta\nHighlight More: Try to remove magenta + RGB action.
+TP_RETINEX_METHOD_TOOLTIP;Low: Reinforce low light,\nUniform: Equalize action,\nHigh: Reinforce high light\nHighLight: Try to remove magenta
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
diff --git a/rtengine/ipretinex.cc b/rtengine/ipretinex.cc
index 0ebf3ee43..b74568a3d 100644
--- a/rtengine/ipretinex.cc
+++ b/rtengine/ipretinex.cc
@@ -204,7 +204,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, float **exLuminance, 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 RawImageSource::MSR(float** luminance, float** originalLuminance, float **exLuminance, 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");
@@ -228,6 +228,25 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, float **e
int moderetinex = 2; // default to 2 ( deh.retinexMethod == "high" )
float hig = ((float) deh.highl)/100.f;
bool higplus = false ;
+
+ FlatCurve* shcurve = NULL;//curve L=f(H)
+ bool lhutili = false;
+
+ if (deh.enabled) {
+ shcurve = new FlatCurve(deh.lhcurve);
+
+ if (!shcurve || shcurve->isIdentity()) {
+ if (shcurve) {
+ delete shcurve;
+ shcurve = NULL;
+ }
+ }
+ else {
+ lhutili = true;
+ }
+ }
+
+
if(deh.retinexMethod == "highliplus") higplus = true;
if (deh.retinexMethod == "uni") {
@@ -442,6 +461,9 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, float **e
maxCD = -9999999.f;
minCD = 9999999.f;
+
+
+
#ifdef _OPENMP
#pragma omp parallel
#endif
@@ -465,7 +487,17 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, float **e
cdmin = cd;
}
float str = strength;
- if(exLuminance[i][j] > 65535.f*hig && higplus) str *= hig;
+ if(lhutili) { // S=f(H)
+ {
+ float HH = exLuminance[i][j];
+ float valparam;
+ if(useHsl || useHslLin) valparam = float((shcurve->getVal(HH) - 0.5f));
+ else valparam = float((shcurve->getVal(Color::huelab_to_huehsv2(HH)) - 0.5f));
+ str *= (1.f + 2.f*valparam);
+ }
+ }
+
+ // if(exLuminance[i][j] > 65535.f*hig && higplus) str *= hig;
luminance[i][j] = clipretinex( cd, 0.f, 32768.f ) * str + (1.f - str) * originalLuminance[i][j];
}
@@ -483,6 +515,11 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, float **e
Tsigma = stddv;
Tmin = mintr;
Tmax = maxtr;
+
+ if (shcurve) {
+ delete shcurve;
+ }
+
}
}
diff --git a/rtengine/procevents.h b/rtengine/procevents.h
index 6b4a762af..04847c3fa 100644
--- a/rtengine/procevents.h
+++ b/rtengine/procevents.h
@@ -453,6 +453,7 @@ enum ProcEvent {
EvLhighl = 423,
EvLhighlig = 424,
EvLgrbl = 425,
+ EvRetinexlhcurve = 426,
NUMOFEVENTS
};
}
diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc
index 3ae96dca7..dee75f5c4 100644
--- a/rtengine/procparams.cc
+++ b/rtengine/procparams.cc
@@ -160,6 +160,9 @@ void RetinexParams::setDefaults()
cdcurve.push_back(DCT_Linear);
cdHcurve.clear();
cdHcurve.push_back(DCT_Linear);
+ lhcurve.clear();
+ lhcurve.push_back(DCT_Linear);
+
getDefaulttransmissionCurve(transmissionCurve);
}
@@ -1513,6 +1516,11 @@ int ProcParams::save (Glib::ustring fname, Glib::ustring fname2, bool fnameAbsol
keyFile.set_double_list("Retinex", "CDHCurve", cdHcurve);
}
+ if (!pedited || pedited->retinex.lhcurve) {
+ Glib::ArrayHandle lhcurve = retinex.lhcurve;
+ keyFile.set_double_list("Retinex", "LHCurve", lhcurve);
+ }
+
if (!pedited || pedited->retinex.transmissionCurve) {
Glib::ArrayHandle transmissionCurve = retinex.transmissionCurve;
keyFile.set_double_list("Retinex", "TransmissionCurve", transmissionCurve);
@@ -3931,6 +3939,14 @@ int ProcParams::load (Glib::ustring fname, ParamsEdited* pedited)
}
}
+ if (keyFile.has_key ("Retinex", "LHCurve")) {
+ retinex.lhcurve = keyFile.get_double_list ("Retinex", "LHCurve");
+
+ if (pedited) {
+ pedited->retinex.lhcurve = true;
+ }
+ }
+
if (keyFile.has_key ("Retinex", "TransmissionCurve")) {
retinex.transmissionCurve = keyFile.get_double_list ("Retinex", "TransmissionCurve");
@@ -7302,6 +7318,7 @@ bool ProcParams::operator== (const ProcParams& other)
&& toneCurve.method == other.toneCurve.method
&& retinex.cdcurve == other.retinex.cdcurve
&& retinex.cdHcurve == other.retinex.cdHcurve
+ && retinex.lhcurve == other.retinex.lhcurve
&& retinex.transmissionCurve == other.retinex.transmissionCurve
&& retinex.str == other.retinex.str
&& retinex.scal == other.retinex.scal
diff --git a/rtengine/procparams.h b/rtengine/procparams.h
index 8d70dfc5b..7c5172a83 100644
--- a/rtengine/procparams.h
+++ b/rtengine/procparams.h
@@ -271,6 +271,7 @@ public:
bool enabled;
std::vector cdcurve;
std::vector cdHcurve;
+ std::vector lhcurve;
std::vector transmissionCurve;
int str;
int scal;
diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc
index d965c12d7..607f0621c 100644
--- a/rtengine/rawimagesource.cc
+++ b/rtengine/rawimagesource.cc
@@ -1861,7 +1861,7 @@ gg=green[380][1630];
bb=blue[380][1630];
printf("rr2=%f gg2=%f bb2=%f \n",rr,gg,bb);
*/
-
+/*
if(retinexParams.highlig < 100 && retinexParams.retinexMethod == "highliplus") {//try to recover magenta...very difficult !
float hig = ((float)retinexParams.highlig)/100.f;
float higgb = ((float)retinexParams.grbl)/100.f;
@@ -1878,12 +1878,12 @@ if(retinexParams.highlig < 100 && retinexParams.retinexMethod == "highliplus") {
//empirical method to find highlight magenta with no conversion RGB and no white balance
//red = master Gr and Bl default higgb=0.5
- if(R_>65535.f*hig && G_ > 65535.f*higgb && B_ > 65535.f*higgb) conversionBuffer[3][i - border][j - border] = R_;
- else conversionBuffer[3][i - border][j - border] = 0.f;
+ // if(R_>65535.f*hig && G_ > 65535.f*higgb && B_ > 65535.f*higgb) conversionBuffer[3][i - border][j - border] = R_;
+ // else conversionBuffer[3][i - border][j - border] = 0.f;
}
}
}
-
+*/
if(retinexParams.gammaretinex != "none" && retinexParams.str != 0) {//gamma
#ifdef _OPENMP
#pragma omp parallel for
@@ -1936,6 +1936,7 @@ if(retinexParams.gammaretinex != "none" && retinexParams.str != 0) {//gamma
_mm_storeu_ps(&conversionBuffer[1][i - border][j - border], S);
L *= c32768;
_mm_storeu_ps(&conversionBuffer[2][i - border][j - border], L);
+ _mm_storeu_ps(&conversionBuffer[3][i - border][j - border], H);
if(lhist16RETI) {
for(int p = 0; p < 4; p++) {
@@ -2018,6 +2019,7 @@ if(retinexParams.gammaretinex != "none" && retinexParams.str != 0) {//gamma
conversionBuffer[0][i - border][j - border] = aa;
conversionBuffer[1][i - border][j - border] = bb;
conversionBuffer[2][i - border][j - border] = L;
+ conversionBuffer[3][i - border][j - border] = xatan2f(bb,aa);
// if(R_>40000.f && G_ > 30000.f && B_ > 30000.f) conversionBuffer[3][i - border][j - border] = R_;
// else conversionBuffer[3][i - border][j - border] = 0.f;
if(lhist16RETI) {
@@ -2118,6 +2120,25 @@ void RawImageSource::retinex(ColorManagementParams cmp, RetinexParams deh, ToneC
dLcurve.clear();
}
+ FlatCurve* chcurve = NULL;//curve c=f(H)
+ bool chutili = false;
+
+ if (deh.enabled && deh.retinexMethod == "highli") {
+ chcurve = new FlatCurve(deh.lhcurve);
+
+ if (!chcurve || chcurve->isIdentity()) {
+ if (chcurve) {
+ delete chcurve;
+ chcurve = NULL;
+ }
+ }
+ else {
+ chutili = true;
+ }
+ }
+
+
+
#ifdef _OPENMP
#pragma omp parallel
#endif
@@ -2174,10 +2195,30 @@ void RawImageSource::retinex(ColorManagementParams cmp, RetinexParams deh, ToneC
histLRETI[hi] += hist16RET[i];
}
}
-
MSR(LBuffer, conversionBuffer[2], conversionBuffer[3], WNew, HNew, deh, dehatransmissionCurve, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax);
if(useHsl) {
+ if(chutili) {
+#ifdef _OPENMP
+ #pragma omp parallel for
+#endif
+ for (int i = border; i < H - border; i++ ) {
+ int j = border;
+ for (; j < W - border; j++) {
+
+ float valp;
+ float chr;
+ // if(chutili) { // c=f(H)
+ {
+ valp = float((chcurve->getVal(conversionBuffer[3][i - border][j - border]) - 0.5f));
+
+ conversionBuffer[1][i - border][j - border] *= (1.f + 2.f*valp);
+ }
+ // }
+
+ }
+ }
+ }
#ifdef _OPENMP
#pragma omp parallel for
#endif
@@ -2223,6 +2264,14 @@ void RawImageSource::retinex(ColorManagementParams cmp, RetinexParams deh, ToneC
float Chprov1 = sqrt(SQR(conversionBuffer[0][i - border][j - border]) + SQR(conversionBuffer[1][i - border][j - border])) / 327.68f;
float HH = xatan2f(conversionBuffer[1][i - border][j - border], conversionBuffer[0][i - border][j - border]);
float2 sincosval;
+ float valp;
+ float chr;
+ if(chutili) { // c=f(H)
+ {
+ valp = float((chcurve->getVal(Color::huelab_to_huehsv2(HH)) - 0.5f));
+ Chprov1 *= (1.f + 2.f*valp);
+ }
+ }
sincosval = xsincosf(HH);
float R,G,B;
@@ -2242,7 +2291,8 @@ void RawImageSource::retinex(ColorManagementParams cmp, RetinexParams deh, ToneC
conversionBuffer[1][i - border][j - border] = 327.68f * Chprov1 * sincosval.x;
LBuffer[i - border][j - border] = Lprov1 * 327.68f;
}
- }
+ }
+
//end gamut control
#ifdef __SSE2__
vfloat wipv[3][3];
@@ -2286,6 +2336,10 @@ void RawImageSource::retinex(ColorManagementParams cmp, RetinexParams deh, ToneC
}
}
}
+ if (chcurve) {
+ delete chcurve;
+ }
+
if(deh.gammaretinex != "none" && deh.str !=0){//inverse gamma
#ifdef _OPENMP
#pragma omp parallel for
diff --git a/rtengine/rawimagesource.h b/rtengine/rawimagesource.h
index 10e17743f..17f17ebbb 100644
--- a/rtengine/rawimagesource.h
+++ b/rtengine/rawimagesource.h
@@ -230,7 +230,7 @@ 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, float **exLuminance, 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(float** luminance, float **originalLuminance, float **exLuminance, 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],
diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc
index f648f5b4c..82889c1a0 100644
--- a/rtengine/refreshmap.cc
+++ b/rtengine/refreshmap.cc
@@ -452,6 +452,7 @@ int refreshmap[rtengine::NUMOFEVENTS] = {
DEMOSAIC, // EvLslope
ALLNORAW, // EvLhighl
DEMOSAIC, // EvLhighlig
- DEMOSAIC // EvLgrbl
+ DEMOSAIC, // EvLgrbl
+ DEMOSAIC // EvRetinexlhcurve
};
diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc
index 9c5dfbabc..b53050b30 100644
--- a/rtgui/paramsedited.cc
+++ b/rtgui/paramsedited.cc
@@ -51,6 +51,7 @@ void ParamsEdited::set (bool v)
toneCurve.method = v;
retinex.cdcurve = v;
retinex.cdHcurve = v;
+ retinex.lhcurve = v;
retinex.retinexMethod = v;
retinex.retinexcolorspace = v;
retinex.gammaretinex = v;
@@ -527,6 +528,7 @@ void ParamsEdited::initFrom (const std::vector
toneCurve.method = toneCurve.method && p.toneCurve.method == other.toneCurve.method;
retinex.cdcurve = retinex.cdcurve && p.retinex.cdcurve == other.retinex.cdcurve;
retinex.cdHcurve = retinex.cdHcurve && p.retinex.cdHcurve == other.retinex.cdHcurve;
+ retinex.lhcurve = retinex.lhcurve && p.retinex.lhcurve == other.retinex.lhcurve;
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;
@@ -1048,6 +1050,10 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten
toEdit.retinex.cdHcurve = mods.retinex.cdHcurve;
}
+ if (retinex.lhcurve) {
+ toEdit.retinex.lhcurve = mods.retinex.lhcurve;
+ }
+
if (retinex.transmissionCurve) {
toEdit.retinex.transmissionCurve = mods.retinex.transmissionCurve;
}
diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h
index 16c4ed9f2..98c5d22ac 100644
--- a/rtgui/paramsedited.h
+++ b/rtgui/paramsedited.h
@@ -78,6 +78,7 @@ public:
bool transmissionCurve;
bool cdcurve;
bool cdHcurve;
+ bool lhcurve;
bool retinex;
bool medianmap;
bool isUnchanged() const;
diff --git a/rtgui/retinex.cc b/rtgui/retinex.cc
index c6aaf8702..10e15d16b 100644
--- a/rtgui/retinex.cc
+++ b/rtgui/retinex.cc
@@ -37,7 +37,7 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"),
retinexMethod->append_text (M("TP_RETINEX_UNIFORM"));
retinexMethod->append_text (M("TP_RETINEX_HIGH"));
retinexMethod->append_text (M("TP_RETINEX_HIGHLIG"));
- retinexMethod->append_text (M("TP_RETINEX_HIGHLIGPLUS"));
+// retinexMethod->append_text (M("TP_RETINEX_HIGHLIGPLUS"));
retinexMethod->set_active(0);
retinexMethodConn = retinexMethod->signal_changed().connect ( sigc::mem_fun(*this, &Retinex::retinexMethodChanged) );
retinexMethod->set_tooltip_markup (M("TP_RETINEX_METHOD_TOOLTIP"));
@@ -151,6 +151,27 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"),
limd->set_tooltip_markup (M("TP_RETINEX_THRESHOLD_TOOLTIP"));
highlig->set_tooltip_markup (M("TP_RETINEX_HIGHLIGHT2_TOOLTIP"));
+ curveEditorGH = new CurveEditorGroup (options.lastRetinexDir, M("TP_RETINEX_CONTEDIT_LH"));
+ curveEditorGH->setCurveListener (this);
+
+ lhshape = static_cast(curveEditorGH->addCurve(CT_Flat, M("TP_RETINEX_CURVEEDITOR_LH")));
+ lhshape->setTooltip(M("TP_RETINEX_CURVEEDITOR_LH_TOOLTIP"));
+ lhshape->setCurveColorProvider(this, 4);
+ // lhshape->setEditID(EUID_Lab_LHCurve, BT_SINGLEPLANE_FLOAT);
+
+ milestones.clear();
+
+ for (int i = 0; i < 7; i++) {
+ float R, G, B;
+ float x = float(i) * (1.0f / 6.0);
+ Color::hsv2rgb01(x, 0.5f, 0.5f, R, G, B);
+ milestones.push_back( GradientMilestone(double(x), double(R), double(G), double(B)) );
+ }
+
+ lhshape->setBottomBarBgGradient(milestones);
+
+ curveEditorGH->curveListComplete();
+
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) );
@@ -167,6 +188,9 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"),
settingsVBox->pack_start (*curveEditorGDH, Gtk::PACK_SHRINK, 4);
curveEditorGDH->show();
+ settingsVBox->pack_start (*curveEditorGH, Gtk::PACK_SHRINK, 4);
+ curveEditorGH->show();
+
gambox->pack_start(*gammaretinex);
settingsVBox->pack_start(*gambox);
@@ -299,6 +323,7 @@ Retinex::~Retinex()
delete curveEditorGD;
delete curveEditorGDH;
delete transmissionCurveEditorG;
+ delete curveEditorGH;
}
@@ -437,6 +462,7 @@ void Retinex::read (const ProcParams* pp, const ParamsEdited* pedited)
cdshape->setUnChanged (!pedited->retinex.cdcurve);
cdshapeH->setUnChanged (!pedited->retinex.cdHcurve);
transmissionShape->setUnChanged (!pedited->retinex.transmissionCurve);
+ lhshape->setUnChanged (!pedited->retinex.lhcurve);
}
@@ -468,8 +494,8 @@ void Retinex::read (const ProcParams* pp, const ParamsEdited* pedited)
retinexMethod->set_active (2);
} else if (pp->retinex.retinexMethod == "highli") {
retinexMethod->set_active (3);
- } else if (pp->retinex.retinexMethod == "highliplus") {
- retinexMethod->set_active (4);
+// } else if (pp->retinex.retinexMethod == "highliplus") {
+// retinexMethod->set_active (4);
}
if (pp->retinex.retinexcolorspace == "Lab") {
@@ -502,6 +528,7 @@ void Retinex::read (const ProcParams* pp, const ParamsEdited* pedited)
cdshape->setCurve (pp->retinex.cdcurve);
cdshapeH->setCurve (pp->retinex.cdHcurve);
+ lhshape->setCurve (pp->retinex.lhcurve);
retinexMethodConn.block(false);
retinexColorSpaceConn.block(false);
@@ -530,6 +557,7 @@ void Retinex::write (ProcParams* pp, ParamsEdited* pedited)
pp->retinex.highlig = (int)highlig->getValue ();
pp->retinex.grbl = (int)grbl->getValue ();
pp->retinex.cdcurve = cdshape->getCurve ();
+ pp->retinex.lhcurve = lhshape->getCurve ();
pp->retinex.cdHcurve = cdshapeH->getCurve ();
pp->retinex.transmissionCurve = transmissionShape->getCurve ();
pp->retinex.enabled = getEnabled();
@@ -558,6 +586,7 @@ void Retinex::write (ProcParams* pp, ParamsEdited* pedited)
pedited->retinex.transmissionCurve = !transmissionShape->isUnChanged ();
pedited->retinex.enabled = !get_inconsistent();
pedited->retinex.medianmap = !medianmap->get_inconsistent();
+ pedited->retinex.lhcurve = !lhshape->isUnChanged ();
}
@@ -569,8 +598,8 @@ void Retinex::write (ProcParams* pp, ParamsEdited* pedited)
pp->retinex.retinexMethod = "high";
} else if (retinexMethod->get_active_row_number() == 3) {
pp->retinex.retinexMethod = "highli";
- } else if (retinexMethod->get_active_row_number() == 4) {
- pp->retinex.retinexMethod = "highliplus";
+// } else if (retinexMethod->get_active_row_number() == 4) {
+// pp->retinex.retinexMethod = "highliplus";
}
if (retinexcolorspace->get_active_row_number() == 0) {
@@ -597,8 +626,8 @@ void Retinex::write (ProcParams* pp, ParamsEdited* pedited)
void Retinex::retinexMethodChanged()
{
- if (retinexMethod->get_active_row_number() == 4) {highl->show();highlig->show();grbl->show();}
- else if(retinexMethod->get_active_row_number() == 3) {highl->show();highlig->hide();grbl->hide();}
+ // if (retinexMethod->get_active_row_number() == 4) {highl->show();highlig->show();grbl->show();}
+ if(retinexMethod->get_active_row_number() == 3) {highl->show();highlig->hide();grbl->hide();}
else {highl->hide();highlig->hide();grbl->hide();}
if (listener) {
listener->panelChanged (EvretinexMethod, retinexMethod->get_active_text ());
@@ -608,6 +637,8 @@ void Retinex::retinexMethodChanged()
void Retinex::ColorSpaceUpdateUI ()
{
if (!batchMode) {
+ curveEditorGH->show();
+
if(retinexcolorspace->get_active_row_number() == 0) {
curveEditorGD->show();
curveEditorGDH->hide();
@@ -782,6 +813,7 @@ void Retinex::autoOpenCurve ()
cdshape->openIfNonlinear();
cdshapeH->openIfNonlinear();
transmissionShape->openIfNonlinear();
+ lhshape->openIfNonlinear();
}
@@ -795,6 +827,8 @@ void Retinex::curveChanged (CurveEditor* ce)
listener->panelChanged (EvLCDHCurve, M("HISTORY_CUSTOMCURVE"));
} else if (ce == transmissionShape) {
listener->panelChanged (EvRetinextransmission, M("HISTORY_CUSTOMCURVE"));
+ } else if (ce == lhshape) {
+ listener->panelChanged (EvRetinexlhcurve, M("HISTORY_CUSTOMCURVE"));
}
}
}
@@ -837,6 +871,52 @@ void Retinex::updateCurveBackgroundHistogram (LUTu & histToneCurve, LUTu & histL
cdshapeH->updateBackgroundHistogram (histLRETI);
}
+void Retinex::colorForValue (double valX, double valY, enum ColorCaller::ElemType elemType, int callerId, ColorCaller *caller)
+{
+
+ float R, G, B;
+
+ if (elemType == ColorCaller::CCET_VERTICAL_BAR) {
+ valY = 0.5;
+ }
+
+ if (callerId == 1) { // ch - main curve
+
+ Color::hsv2rgb01(float(valX), float(valY), 0.5f, R, G, B);
+ } else if (callerId == 2) { // cc - bottom bar
+
+ float value = (1.f - 0.7f) * float(valX) + 0.7f;
+ // whole hue range
+ // Y axis / from 0.15 up to 0.75 (arbitrary values; was 0.45 before)
+ Color::hsv2rgb01(float(valY), float(valX), value, R, G, B);
+ } else if (callerId == 3) { // lc - bottom bar
+
+ float value = (1.f - 0.7f) * float(valX) + 0.7f;
+
+ // whole hue range
+ // Y axis / from 0.15 up to 0.75 (arbitrary values; was 0.45 before)
+ Color::hsv2rgb01(float(valY), float(valX), value, R, G, B);
+ } else if (callerId == 4) { // LH - bottom bar
+ Color::hsv2rgb01(float(valX), 0.5f, float(valY), R, G, B);
+ } else if (callerId == 5) { // HH - bottom bar
+ float h = float((valY - 0.5) * 0.3 + valX);
+
+ if (h > 1.0f) {
+ h -= 1.0f;
+ } else if (h < 0.0f) {
+ h += 1.0f;
+ }
+
+ Color::hsv2rgb01(h, 0.5f, 0.5f, R, G, B);
+ }
+
+ caller->ccRed = double(R);
+ caller->ccGreen = double(G);
+ caller->ccBlue = double(B);
+}
+
+
+
void Retinex::setBatchMode (bool batchMode)
{
ToolPanel::setBatchMode (batchMode);
@@ -855,6 +935,7 @@ void Retinex::setBatchMode (bool batchMode)
curveEditorGD->setBatchMode (batchMode);
curveEditorGDH->setBatchMode (batchMode);
transmissionCurveEditorG->setBatchMode (batchMode);
+ curveEditorGH->setBatchMode (batchMode);
}
diff --git a/rtgui/retinex.h b/rtgui/retinex.h
index b55a7940f..1e6118e66 100644
--- a/rtgui/retinex.h
+++ b/rtgui/retinex.h
@@ -14,13 +14,14 @@
#include "colorprovider.h"
class Retinex : public ToolParamBlock, public FoldableToolPanel, public rtengine::RetinexListener, public CurveListener,
- public AdjusterListener
+ public AdjusterListener, public ColorProvider
{
protected:
CurveEditorGroup* curveEditorGD;
CurveEditorGroup* curveEditorGDH;
+ CurveEditorGroup* curveEditorGH;
Adjuster* str;
Adjuster* scal;
Adjuster* neigh;
@@ -63,6 +64,7 @@ protected:
sigc::connection retinexColorSpaceConn;
sigc::connection gammaretinexConn;
FlatCurveEditor* transmissionShape;
+ FlatCurveEditor* lhshape;
bool lastmedianmap;
sigc::connection medianmapConn;
@@ -93,6 +95,8 @@ public:
void updateToolState (std::vector &tpOpen);
void setAdjusterBehavior (bool strAdd, bool neighAdd, bool scalAdd, bool limdAdd, bool gainAdd, bool offsAdd, bool vartAdd, bool gamAdd, bool slopeAdd);
void updateCurveBackgroundHistogram (LUTu & histToneCurve, LUTu & histLCurve, LUTu & histCCurve,/* LUTu & histCLurve, LUTu & histLLCurve,*/ LUTu & histLCAM, LUTu & histCCAM, LUTu & histRed, LUTu & histGreen, LUTu & histBlue, LUTu & histLuma, LUTu & histLRETI);
+
+ virtual void colorForValue (double valX, double valY, enum ColorCaller::ElemType elemType, int callerId, ColorCaller* caller);
private:
void foldAllButMe (GdkEventButton* event, MyExpander *expander);