Change int by double cbdl - local contrast - shape detection

This commit is contained in:
Desmis 2019-02-22 11:00:55 +01:00
parent 35b8b77d53
commit cc3dd0f6e2
8 changed files with 45 additions and 47 deletions

View File

@ -392,7 +392,7 @@ public:
void dehazeloc(Imagefloat *rgb, float deha, float depth); void dehazeloc(Imagefloat *rgb, float deha, float depth);
void ToneMapFattal02(Imagefloat *rgb); void ToneMapFattal02(Imagefloat *rgb);
void localContrast(LabImage *lab); void localContrast(LabImage *lab);
void localContrastloc(LabImage *lab, int scale, int rad, int amo, int darkn, int lightn, float **loctemp); void localContrastloc(LabImage *lab, int scale, int rad, float amo, float darkn, float lightn, float **loctemp);
void colorToningLabGrid(LabImage *lab, int xstart, int xend, int ystart, int yend, bool MultiThread); void colorToningLabGrid(LabImage *lab, int xstart, int xend, int ystart, int yend, bool MultiThread);
void shadowsHighlights(LabImage *lab); void shadowsHighlights(LabImage *lab);
void softLight(LabImage *lab); void softLight(LabImage *lab);

View File

@ -69,14 +69,14 @@ void ImProcFunctions::localContrast(LabImage *lab)
} }
} }
void ImProcFunctions::localContrastloc(LabImage *lab, int scale, int rad, int amo, int darkn, int lightn, float **loctemp) void ImProcFunctions::localContrastloc(LabImage *lab, int scale, int rad, float amo, float darkn, float lightn, float **loctemp)
{ {
const int width = lab->W; const int width = lab->W;
const int height = lab->H; const int height = lab->H;
const float a = (float)(amo) / 100.f; const float a = amo;
const float dark = (float)(darkn) / 100.f; const float dark = darkn;
const float light = (float)(lightn) / 100.f; const float light = lightn;
array2D<float> buf(width, height); array2D<float> buf(width, height);
const float sigma = (float)(rad) / scale; const float sigma = (float)(rad) / scale;
@ -97,7 +97,6 @@ void ImProcFunctions::localContrastloc(LabImage *lab, int scale, int rad, int am
bufval *= (bufval > 0.f) ? light : dark; bufval *= (bufval > 0.f) ? light : dark;
} }
// lab->L[y][x] = std::max(0.0001f, lab->L[y][x] + bufval);
loctemp[y][x] = std::max(0.0001f, lab->L[y][x] + bufval); loctemp[y][x] = std::max(0.0001f, lab->L[y][x] + bufval);
} }

View File

@ -367,7 +367,7 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall
float thre = locallab.spots.at(sp).thresh; float thre = locallab.spots.at(sp).thresh;
if (thre > 8 || thre < 0) {//to avoid artifacts if user does not clear cache with new settings. Can be suppressed after if (thre > 8.f || thre < 0.f) {//to avoid artifacts if user does not clear cache with new settings. Can be suppressed after
thre = 2.f; thre = 2.f;
} }
@ -442,10 +442,10 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall
float multi[5]; float multi[5];
for (int y = 0; y < 5; y++) { for (int y = 0; y < 5; y++) {
multi[y] = ((float) locallab.spots.at(sp).mult[y]) / 100.f; multi[y] = ((float) locallab.spots.at(sp).mult[y]);
} }
float thresho = ((float)locallab.spots.at(sp).threshold) / 100.f; float thresho = ((float)locallab.spots.at(sp).threshold);
float chromcbdl = (float)locallab.spots.at(sp).chromacbdl; float chromcbdl = (float)locallab.spots.at(sp).chromacbdl;
int local_chroma = locallab.spots.at(sp).chroma; int local_chroma = locallab.spots.at(sp).chroma;
@ -477,7 +477,7 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall
int local_transit = locallab.spots.at(sp).transit; int local_transit = locallab.spots.at(sp).transit;
double radius = (double) locallab.spots.at(sp).radius; double radius = (double) locallab.spots.at(sp).radius;
double sharradius = ((double) locallab.spots.at(sp).sharradius); double sharradius = ((double) locallab.spots.at(sp).sharradius);
double lcamount = ((double) locallab.spots.at(sp).lcamount) / 100.; double lcamount = ((double) locallab.spots.at(sp).lcamount);
double sharblurr = ((double) locallab.spots.at(sp).sharblur); double sharblurr = ((double) locallab.spots.at(sp).sharblur);
int local_sensisha = locallab.spots.at(sp).sensisha; int local_sensisha = locallab.spots.at(sp).sensisha;
int local_sharamount = locallab.spots.at(sp).sharamount; int local_sharamount = locallab.spots.at(sp).sharamount;

View File

@ -2343,7 +2343,7 @@ LocallabParams::LocallabSpot::LocallabSpot() :
spotMethod("norm"), spotMethod("norm"),
sensiexclu(12), sensiexclu(12),
structexclu(0), structexclu(0),
struc(4), struc(4.0),
shapeMethod("IND"), shapeMethod("IND"),
locX(250), locX(250),
locXL(250), locXL(250),
@ -2354,7 +2354,7 @@ LocallabParams::LocallabSpot::LocallabSpot() :
circrad(18), circrad(18),
qualityMethod("enh"), qualityMethod("enh"),
transit(60), transit(60),
thresh(2), thresh(2.0),
iter(2.0), iter(2.0),
// Color & Light // Color & Light
expcolor(false), expcolor(false),
@ -2456,15 +2456,15 @@ LocallabParams::LocallabSpot::LocallabSpot() :
// Local Contrast // Local Contrast
expcontrast(false), expcontrast(false),
lcradius(80), lcradius(80),
lcamount(0), lcamount(0.0),
lcdarkness(100), lcdarkness(1.0),
lclightness(100), lclightness(1.0),
sensilc(19), sensilc(19),
// Contrast by detail levels // Contrast by detail levels
expcbdl(false), expcbdl(false),
mult{100.0, 100.0, 100.0, 100.0, 100.0}, mult{1.0, 1.0, 1.0, 1.0, 1.0},
chromacbdl(0), chromacbdl(0),
threshold(20.0), threshold(0.2),
sensicb(15), sensicb(15),
// Denoise // Denoise
expdenoi(false), expdenoi(false),

View File

@ -943,7 +943,7 @@ struct LocallabParams {
Glib::ustring spotMethod; // norm, exc Glib::ustring spotMethod; // norm, exc
int sensiexclu; int sensiexclu;
int structexclu; int structexclu;
int struc; double struc;
Glib::ustring shapeMethod; // IND, SYM, INDSL, SYMSL Glib::ustring shapeMethod; // IND, SYM, INDSL, SYMSL
int locX; int locX;
int locXL; int locXL;
@ -954,7 +954,7 @@ struct LocallabParams {
int circrad; int circrad;
Glib::ustring qualityMethod; // none, std, enh, enhsup, contr, sob2 Glib::ustring qualityMethod; // none, std, enh, enhsup, contr, sob2
int transit; int transit;
int thresh; double thresh;
double iter; double iter;
// Color & Light // Color & Light
bool expcolor; bool expcolor;
@ -1058,9 +1058,9 @@ struct LocallabParams {
// Local Contrast // Local Contrast
bool expcontrast; bool expcontrast;
int lcradius; int lcradius;
int lcamount; double lcamount;
int lcdarkness; double lcdarkness;
int lclightness; double lclightness;
int sensilc; int sensilc;
// Contrast by detail levels // Contrast by detail levels
bool expcbdl; bool expcbdl;

View File

@ -48,7 +48,7 @@ ControlSpotPanel::ControlSpotPanel():
sensiexclu_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSIEXCLU"), 0, 100, 1, 12))), sensiexclu_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSIEXCLU"), 0, 100, 1, 12))),
structexclu_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_STRUCCOL"), 0, 100, 1, 0))), structexclu_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_STRUCCOL"), 0, 100, 1, 0))),
struc_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_THRES"), 1, 12, 1, 4))), struc_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_THRES"), 1.0, 12.0, 0.1, 4.0))),
locX_(Gtk::manage(new Adjuster(M("TP_LOCAL_WIDTH"), 0, 2250, 1, 250))), locX_(Gtk::manage(new Adjuster(M("TP_LOCAL_WIDTH"), 0, 2250, 1, 250))),
locXL_(Gtk::manage(new Adjuster(M("TP_LOCAL_WIDTH_L"), 0, 2250, 1, 250))), locXL_(Gtk::manage(new Adjuster(M("TP_LOCAL_WIDTH_L"), 0, 2250, 1, 250))),
locY_(Gtk::manage(new Adjuster(M("TP_LOCAL_HEIGHT"), 0, 2250, 1, 250))), locY_(Gtk::manage(new Adjuster(M("TP_LOCAL_HEIGHT"), 0, 2250, 1, 250))),
@ -57,8 +57,8 @@ ControlSpotPanel::ControlSpotPanel():
centerY_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CENTER_Y"), -1000, 1000, 1, 0))), centerY_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CENTER_Y"), -1000, 1000, 1, 0))),
circrad_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CIRCRADIUS"), 2, 150, 1, 18))), circrad_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CIRCRADIUS"), 2, 150, 1, 18))),
transit_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_TRANSIT"), 5, 95, 1, 60))), transit_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_TRANSIT"), 5, 95, 1, 60))),
thresh_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_THRESDELTAE"), 0, 8, 1, 2))), thresh_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_THRESDELTAE"), 0.0, 8.0, 0.1, 2.0))),
iter_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_PROXI"), 0.2, 4., 0.1, 2.))), iter_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_PROXI"), 0.2, 4.0, 0.1, 2.0))),
lastObject_(-1), lastObject_(-1),
lastCoord_(new Coord()), lastCoord_(new Coord()),
@ -232,7 +232,6 @@ ControlSpotPanel::ControlSpotPanel():
artifFrame->set_tooltip_text(M("TP_LOCALLAB_ARTIF_TOOLTIP")); artifFrame->set_tooltip_text(M("TP_LOCALLAB_ARTIF_TOOLTIP"));
ToolParamBlock* const artifBox = Gtk::manage(new ToolParamBlock()); ToolParamBlock* const artifBox = Gtk::manage(new ToolParamBlock());
thresh_->setAdjusterListener(this); thresh_->setAdjusterListener(this);
// struc_->set_tooltip_text(M("TP_LOCALLAB_STRUC_TOOLTIP"));
struc_->setAdjusterListener(this); struc_->setAdjusterListener(this);
artifBox->pack_start(*struc_); artifBox->pack_start(*struc_);
artifBox->pack_start(*thresh_); artifBox->pack_start(*thresh_);
@ -718,7 +717,7 @@ void ControlSpotPanel::adjusterChanged(Adjuster* a, double newval)
} }
if (a == struc_) { if (a == struc_) {
row[spots_.struc] = (int) struc_->getValue(); row[spots_.struc] = struc_->getValue();
if (listener) { if (listener) {
listener->panelChanged(EvLocallabSpotStruc, struc_->getTextValue()); listener->panelChanged(EvLocallabSpotStruc, struc_->getTextValue());
@ -823,7 +822,7 @@ void ControlSpotPanel::adjusterChanged(Adjuster* a, double newval)
} }
if (a == thresh_) { if (a == thresh_) {
row[spots_.thresh] = (int) thresh_->getValue(); row[spots_.thresh] = thresh_->getValue();
if (listener) { if (listener) {
listener->panelChanged(EvLocallabSpotThresh, thresh_->getTextValue()); listener->panelChanged(EvLocallabSpotThresh, thresh_->getTextValue());
@ -1910,7 +1909,7 @@ void ControlSpotPanel::setDefaults(const ProcParams * defParams, const ParamsEdi
sensiexclu_->setDefault((double)defSpot->sensiexclu); sensiexclu_->setDefault((double)defSpot->sensiexclu);
structexclu_->setDefault((double)defSpot->structexclu); structexclu_->setDefault((double)defSpot->structexclu);
struc_->setDefault((double)defSpot->struc); struc_->setDefault(defSpot->struc);
locX_->setDefault((double)defSpot->locX); locX_->setDefault((double)defSpot->locX);
locXL_->setDefault((double)defSpot->locXL); locXL_->setDefault((double)defSpot->locXL);
locY_->setDefault((double)defSpot->locY); locY_->setDefault((double)defSpot->locY);
@ -1919,7 +1918,7 @@ void ControlSpotPanel::setDefaults(const ProcParams * defParams, const ParamsEdi
centerY_->setDefault((double)defSpot->centerY); centerY_->setDefault((double)defSpot->centerY);
circrad_->setDefault((double)defSpot->circrad); circrad_->setDefault((double)defSpot->circrad);
transit_->setDefault((double)defSpot->transit); transit_->setDefault((double)defSpot->transit);
thresh_->setDefault((double)defSpot->thresh); thresh_->setDefault(defSpot->thresh);
// iter_->setDefault((double)defSpot->iter); // iter_->setDefault((double)defSpot->iter);
iter_->setDefault(defSpot->iter); iter_->setDefault(defSpot->iter);

View File

@ -49,7 +49,7 @@ public:
int spotMethod; // 0 = Normal, 1 = Excluding int spotMethod; // 0 = Normal, 1 = Excluding
int sensiexclu; int sensiexclu;
int structexclu; int structexclu;
int struc; double struc;
int shapeMethod; // 0 = Independent (mouse), 1 = Symmetrical (mouse), 2 = Independent (mouse + sliders), 3 = Symmetrical (mouse + sliders) int shapeMethod; // 0 = Independent (mouse), 1 = Symmetrical (mouse), 2 = Independent (mouse + sliders), 3 = Symmetrical (mouse + sliders)
int locX; int locX;
int locXL; int locXL;
@ -60,7 +60,7 @@ public:
int circrad; int circrad;
int qualityMethod; // 0 = Standard, 1 = Enhanced, 2 = Enhanced + chroma denoise int qualityMethod; // 0 = Standard, 1 = Enhanced, 2 = Enhanced + chroma denoise
int transit; int transit;
int thresh; double thresh;
double iter; double iter;
}; };
@ -261,7 +261,7 @@ private:
Gtk::TreeModelColumn<int> spotMethod; // 0 = Normal, 1 = Excluding Gtk::TreeModelColumn<int> spotMethod; // 0 = Normal, 1 = Excluding
Gtk::TreeModelColumn<int> sensiexclu; Gtk::TreeModelColumn<int> sensiexclu;
Gtk::TreeModelColumn<int> structexclu; Gtk::TreeModelColumn<int> structexclu;
Gtk::TreeModelColumn<int> struc; Gtk::TreeModelColumn<double> struc;
Gtk::TreeModelColumn<int> shapeMethod; // 0 = Independent (mouse), 1 = Symmetrical (mouse), 2 = Independent (mouse + sliders), 3 = Symmetrical (mouse + sliders) Gtk::TreeModelColumn<int> shapeMethod; // 0 = Independent (mouse), 1 = Symmetrical (mouse), 2 = Independent (mouse + sliders), 3 = Symmetrical (mouse + sliders)
Gtk::TreeModelColumn<int> locX; Gtk::TreeModelColumn<int> locX;
Gtk::TreeModelColumn<int> locXL; Gtk::TreeModelColumn<int> locXL;
@ -272,7 +272,7 @@ private:
Gtk::TreeModelColumn<int> circrad; Gtk::TreeModelColumn<int> circrad;
Gtk::TreeModelColumn<int> qualityMethod; // 0 = Standard, 1 = Enhanced, 2 = Enhanced + chroma denoise Gtk::TreeModelColumn<int> qualityMethod; // 0 = Standard, 1 = Enhanced, 2 = Enhanced + chroma denoise
Gtk::TreeModelColumn<int> transit; Gtk::TreeModelColumn<int> transit;
Gtk::TreeModelColumn<int> thresh; Gtk::TreeModelColumn<double> thresh;
Gtk::TreeModelColumn<double> iter; Gtk::TreeModelColumn<double> iter;
}; };

View File

@ -128,13 +128,13 @@ Locallab::Locallab():
sensisha(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSIS"), 0, 100, 1, 19))), sensisha(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSIS"), 0, 100, 1, 19))),
// Local Contrast // Local Contrast
lcradius(Gtk::manage(new Adjuster(M("TP_LOCALCONTRAST_RADIUS"), 20, 200, 1, 80))), lcradius(Gtk::manage(new Adjuster(M("TP_LOCALCONTRAST_RADIUS"), 20, 200, 1, 80))),
lcamount(Gtk::manage(new Adjuster(M("TP_LOCALCONTRAST_AMOUNT"), 0, 100, 1, 0))), lcamount(Gtk::manage(new Adjuster(M("TP_LOCALCONTRAST_AMOUNT"), 0, 1.0, 0.01, 0))),
lcdarkness(Gtk::manage(new Adjuster(M("TP_LOCALCONTRAST_DARKNESS"), 0, 300, 1, 100))), lcdarkness(Gtk::manage(new Adjuster(M("TP_LOCALCONTRAST_DARKNESS"), 0, 3.0, 0.01, 1.0))),
lclightness(Gtk::manage(new Adjuster(M("TP_LOCALCONTRAST_LIGHTNESS"), 0, 300, 1, 100))), lclightness(Gtk::manage(new Adjuster(M("TP_LOCALCONTRAST_LIGHTNESS"), 0, 3.0, 0.01, 1.0))),
sensilc(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSIS"), 0, 100, 1, 19))), sensilc(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSIS"), 0, 100, 1, 19))),
// Contrast by detail levels // Contrast by detail levels
chromacbdl(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CHROMACBDL"), 0, 300, 1, 0))), chromacbdl(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CHROMACBDL"), 0, 300, 1, 0))),
threshold(Gtk::manage(new Adjuster(M("TP_DIRPYREQUALIZER_THRESHOLD"), 0, 100, 1, 20))), threshold(Gtk::manage(new Adjuster(M("TP_DIRPYREQUALIZER_THRESHOLD"), 0, 1., 0.01, 0.2))),
sensicb(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSICB"), 0, 100, 1, 15))), sensicb(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSICB"), 0, 100, 1, 15))),
// Denoise // Denoise
noiselumf(Gtk::manage(new Adjuster(M("TP_LOCALLAB_NOISELUMFINE"), MINCHRO, MAXCHRO, 1, 0))), noiselumf(Gtk::manage(new Adjuster(M("TP_LOCALLAB_NOISELUMFINE"), MINCHRO, MAXCHRO, 1, 0))),
@ -744,7 +744,7 @@ Locallab::Locallab():
ss += Glib::ustring::compose(" (%1)", M("TP_DIRPYREQUALIZER_LUMACOARSEST")); ss += Glib::ustring::compose(" (%1)", M("TP_DIRPYREQUALIZER_LUMACOARSEST"));
} }
multiplier[i] = Gtk::manage(new Adjuster(ss, 0, 400, 1, 100)); multiplier[i] = Gtk::manage(new Adjuster(ss, 0.0, 4.0, 0.01, 1.0));
multiplier[i]->setAdjusterListener(this); multiplier[i]->setAdjusterListener(this);
} }
@ -1026,7 +1026,7 @@ void Locallab::lumaneutralPressed()
// printf("lumaneutralPressed\n"); // printf("lumaneutralPressed\n");
for (int i = 0; i < 5; i++) { for (int i = 0; i < 5; i++) {
multiplier[i]->setValue(100); multiplier[i]->setValue(1.0);
} }
// Raise event (only for first multiplier because associated event concerns all multipliers) // Raise event (only for first multiplier because associated event concerns all multipliers)
@ -1621,15 +1621,15 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited)
// Local Contrast // Local Contrast
pp->locallab.spots.at(pp->locallab.selspot).expcontrast = expcontrast->getEnabled(); pp->locallab.spots.at(pp->locallab.selspot).expcontrast = expcontrast->getEnabled();
pp->locallab.spots.at(pp->locallab.selspot).lcradius = lcradius->getIntValue(); pp->locallab.spots.at(pp->locallab.selspot).lcradius = lcradius->getIntValue();
pp->locallab.spots.at(pp->locallab.selspot).lcamount = lcamount->getIntValue(); pp->locallab.spots.at(pp->locallab.selspot).lcamount = lcamount->getValue();
pp->locallab.spots.at(pp->locallab.selspot).lcdarkness = lcdarkness->getIntValue(); pp->locallab.spots.at(pp->locallab.selspot).lcdarkness = lcdarkness->getValue();
pp->locallab.spots.at(pp->locallab.selspot).lclightness = lclightness->getIntValue(); pp->locallab.spots.at(pp->locallab.selspot).lclightness = lclightness->getValue();
pp->locallab.spots.at(pp->locallab.selspot).sensilc = sensilc->getIntValue(); pp->locallab.spots.at(pp->locallab.selspot).sensilc = sensilc->getIntValue();
// Contrast by detail levels // Contrast by detail levels
pp->locallab.spots.at(pp->locallab.selspot).expcbdl = expcbdl->getEnabled(); pp->locallab.spots.at(pp->locallab.selspot).expcbdl = expcbdl->getEnabled();
for (int i = 0; i < 5; i++) { for (int i = 0; i < 5; i++) {
pp->locallab.spots.at(pp->locallab.selspot).mult[i] = multiplier[i]->getIntValue(); pp->locallab.spots.at(pp->locallab.selspot).mult[i] = multiplier[i]->getValue();
} }
pp->locallab.spots.at(pp->locallab.selspot).chromacbdl = chromacbdl->getIntValue(); pp->locallab.spots.at(pp->locallab.selspot).chromacbdl = chromacbdl->getIntValue();
@ -2645,9 +2645,9 @@ void Locallab::setDefaults(const ProcParams * defParams, const ParamsEdited * pe
sensisha->setDefault((double)defSpot->sensisha); sensisha->setDefault((double)defSpot->sensisha);
// Local Contrast // Local Contrast
lcradius->setDefault((double)defSpot->lcradius); lcradius->setDefault((double)defSpot->lcradius);
lcamount->setDefault((double)defSpot->lcamount); lcamount->setDefault(defSpot->lcamount);
lcdarkness->setDefault((double)defSpot->lcdarkness); lcdarkness->setDefault(defSpot->lcdarkness);
lclightness->setDefault((double)defSpot->lclightness); lclightness->setDefault(defSpot->lclightness);
sensilc->setDefault((double)defSpot->sensilc); sensilc->setDefault((double)defSpot->sensilc);
// Contrast by detail levels // Contrast by detail levels