Enhancement to 'Process Transmission' and High radius unsharp mask
This commit is contained in:
parent
f74e4b0dd2
commit
38f9c05c3c
@ -1653,7 +1653,7 @@ TP_RETINEX_CURVEEDITOR_CD_TOOLTIP;Luminance according to luminance L=f(L)\nCorre
|
||||
TP_RETINEX_CURVEEDITOR_LH;Strength=f(H)
|
||||
TP_RETINEX_CURVEEDITOR_LH_TOOLTIP;Strength according to hue Strength=f(H)\nThis curve also acts on chroma when using the "Highlight" retinex method.
|
||||
TP_RETINEX_FREEGAMMA;Free gamma
|
||||
TP_RETINEX_GAIN;Contrast
|
||||
TP_RETINEX_GAIN;Gain
|
||||
TP_RETINEX_GAIN_TOOLTIP;Acts on the restored image.\n\nThis is very different from the others settings. Used for black or white pixels, and to help balance the histogram.
|
||||
TP_RETINEX_GAMMA;Gamma
|
||||
TP_RETINEX_GAMMA_FREE;Free
|
||||
@ -1706,13 +1706,15 @@ TP_RETINEX_TLABEL_TOOLTIP;Transmission map result.\nMin and Max are used by Vari
|
||||
TP_RETINEX_TRANSMISSION;Transmission map
|
||||
TP_RETINEX_TRANSMISSION_TOOLTIP;Transmission according to transmission.\nAbscissa: transmission from negative values (min), mean, and positives values (max).\nOrdinate: amplification or reduction.
|
||||
TP_RETINEX_UNIFORM;Uniform
|
||||
TP_RETINEX_VARIANCE;Variance
|
||||
TP_RETINEX_VARIANCE;Contrast
|
||||
TP_RETINEX_VARIANCE_TOOLTIP;Low variance increase local contrast and saturation, but can lead to artifacts.
|
||||
TP_RETINEX_VIEW;Preview
|
||||
TP_RETINEX_VIEW;Process (Preview)
|
||||
TP_RETINEX_VIEW_NONE;Standard
|
||||
TP_RETINEX_VIEW_MASK;Mask
|
||||
TP_RETINEX_VIEW_TRAN;Transmission
|
||||
TP_RETINEX_VIEW_METHOD_TOOLTIP;Standard - normal display\nMask - display mask\nTransmission - displays the file transmission-map , before any action on contrast and brightness\nAttention, this does not correspond to reality, but a shift to make it visible
|
||||
TP_RETINEX_VIEW_UNSHARP;Unsharp mask
|
||||
TP_RETINEX_VIEW_TRAN;Transmission (auto)
|
||||
TP_RETINEX_VIEW_TRAN2;Transmission (fixed)
|
||||
TP_RETINEX_VIEW_METHOD_TOOLTIP;Standard - normal display\nMask - display mask\nUnsharp mask - display image with high radius unsharp mask\nTransmission (auto - fixed) - displays the file transmission-map , before any action on contrast and brightness\nAttention, this does not correspond to reality, but a shift (or auto) to make it visible
|
||||
TP_RGBCURVES_BLUE;B
|
||||
TP_RGBCURVES_CHANNEL;Channel
|
||||
TP_RGBCURVES_GREEN;G
|
||||
|
@ -241,6 +241,12 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, float **e
|
||||
} else {
|
||||
elogt = hl;
|
||||
}
|
||||
int H_L = height;
|
||||
int W_L = width;
|
||||
|
||||
float *tran[H_L] ALIGNED16;
|
||||
float *tranBuffer;
|
||||
int viewmet=0;
|
||||
|
||||
elogt = 2.71828f;//disabled baselog
|
||||
FlatCurve* shcurve = NULL;//curve L=f(H)
|
||||
@ -386,8 +392,8 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, float **e
|
||||
|
||||
retinex_scales( RetinexScales, scal, moderetinex, nei/grad, high );
|
||||
|
||||
int H_L = height;
|
||||
int W_L = width;
|
||||
// int H_L = height;
|
||||
// int W_L = width;
|
||||
|
||||
float *src[H_L] ALIGNED16;
|
||||
float *srcBuffer = new float[H_L * W_L];
|
||||
@ -408,9 +414,11 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, float **e
|
||||
double shradius = (double) deh.radius;
|
||||
// printf("shrad=%f\n",shradius);
|
||||
|
||||
int viewmet=0;
|
||||
// int viewmet=0;
|
||||
if(deh.viewMethod=="mask") viewmet=1;
|
||||
if(deh.viewMethod=="tran") viewmet=2;
|
||||
if(deh.viewMethod=="tran2") viewmet=3;
|
||||
if(deh.viewMethod=="unsharp") viewmet=4;
|
||||
|
||||
#ifdef _OPENMP
|
||||
#pragma omp parallel for
|
||||
@ -429,13 +437,13 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, float **e
|
||||
out[i] = &outBuffer[i * W_L];
|
||||
}
|
||||
|
||||
float *tran[H_L] ALIGNED16;
|
||||
float *tranBuffer = new float[H_L * W_L];
|
||||
if(viewmet==3 || viewmet==2) {
|
||||
tranBuffer = new float[H_L * W_L];
|
||||
|
||||
for (int i = 0; i < H_L; i++) {
|
||||
tran[i] = &tranBuffer[i * W_L];
|
||||
for (int i = 0; i < H_L; i++) {
|
||||
tran[i] = &tranBuffer[i * W_L];
|
||||
}
|
||||
}
|
||||
|
||||
const float logBetaGain = xlogf(16384.f);
|
||||
float pond = logBetaGain / (float) scal;
|
||||
|
||||
@ -611,7 +619,7 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, float **e
|
||||
}
|
||||
|
||||
luminance[i][j] *= (-1.f + 4.f * dehatransmissionCurve[absciss]); //new transmission
|
||||
tran[i][j]=luminance[i][j];
|
||||
if(viewmet==3 || viewmet==2) tran[i][j]=luminance[i][j];
|
||||
}
|
||||
}
|
||||
|
||||
@ -683,7 +691,11 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, float **e
|
||||
float cdfactor = gain2 * 32768.f / delta;
|
||||
maxCD = -9999999.f;
|
||||
minCD = 9999999.f;
|
||||
|
||||
// coeff for auto "transmission" with 2 sigma #95% datas
|
||||
float aza=16300.f/(2.f*stddv);
|
||||
float azb=-aza*(mean-2.f*stddv);
|
||||
float bza=16300.f/(2.f*stddv);
|
||||
float bzb=16300.f-bza*(mean);
|
||||
|
||||
|
||||
|
||||
@ -730,7 +742,13 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, float **e
|
||||
if(exLuminance[i][j] > 65535.f*hig && higplus) str *= hig;
|
||||
if(viewmet==0) luminance[i][j]=clipretinex( cd, 0.f, 32768.f ) * str + (1.f - str) * originalLuminance[i][j];
|
||||
if(viewmet==1) luminance[i][j] = out[i][j];
|
||||
if(viewmet==2) luminance[i][j] = 1000.f+ tran[i][j]*700.f;//arbitrary values to help display log values which are between -20 to + 30 - usage values -4 + 5
|
||||
if(viewmet==4) luminance[i][j] = (1.f + str) * originalLuminance[i][j] - str* out[i][j];//unsharp
|
||||
if(viewmet==2) {
|
||||
if(tran[i][j]<= mean) luminance[i][j] = azb + aza*tran[i][j];//auto values
|
||||
else luminance[i][j] = bzb + bza*tran[i][j];
|
||||
}
|
||||
if(viewmet==3) luminance[i][j] = 1000.f + tran[i][j]*700.f;//arbitrary values to help display log values which are between -20 to + 30 - usage values -4 + 5
|
||||
|
||||
}
|
||||
|
||||
#ifdef _OPENMP
|
||||
@ -744,19 +762,22 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, float **e
|
||||
}
|
||||
delete [] outBuffer;
|
||||
outBuffer = NULL;
|
||||
delete [] tranBuffer;
|
||||
tranBuffer = NULL;
|
||||
|
||||
// printf("cdmin=%f cdmax=%f\n",minCD, maxCD);
|
||||
Tmean = mean;
|
||||
Tsigma = stddv;
|
||||
Tmin = mintr;
|
||||
Tmax = maxtr;
|
||||
|
||||
|
||||
if (shcurve && it==1) {
|
||||
delete shcurve;
|
||||
}
|
||||
}
|
||||
if(viewmet==3 || viewmet==2) {
|
||||
delete [] tranBuffer;
|
||||
tranBuffer = NULL;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -202,7 +202,9 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"),
|
||||
viewMethod = Gtk::manage (new MyComboBoxText ());
|
||||
viewMethod->append_text (M("TP_RETINEX_VIEW_NONE"));
|
||||
viewMethod->append_text (M("TP_RETINEX_VIEW_MASK"));
|
||||
viewMethod->append_text (M("TP_RETINEX_VIEW_UNSHARP"));
|
||||
viewMethod->append_text (M("TP_RETINEX_VIEW_TRAN"));
|
||||
viewMethod->append_text (M("TP_RETINEX_VIEW_TRAN2"));
|
||||
viewMethod->set_active(0);
|
||||
viewMethodConn = viewMethod->signal_changed().connect ( sigc::mem_fun(*this, &Retinex::viewMethodChanged) );
|
||||
viewMethod->set_tooltip_markup (M("TP_RETINEX_VIEW_METHOD_TOOLTIP"));
|
||||
@ -739,8 +741,12 @@ void Retinex::read (const ProcParams* pp, const ParamsEdited* pedited)
|
||||
viewMethod->set_active (0);
|
||||
} else if (pp->retinex.viewMethod == "mask") {
|
||||
viewMethod->set_active (1);
|
||||
} else if (pp->retinex.viewMethod == "tran") {
|
||||
} else if (pp->retinex.viewMethod == "unsharp") {
|
||||
viewMethod->set_active (2);
|
||||
} else if (pp->retinex.viewMethod == "tran") {
|
||||
viewMethod->set_active (3);
|
||||
} else if (pp->retinex.viewMethod == "tran2") {
|
||||
viewMethod->set_active (4);
|
||||
}
|
||||
|
||||
if (pp->retinex.retinexcolorspace == "Lab") {
|
||||
@ -891,7 +897,11 @@ void Retinex::write (ProcParams* pp, ParamsEdited* pedited)
|
||||
} else if (viewMethod->get_active_row_number() == 1) {
|
||||
pp->retinex.viewMethod = "mask";
|
||||
} else if (viewMethod->get_active_row_number() == 2) {
|
||||
pp->retinex.viewMethod = "unsharp";
|
||||
} else if (viewMethod->get_active_row_number() == 3) {
|
||||
pp->retinex.viewMethod = "tran";
|
||||
} else if (viewMethod->get_active_row_number() == 4) {
|
||||
pp->retinex.viewMethod = "tran2";
|
||||
}
|
||||
|
||||
if (retinexcolorspace->get_active_row_number() == 0) {
|
||||
@ -966,31 +976,40 @@ void Retinex::mapMethodChanged()
|
||||
|
||||
void Retinex::viewMethodChanged()
|
||||
{
|
||||
/*
|
||||
if(mapMethod->get_active_row_number() == 1 || mapMethod->get_active_row_number() == 2) {
|
||||
curveEditormap->show();
|
||||
highlights->show();
|
||||
h_tonalwidth->show();
|
||||
shadows->show();
|
||||
s_tonalwidth->show();
|
||||
radius->show();
|
||||
} else if(mapMethod->get_active_row_number() == 3 || mapMethod->get_active_row_number() == 4) {
|
||||
curveEditormap->show();
|
||||
highlights->show();
|
||||
h_tonalwidth->show();
|
||||
shadows->show();
|
||||
s_tonalwidth->show();
|
||||
radius->hide();
|
||||
} else {
|
||||
curveEditormap->hide();
|
||||
highlights->hide();
|
||||
h_tonalwidth->hide();
|
||||
shadows->hide();
|
||||
s_tonalwidth->hide();
|
||||
radius->hide();
|
||||
if(viewMethod->get_active_row_number() == 1 || viewMethod->get_active_row_number() == 2) {
|
||||
vart->hide();
|
||||
gain->hide();
|
||||
offs->hide();
|
||||
limd->hide();
|
||||
transmissionCurveEditorG->hide();
|
||||
medianmap->hide();
|
||||
iter->hide();
|
||||
scal->hide();
|
||||
grad->hide();
|
||||
grads->hide();
|
||||
curveEditorGH->hide();
|
||||
}
|
||||
else if(viewMethod->get_active_row_number() == 3 || viewMethod->get_active_row_number() == 4) {
|
||||
gain->hide();
|
||||
offs->hide();
|
||||
vart->hide();
|
||||
curveEditorGH->hide();
|
||||
}
|
||||
else {
|
||||
vart->show();
|
||||
neigh->show();
|
||||
gain->show();
|
||||
offs->show();
|
||||
limd->show();
|
||||
transmissionCurveEditorG->show();
|
||||
medianmap->show();
|
||||
iter->show();
|
||||
scal->show();
|
||||
grad->show();
|
||||
grads->show();
|
||||
curveEditorGH->show();
|
||||
}
|
||||
|
||||
}
|
||||
*/
|
||||
if (listener) {
|
||||
listener->panelChanged (EvviewMethod, viewMethod->get_active_text ());
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user