diff --git a/rtdata/languages/default b/rtdata/languages/default
index f85c71aeb..492c7ba56 100644
--- a/rtdata/languages/default
+++ b/rtdata/languages/default
@@ -653,6 +653,9 @@ HISTORY_MSG_420;Retinex - Histogram - HSL
HISTORY_MSG_421;Retinex - Gamma retinex
HISTORY_MSG_422;Retinex - gamma
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_NEWSNAPSHOT;Add
HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: Alt-s
HISTORY_SNAPSHOTS;Snapshots
@@ -1573,6 +1576,13 @@ TP_RETINEX_GAMMA;Gamma
TP_RETINEX_SLOPE;Slope
TP_RETINEX_GAMMA_TOOLTIP;Restore tones by applying gamma before and after Retinex\nDifferent from Retinex curves or others curves (Lab, Exposure,..)
TP_RETINEX_HIGH;High
+TP_RETINEX_HIGHLIG;Highlight
+TP_RETINEX_HIGHLIGPLUS;Highlight More
+TP_RETINEX_HIGHLIGHT;Highlight threshold
+TP_RETINEX_HIGHLIGHT_TOOLTIP;Increase action of High algorithm\nNeeds probably to change settings (Neighboring pixels), and increase Raw White-point
+TP_RETINEX_HIGHLIGHT2;Highlight control (red)
+TP_RETINEX_HIGHLIGHT2_TOOLTIP;Acts on RGB channels to reduce magenta (red = master)
+TP_RETINEX_HIGHLIGHT3;Highlight control (blue green)
TP_RETINEX_HSLSPACE_LIN;HSL-Linear
TP_RETINEX_HSLSPACE_LOG;HSL-Logarithmic
TP_RETINEX_LABEL;Retinex
@@ -1580,7 +1590,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.
+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_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/imagesource.h b/rtengine/imagesource.h
index 73c8b0786..d9f088813 100644
--- a/rtengine/imagesource.h
+++ b/rtengine/imagesource.h
@@ -69,9 +69,9 @@ 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 retinex (ColorManagementParams cmp, RetinexParams deh, ToneCurveParams Tc, LUTf & cdcurve, const RetinextransmissionCurve & dehatransmissionCurve, multi_array2D &conversionBuffer, bool dehacontlutili, bool useHsl, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax, LUTu &histLRETI) {};
+ virtual void retinex (ColorManagementParams cmp, RetinexParams deh, ToneCurveParams Tc, LUTf & cdcurve, const RetinextransmissionCurve & dehatransmissionCurve, multi_array2D &conversionBuffer, bool dehacontlutili, bool useHsl, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax, LUTu &histLRETI) {};
virtual void retinexPrepareCurves (RetinexParams retinexParams, LUTf &cdcurve, RetinextransmissionCurve &retinextransmissionCurve, bool &retinexcontlutili, bool &useHsl, LUTu & lhist16RETI, LUTu & histLRETI) {};
- virtual void retinexPrepareBuffers (ColorManagementParams cmp, RetinexParams retinexParams, multi_array2D &conversionBuffer, LUTu &lhist16RETI) {};
+ virtual void retinexPrepareBuffers (ColorManagementParams cmp, RetinexParams retinexParams, multi_array2D &conversionBuffer, LUTu &lhist16RETI) {};
virtual void flushRawData () {};
virtual void flushRGB () {};
virtual void HLRecovery_Global (ToneCurveParams hrp) {};
diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc
index 0bb316b7d..b5def58d0 100644
--- a/rtengine/improccoordinator.cc
+++ b/rtengine/improccoordinator.cc
@@ -365,6 +365,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall)
}
*/
imgsrc->convertColorSpace(orig_prev, params.icm, currWB);
+ printf("improc color r=%f g=%f b=%f\n",orig_prev->r(50, 2300),orig_prev->g(50, 2300),orig_prev->b(50, 2300));
ipf.firstAnalysis (orig_prev, ¶ms, vhist16);
}
diff --git a/rtengine/improccoordinator.h b/rtengine/improccoordinator.h
index 3266a6c0a..ef981fe6a 100644
--- a/rtengine/improccoordinator.h
+++ b/rtengine/improccoordinator.h
@@ -94,7 +94,8 @@ protected:
LUTf satcurve;
LUTf lhskcurve;
LUTf clcurve;
- multi_array2D conversionBuffer;
+// multi_array2D conversionBuffer;
+ multi_array2D conversionBuffer;
LUTf wavclCurve;
LUTf clToningcurve;
LUTf cl2Toningcurve;
diff --git a/rtengine/ipretinex.cc b/rtengine/ipretinex.cc
index 351902949..f5edcd7c2 100644
--- a/rtengine/ipretinex.cc
+++ b/rtengine/ipretinex.cc
@@ -65,7 +65,7 @@ extern const Settings* settings;
static float RetinexScales[MAX_RETINEX_SCALES];
-void retinex_scales( float* scales, int nscales, int mode, int s)
+void retinex_scales( float* scales, int nscales, int mode, int s, float high)
{
if ( nscales == 1 ) {
scales[0] = (float)s / 2.f;
@@ -91,6 +91,12 @@ void retinex_scales( float* scales, int nscales, int mode, int s)
for ( int i = 0; i < nscales; ++i ) {
scales[i] = s - (float)pow (10.f, (i * size_step) / log (10.f));
}
+ } else if (mode == 3) {
+ size_step = (float) log(s - 2.0f) / (float) nscales;
+
+ for ( int i = 0; i < nscales; ++i ) {
+ scales[i] = high*s - (float)pow (10.f, (i * size_step) / log (10.f));
+ }
}
}
}
@@ -198,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, 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");
@@ -220,7 +226,10 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, int width
limD *= useHslLin ? 10.f : 1.f;
float ilimD = 1.f / limD;
int moderetinex = 2; // default to 2 ( deh.retinexMethod == "high" )
-
+ float hig = ((float) deh.highl)/100.f;
+ bool higplus = false ;
+ if(deh.retinexMethod == "highliplus") higplus = true;
+
if (deh.retinexMethod == "uni") {
moderetinex = 0;
}
@@ -228,8 +237,12 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, int width
if (deh.retinexMethod == "low") {
moderetinex = 1;
}
-
- retinex_scales( RetinexScales, scal, moderetinex, nei );
+ if (deh.retinexMethod == "highli" || deh.retinexMethod == "highliplus") {
+ moderetinex = 3;
+ }
+
+ float high = (float) deh.highl;
+ retinex_scales( RetinexScales, scal, moderetinex, nei, high );
int H_L = height;
int W_L = width;
@@ -284,6 +297,7 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, int width
for (int i = 0; i < H_L; i++) {
int j = 0;
+
#ifdef __SSE2__
if(useHslLin) {
@@ -304,7 +318,7 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, int width
}
} else {
for (; j < W_L; j++) {
- luminance[i][j] += pond * xlogf(LIM(src[i][j] / out[i][j], ilimD, limD));
+ luminance[i][j] += pond * xlogf(LIM(src[i][j] / out[i][j], ilimD, limD));
}
}
}
@@ -450,9 +464,9 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, int width
if(cd < cdmin) {
cdmin = cd;
}
-
-
- luminance[i][j] = clipretinex( cd, 0.f, 32768.f ) * strength + (1.f - strength) * originalLuminance[i][j];
+ float str = strength;
+ 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];
}
#ifdef _OPENMP
diff --git a/rtengine/procevents.h b/rtengine/procevents.h
index ddae2f583..6b4a762af 100644
--- a/rtengine/procevents.h
+++ b/rtengine/procevents.h
@@ -450,6 +450,9 @@ enum ProcEvent {
Evretinexgamma = 420,
EvLgam = 421,
EvLslope = 422,
+ EvLhighl = 423,
+ EvLhighlig = 424,
+ EvLgrbl = 425,
NUMOFEVENTS
};
}
diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc
index 505913f19..3ae96dca7 100644
--- a/rtengine/procparams.cc
+++ b/rtengine/procparams.cc
@@ -149,6 +149,9 @@ void RetinexParams::setDefaults()
offs = 0;
vart = 125;
limd = 8;
+ highl = 10;
+ highlig = 100;
+ grbl = 50;
retinexMethod = "high";
retinexcolorspace = "Lab";
gammaretinex = "none";
@@ -1476,6 +1479,18 @@ int ProcParams::save (Glib::ustring fname, Glib::ustring fname2, bool fnameAbsol
keyFile.set_integer ("Retinex", "Limd", retinex.limd);
}
+ if (!pedited || pedited->retinex.highl) {
+ keyFile.set_integer ("Retinex", "highl", retinex.highl);
+ }
+
+ if (!pedited || pedited->retinex.highlig) {
+ keyFile.set_integer ("Retinex", "highlig", retinex.highlig);
+ }
+
+ if (!pedited || pedited->retinex.grbl) {
+ keyFile.set_integer ("Retinex", "grbl", retinex.grbl);
+ }
+
if (!pedited || pedited->retinex.retinexMethod) {
keyFile.set_string ("Retinex", "RetinexMethod", retinex.retinexMethod);
}
@@ -3876,6 +3891,30 @@ int ProcParams::load (Glib::ustring fname, ParamsEdited* pedited)
}
}
+ if (keyFile.has_key ("Retinex", "highl")) {
+ retinex.highl = keyFile.get_integer ("Retinex", "highl");
+
+ if (pedited) {
+ pedited->retinex.highl = true;
+ }
+ }
+
+ if (keyFile.has_key ("Retinex", "highlig")) {
+ retinex.highlig = keyFile.get_integer ("Retinex", "highlig");
+
+ if (pedited) {
+ pedited->retinex.highlig = true;
+ }
+ }
+
+ if (keyFile.has_key ("Retinex", "grbl")) {
+ retinex.grbl = keyFile.get_integer ("Retinex", "grbl");
+
+ if (pedited) {
+ pedited->retinex.grbl = true;
+ }
+ }
+
if (keyFile.has_key ("Retinex", "CDCurve")) {
retinex.cdcurve = keyFile.get_double_list ("Retinex", "CDCurve");
@@ -7271,6 +7310,9 @@ bool ProcParams::operator== (const ProcParams& other)
&& retinex.neigh == other.retinex.neigh
&& retinex.gain == other.retinex.gain
&& retinex.limd == other.retinex.limd
+ && retinex.highl == other.retinex.highl
+ && retinex.highlig == other.retinex.highlig
+ && retinex.grbl == other.retinex.grbl
&& retinex.offs == other.retinex.offs
&& retinex.retinexMethod == other.retinex.retinexMethod
&& retinex.retinexcolorspace == other.retinex.retinexcolorspace
diff --git a/rtengine/procparams.h b/rtengine/procparams.h
index 4c631b6c8..8d70dfc5b 100644
--- a/rtengine/procparams.h
+++ b/rtengine/procparams.h
@@ -284,6 +284,9 @@ public:
Glib::ustring gammaretinex;
int vart;
int limd;
+ int highl;
+ int highlig;
+ int grbl;
bool medianmap;
RetinexParams ();
void setDefaults();
diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc
index ae52227f5..d965c12d7 100644
--- a/rtengine/rawimagesource.cc
+++ b/rtengine/rawimagesource.cc
@@ -1805,12 +1805,14 @@ void RawImageSource::demosaic(const RAWParams &raw)
}
-void RawImageSource::retinexPrepareBuffers(ColorManagementParams cmp, RetinexParams retinexParams, multi_array2D &conversionBuffer, LUTu &lhist16RETI)
+//void RawImageSource::retinexPrepareBuffers(ColorManagementParams cmp, RetinexParams retinexParams, multi_array2D &conversionBuffer, LUTu &lhist16RETI)
+void RawImageSource::retinexPrepareBuffers(ColorManagementParams cmp, RetinexParams retinexParams, multi_array2D &conversionBuffer, LUTu &lhist16RETI)
{
bool useHsl = (retinexParams.retinexcolorspace == "HSLLOG" || retinexParams.retinexcolorspace == "HSLLIN");
conversionBuffer[0] (W - 2 * border, H - 2 * border);
conversionBuffer[1] (W - 2 * border, H - 2 * border);
conversionBuffer[2] (W - 2 * border, H - 2 * border);
+ conversionBuffer[3] (W - 2 * border, H - 2 * border);
LUTf *retinexgamtab;//gamma before and after Retinex to restore tones
LUTf lutTonereti;
@@ -1843,6 +1845,44 @@ void RawImageSource::retinexPrepareBuffers(ColorManagementParams cmp, RetinexPar
}
retinexgamtab = &lutTonereti;
}
+/*
+//test with amsterdam.pef and other files
+float rr,gg,bb;
+rr=red[50][2300];
+gg=green[50][2300];
+bb=blue[50][2300];
+printf("rr=%f gg=%f bb=%f \n",rr,gg,bb);
+rr=red[1630][370];
+gg=green[1630][370];
+bb=blue[1630][370];
+printf("rr1=%f gg1=%f bb1=%f \n",rr,gg,bb);
+rr=red[380][1630];
+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;
+
+#ifdef _OPENMP
+ #pragma omp parallel for
+#endif
+ for (int i = border; i < H - border; i++ ) {
+ for (int j = border; j < W - border; j++ ) {
+ float R_,G_,B_;
+ R_=red[i][j];
+ G_=green[i][j];
+ B_=blue[i][j];
+
+ //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(retinexParams.gammaretinex != "none" && retinexParams.str != 0) {//gamma
#ifdef _OPENMP
@@ -1854,6 +1894,7 @@ if(retinexParams.gammaretinex != "none" && retinexParams.str != 0) {//gamma
R_=red[i][j];
G_=green[i][j];
B_=blue[i][j];
+
red[i][j] = (*retinexgamtab)[R_];
green[i][j] = (*retinexgamtab)[G_];
blue[i][j] = (*retinexgamtab)[B_];
@@ -1969,6 +2010,7 @@ if(retinexParams.gammaretinex != "none" && retinexParams.str != 0) {//gamma
R_ = red[i][j];
G_ = green[i][j];
B_ = blue[i][j];
+ float k;
//rgb=>lab
Color::rgbxyz(R_, G_, B_, X, Y, Z, wp);
//convert Lab
@@ -1976,7 +2018,8 @@ 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;
-
+ // 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) {
pos = (int) clipretinex(L, 0, 32768);
lhist16RETIThr[pos]++;//histogram in Curve Lab
@@ -2015,7 +2058,8 @@ void RawImageSource::retinexPrepareCurves(RetinexParams retinexParams, LUTf &cdc
retinexParams.getCurves(retinextransmissionCurve);
}
-void RawImageSource::retinex(ColorManagementParams cmp, RetinexParams deh, ToneCurveParams Tc, LUTf & cdcurve, const RetinextransmissionCurve & dehatransmissionCurve, multi_array2D &conversionBuffer, bool dehacontlutili, bool useHsl, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax, LUTu &histLRETI)
+//void RawImageSource::retinex(ColorManagementParams cmp, RetinexParams deh, ToneCurveParams Tc, LUTf & cdcurve, const RetinextransmissionCurve & dehatransmissionCurve, multi_array2D &conversionBuffer, bool dehacontlutili, bool useHsl, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax, LUTu &histLRETI)
+void RawImageSource::retinex(ColorManagementParams cmp, RetinexParams deh, ToneCurveParams Tc, LUTf & cdcurve, const RetinextransmissionCurve & dehatransmissionCurve, multi_array2D &conversionBuffer, bool dehacontlutili, bool useHsl, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax, LUTu &histLRETI)
{
MyTime t4, t5;
@@ -2131,7 +2175,7 @@ void RawImageSource::retinex(ColorManagementParams cmp, RetinexParams deh, ToneC
}
}
- MSR(LBuffer, conversionBuffer[2], WNew, HNew, deh, dehatransmissionCurve, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax);
+ MSR(LBuffer, conversionBuffer[2], conversionBuffer[3], WNew, HNew, deh, dehatransmissionCurve, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax);
if(useHsl) {
#ifdef _OPENMP
diff --git a/rtengine/rawimagesource.h b/rtengine/rawimagesource.h
index 1f926730f..10e17743f 100644
--- a/rtengine/rawimagesource.h
+++ b/rtengine/rawimagesource.h
@@ -152,9 +152,9 @@ public:
void preprocess (const RAWParams &raw, const LensProfParams &lensProf, const CoarseTransformParams& coarse);
void demosaic (const RAWParams &raw);
// void retinex (RAWParams raw, ColorManagementParams cmp, RetinexParams lcur, LUTf & cdcurve, bool dehacontlutili);
- void retinex (ColorManagementParams cmp, RetinexParams deh, ToneCurveParams Tc, LUTf & cdcurve, const RetinextransmissionCurve & dehatransmissionCurve, multi_array2D &conversionBuffer, bool dehacontlutili, bool useHsl, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax, LUTu &histLRETI);
+ void retinex (ColorManagementParams cmp, RetinexParams deh, ToneCurveParams Tc, LUTf & cdcurve, const RetinextransmissionCurve & dehatransmissionCurve, multi_array2D &conversionBuffer, bool dehacontlutili, bool useHsl, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax, LUTu &histLRETI);
void retinexPrepareCurves (RetinexParams retinexParams, LUTf &cdcurve, RetinextransmissionCurve &retinextransmissionCurve, bool &retinexcontlutili, bool &useHsl, LUTu & lhist16RETI, LUTu & histLRETI);
- void retinexPrepareBuffers (ColorManagementParams cmp, RetinexParams retinexParams, multi_array2D &conversionBuffer, LUTu &lhist16RETI);
+ void retinexPrepareBuffers (ColorManagementParams cmp, RetinexParams retinexParams, multi_array2D &conversionBuffer, LUTu &lhist16RETI);
void flushRawData ();
void flushRGB ();
void HLRecovery_Global (ToneCurveParams hrp);
@@ -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, 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 4ad96ebd2..f648f5b4c 100644
--- a/rtengine/refreshmap.cc
+++ b/rtengine/refreshmap.cc
@@ -449,6 +449,9 @@ int refreshmap[rtengine::NUMOFEVENTS] = {
ALLNORAW, // EvLCDHCurve
DEMOSAIC, // Evretinexgamma
DEMOSAIC, // EvLgam
- DEMOSAIC // EvLslope
+ DEMOSAIC, // EvLslope
+ ALLNORAW, // EvLhighl
+ DEMOSAIC, // EvLhighlig
+ DEMOSAIC // EvLgrbl
};
diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc
index 9f9d9875c..73986518b 100644
--- a/rtengine/simpleprocess.cc
+++ b/rtengine/simpleprocess.cc
@@ -122,7 +122,8 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p
RetinextransmissionCurve dehatransmissionCurve;
bool dehacontlutili = false;
bool useHsl = false;
- multi_array2D conversionBuffer(1, 1);
+// multi_array2D conversionBuffer(1, 1);
+ multi_array2D conversionBuffer(1, 1);
imgsrc->retinexPrepareBuffers(params.icm, params.retinex, conversionBuffer, dummy);
imgsrc->retinexPrepareCurves(params.retinex, cdcurve, dehatransmissionCurve, dehacontlutili, useHsl, dummy, dummy );
float minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax;
@@ -626,7 +627,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p
Imagefloat* baseImg = new Imagefloat (fw, fh);
imgsrc->getImage (currWB, tr, baseImg, pp, params.toneCurve, params.icm, params.raw);
-
+// printf("befo color R=%f G=%f B=%f\n",baseImg->r(50, 2300),baseImg->g(50, 2300),baseImg->b(50, 2300));
if (pl) {
pl->setProgress (0.50);
}
@@ -716,6 +717,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p
delete [] Max_B_;
imgsrc->convertColorSpace(baseImg, params.icm, currWB);
+ // printf("after color R=%f G=%f B=%f\n",baseImg->r(50, 2300),baseImg->g(50, 2300),baseImg->b(50, 2300));
// perform first analysis
LUTu hist16 (65536);
diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc
index 2cd5acb4a..9c5dfbabc 100644
--- a/rtgui/paramsedited.cc
+++ b/rtgui/paramsedited.cc
@@ -64,6 +64,9 @@ void ParamsEdited::set (bool v)
retinex.offs = v;
retinex.vart = v;
retinex.limd = v;
+ retinex.highl = v;
+ retinex.highlig = v;
+ retinex.grbl = v;
retinex.medianmap = v;
retinex.transmissionCurve = v;
retinex.retinex = v;
@@ -537,6 +540,9 @@ void ParamsEdited::initFrom (const std::vector
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.highl = retinex.highl && p.retinex.highl == other.retinex.highl;
+ retinex.highlig = retinex.highlig && p.retinex.highlig == other.retinex.highlig;
+ retinex.grbl = retinex.grbl && p.retinex.grbl == other.retinex.grbl;
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;
@@ -1086,6 +1092,18 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten
toEdit.retinex.limd = dontforceSet && options.baBehav[ADDSET_RETI_LIMD] ? toEdit.retinex.limd + mods.retinex.limd : mods.retinex.limd;
}
+ if (retinex.highl) {
+ toEdit.retinex.highl = mods.retinex.highl;
+ }
+
+ if (retinex.highlig) {
+ toEdit.retinex.highlig = mods.retinex.highlig;
+ }
+
+ if (retinex.grbl) {
+ toEdit.retinex.grbl = mods.retinex.grbl;
+ }
+
if (retinex.gain) {
toEdit.retinex.gain = dontforceSet && options.baBehav[ADDSET_RETI_GAIN] ? toEdit.retinex.gain + mods.retinex.gain : mods.retinex.gain;
}
diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h
index d71f4da73..16c4ed9f2 100644
--- a/rtgui/paramsedited.h
+++ b/rtgui/paramsedited.h
@@ -71,6 +71,9 @@ public:
bool gammaretinex;
bool vart;
bool limd;
+ bool highl;
+ bool highlig;
+ bool grbl;
bool method;
bool transmissionCurve;
bool cdcurve;
diff --git a/rtgui/retinex.cc b/rtgui/retinex.cc
index 760e1f468..c6aaf8702 100644
--- a/rtgui/retinex.cc
+++ b/rtgui/retinex.cc
@@ -36,6 +36,8 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"),
retinexMethod->append_text (M("TP_RETINEX_LOW"));
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->set_active(0);
retinexMethodConn = retinexMethod->signal_changed().connect ( sigc::mem_fun(*this, &Retinex::retinexMethodChanged) );
retinexMethod->set_tooltip_markup (M("TP_RETINEX_METHOD_TOOLTIP"));
@@ -115,6 +117,8 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"),
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.));
+ highl = Gtk::manage (new Adjuster (M("TP_RETINEX_HIGHLIGHT"), 1, 100, 1, 10));
+ highl->set_tooltip_markup (M("TP_RETINEX_HIGHLIGHT_TOOLTIP"));
expsettings = new MyExpander (false, M("TP_RETINEX_SETTINGS"));
expsettings->signal_button_release_event().connect_notify( sigc::bind( sigc::mem_fun(this, &Retinex::foldAllButMe), expsettings) );
@@ -125,6 +129,9 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"),
retinexVBox->pack_start (*neigh);
neigh->show ();
+ retinexVBox->pack_start (*highl);
+ highl->show ();
+
mMLabels = Gtk::manage(new Gtk::Label("---", Gtk::ALIGN_CENTER));
mMLabels->set_tooltip_markup (M("TP_RETINEX_MLABEL_TOOLTIP"));
@@ -136,10 +143,13 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"),
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));
+ highlig = Gtk::manage (new Adjuster (M("TP_RETINEX_HIGHLIGHT2"), 1, 100, 1, 100));
+ grbl = Gtk::manage (new Adjuster (M("TP_RETINEX_HIGHLIGHT3"), 1, 100, 1, 50));
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"));
+ highlig->set_tooltip_markup (M("TP_RETINEX_HIGHLIGHT2_TOOLTIP"));
medianmap = Gtk::manage (new Gtk::CheckButton (M("TP_RETINEX_MEDIAN")));
medianmap->set_active (true);
@@ -184,6 +194,15 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"),
settingsVBox->pack_start (*limd);
limd->show ();
+// settingsVBox->pack_start (*highl);
+// highl->show ();
+
+ settingsVBox->pack_start (*highlig);
+ highlig->show ();
+
+ settingsVBox->pack_start (*grbl);
+ grbl->show ();
+
settingsVBox->pack_start( *transmissionCurveEditorG, Gtk::PACK_SHRINK, 2);
transmissionCurveEditorG->show();
@@ -246,6 +265,24 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"),
limd->delay = 200;
}
+ highl->setAdjusterListener (this);
+
+ if (highl->delay < 200) {
+ highl->delay = 200;
+ }
+
+ highlig->setAdjusterListener (this);
+
+ if (highlig->delay < 200) {
+ highlig->delay = 200;
+ }
+
+ grbl->setAdjusterListener (this);
+
+ if (grbl->delay < 200) {
+ grbl->delay = 200;
+ }
+
pack_start (*retinexVBox);
pack_start (*expsettings);
@@ -378,6 +415,9 @@ void Retinex::read (const ProcParams* pp, const ParamsEdited* pedited)
offs->setEditedState (pedited->retinex.offs ? Edited : UnEdited);
vart->setEditedState (pedited->retinex.vart ? Edited : UnEdited);
limd->setEditedState (pedited->retinex.limd ? Edited : UnEdited);
+ highl->setEditedState (pedited->retinex.highl ? Edited : UnEdited);
+ highlig->setEditedState (pedited->retinex.highlig ? Edited : UnEdited);
+ grbl->setEditedState (pedited->retinex.grbl ? Edited : UnEdited);
set_inconsistent (multiImage && !pedited->retinex.enabled);
medianmap->set_inconsistent (!pedited->retinex.medianmap);
@@ -409,6 +449,9 @@ void Retinex::read (const ProcParams* pp, const ParamsEdited* pedited)
limd->setValue (pp->retinex.limd);
gam->setValue (pp->retinex.gam);
slope->setValue (pp->retinex.slope);
+ highl->setValue (pp->retinex.highl);
+ highlig->setValue (pp->retinex.highlig);
+ grbl->setValue (pp->retinex.grbl);
setEnabled (pp->retinex.enabled);
@@ -423,9 +466,12 @@ void Retinex::read (const ProcParams* pp, const ParamsEdited* pedited)
retinexMethod->set_active (1);
} else if (pp->retinex.retinexMethod == "high") {
retinexMethod->set_active (2);
+ } else if (pp->retinex.retinexMethod == "highli") {
+ retinexMethod->set_active (3);
+ } else if (pp->retinex.retinexMethod == "highliplus") {
+ retinexMethod->set_active (4);
}
-
if (pp->retinex.retinexcolorspace == "Lab") {
retinexcolorspace->set_active (0);
} else if (pp->retinex.retinexcolorspace == "HSLLOG") {
@@ -480,6 +526,9 @@ void Retinex::write (ProcParams* pp, ParamsEdited* pedited)
pp->retinex.offs = (int)offs->getValue ();
pp->retinex.vart = (int)vart->getValue ();
pp->retinex.limd = (int)limd->getValue ();
+ pp->retinex.highl = (int)highl->getValue ();
+ pp->retinex.highlig = (int)highlig->getValue ();
+ pp->retinex.grbl = (int)grbl->getValue ();
pp->retinex.cdcurve = cdshape->getCurve ();
pp->retinex.cdHcurve = cdshapeH->getCurve ();
pp->retinex.transmissionCurve = transmissionShape->getCurve ();
@@ -501,6 +550,9 @@ void Retinex::write (ProcParams* pp, ParamsEdited* pedited)
pedited->retinex.offs = offs->getEditedState ();
pedited->retinex.vart = vart->getEditedState ();
pedited->retinex.limd = limd->getEditedState ();
+ pedited->retinex.highl = highl->getEditedState ();
+ pedited->retinex.highlig = highlig->getEditedState ();
+ pedited->retinex.grbl = grbl->getEditedState ();
pedited->retinex.cdcurve = !cdshape->isUnChanged ();
pedited->retinex.cdHcurve = !cdshapeH->isUnChanged ();
pedited->retinex.transmissionCurve = !transmissionShape->isUnChanged ();
@@ -515,6 +567,10 @@ void Retinex::write (ProcParams* pp, ParamsEdited* pedited)
pp->retinex.retinexMethod = "uni";
} else if (retinexMethod->get_active_row_number() == 2) {
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";
}
if (retinexcolorspace->get_active_row_number() == 0) {
@@ -541,8 +597,11 @@ 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();}
+ else {highl->hide();highlig->hide();grbl->hide();}
if (listener) {
- listener->panelChanged (EvretinexMethod, retinexMethod->get_active_text ());
+ listener->panelChanged (EvretinexMethod, retinexMethod->get_active_text ());
}
}
@@ -631,6 +690,9 @@ void Retinex::setDefaults (const ProcParams* defParams, const ParamsEdited* pedi
scal->setDefault (defParams->retinex.scal);
vart->setDefault (defParams->retinex.vart);
limd->setDefault (defParams->retinex.limd);
+ highl->setDefault (defParams->retinex.highl);
+ highlig->setDefault (defParams->retinex.highlig);
+ grbl->setDefault (defParams->retinex.grbl);
gam->setDefault (defParams->retinex.gam);
slope->setDefault (defParams->retinex.slope);
@@ -642,6 +704,9 @@ void Retinex::setDefaults (const ProcParams* defParams, const ParamsEdited* pedi
scal->setDefaultEditedState (pedited->retinex.scal ? Edited : UnEdited);
vart->setDefaultEditedState (pedited->retinex.vart ? Edited : UnEdited);
limd->setDefaultEditedState (pedited->retinex.limd ? Edited : UnEdited);
+ highl->setDefaultEditedState (pedited->retinex.highl ? Edited : UnEdited);
+ highlig->setDefaultEditedState (pedited->retinex.highlig ? Edited : UnEdited);
+ grbl->setDefaultEditedState (pedited->retinex.grbl ? Edited : UnEdited);
gam->setDefaultEditedState (pedited->retinex.gam ? Edited : UnEdited);
slope->setDefaultEditedState (pedited->retinex.slope ? Edited : UnEdited);
@@ -651,6 +716,9 @@ void Retinex::setDefaults (const ProcParams* defParams, const ParamsEdited* pedi
offs->setDefaultEditedState (Irrelevant);
vart->setDefaultEditedState (Irrelevant);
limd->setDefaultEditedState (Irrelevant);
+ highl->setDefaultEditedState (Irrelevant);
+ highlig->setDefaultEditedState (Irrelevant);
+ grbl->setDefaultEditedState (Irrelevant);
str->setDefaultEditedState (Irrelevant);
scal->setDefaultEditedState (Irrelevant);
gam->setDefaultEditedState (Irrelevant);
@@ -693,6 +761,12 @@ void Retinex::adjusterChanged (Adjuster* a, double newval)
listener->panelChanged (EvLvart, vart->getTextValue());
} else if (a == limd) {
listener->panelChanged (EvLlimd, limd->getTextValue());
+ } else if (a == highl) {
+ listener->panelChanged (EvLhighl, highl->getTextValue());
+ } else if (a == highlig) {
+ listener->panelChanged (EvLhighlig, highlig->getTextValue());
+ } else if (a == grbl) {
+ listener->panelChanged (EvLgrbl, grbl->getTextValue());
} else if (a == gam) {
listener->panelChanged (EvLgam, gam->getTextValue());
} else if (a == slope) {
@@ -749,6 +823,9 @@ void Retinex::trimValues (rtengine::procparams::ProcParams* pp)
offs->trimValue(pp->retinex.offs);
vart->trimValue(pp->retinex.vart);
limd->trimValue(pp->retinex.limd);
+ highl->trimValue(pp->retinex.highl);
+ highlig->trimValue(pp->retinex.highlig);
+ grbl->trimValue(pp->retinex.grbl);
gam->trimValue(pp->retinex.gam);
slope->trimValue(pp->retinex.slope);
@@ -772,6 +849,9 @@ void Retinex::setBatchMode (bool batchMode)
slope->showEditedCB ();
vart->showEditedCB ();
limd->showEditedCB ();
+ highl->showEditedCB ();
+ highlig->showEditedCB ();
+ grbl->showEditedCB ();
curveEditorGD->setBatchMode (batchMode);
curveEditorGDH->setBatchMode (batchMode);
transmissionCurveEditorG->setBatchMode (batchMode);
diff --git a/rtgui/retinex.h b/rtgui/retinex.h
index 4e8d2f05e..b55a7940f 100644
--- a/rtgui/retinex.h
+++ b/rtgui/retinex.h
@@ -28,6 +28,9 @@ protected:
Adjuster* offs;
Adjuster* vart;
Adjuster* limd;
+ Adjuster* highl;
+ Adjuster* highlig;
+ Adjuster* grbl;
Adjuster* gam;
Adjuster* slope;
MyExpander* expsettings;