Improve mask exposure with guidefilter
This commit is contained in:
@@ -145,6 +145,7 @@ struct local_params {
|
||||
float struexc;
|
||||
float blendmacol;
|
||||
float radmacol;
|
||||
float radmaexp;
|
||||
float blendmaexp;
|
||||
float struexp;
|
||||
float blurexp;
|
||||
@@ -467,6 +468,7 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall
|
||||
float blendmaskcolor = ((float) locallab.spots.at(sp).blendmaskcol) / 100.f ;
|
||||
float radmaskcolor = ((float) locallab.spots.at(sp).radmaskcol);
|
||||
float blendmaskexpo = ((float) locallab.spots.at(sp).blendmaskexp) / 100.f ;
|
||||
float radmaskexpo = ((float) locallab.spots.at(sp).radmaskexp);
|
||||
float structexpo = (float) locallab.spots.at(sp).structexp;
|
||||
float blurexpo = (float) locallab.spots.at(sp).blurexpde;
|
||||
float blurcolor = (float) locallab.spots.at(sp).blurcolde;
|
||||
@@ -515,6 +517,7 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall
|
||||
lp.strengrid = strengthgrid;
|
||||
lp.blendmacol = blendmaskcolor;
|
||||
lp.radmacol = radmaskcolor;
|
||||
lp.radmaexp = radmaskexpo;
|
||||
lp.struexc = structexclude;
|
||||
lp.blendmaexp = blendmaskexpo;
|
||||
lp.struexp = structexpo;
|
||||
@@ -7277,6 +7280,8 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o
|
||||
|
||||
}
|
||||
|
||||
array2D<float> ble(bfw, bfh);
|
||||
array2D<float> guid(bfw, bfh);
|
||||
|
||||
#ifdef _OPENMP
|
||||
#pragma omp parallel for schedule(dynamic,16)
|
||||
@@ -7351,14 +7356,34 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o
|
||||
bufmaskblurexp->L[loy - begy][lox - begx] = CLIPLOC(kmaskLexp + kmaskHL);
|
||||
bufmaskblurexp->a[loy - begy][lox - begx] = CLIPC(kmaskCa + kmaskHa);
|
||||
bufmaskblurexp->b[loy - begy][lox - begx] = CLIPC(kmaskCb + kmaskHb);
|
||||
ble[loy - begy][lox - begx] = bufmaskblurexp->L[loy - begy][lox - begx] / 32768.f;
|
||||
guid[loy - begy][lox - begx] = bufexporig->L[loy - begy][lox - begx] / 32768.f;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if ((lp.showmaskexpmet == 2 || lp.enaExpMask || lp.showmaskexpmet == 3) && lp.radmaexp > 0.f) {
|
||||
|
||||
float radiusb = 3.f / sk;
|
||||
guidedFilter(guid, ble, ble, lp.radmaexp * 10.f / sk, 0.075, multiThread, 4);
|
||||
|
||||
#ifdef _OPENMP
|
||||
#pragma omp parallel for schedule(dynamic,16)
|
||||
#endif
|
||||
|
||||
for (int y = 0; y < transformed->H ; y++) //{
|
||||
for (int x = 0; x < transformed->W; x++) {
|
||||
int lox = cx + x;
|
||||
int loy = cy + y;
|
||||
|
||||
if (lox >= begx && lox < xEn && loy >= begy && loy < yEn) {
|
||||
bufmaskblurexp->L[loy - begy][lox - begx] = ble[loy - begy][lox - begx] * 32768.f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
float radiusb = 1.f / sk;
|
||||
|
||||
if (lp.showmaskexpmet == 2 || lp.enaExpMask || lp.showmaskexpmet == 3) {
|
||||
|
||||
@@ -7367,8 +7392,8 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o
|
||||
#endif
|
||||
{
|
||||
gaussianBlur(bufmaskblurexp->L, bufmaskorigexp->L, bfw, bfh, radiusb);
|
||||
gaussianBlur(bufmaskblurexp->a, bufmaskorigexp->a, bfw, bfh, radiusb);
|
||||
gaussianBlur(bufmaskblurexp->b, bufmaskorigexp->b, bfw, bfh, radiusb);
|
||||
gaussianBlur(bufmaskblurexp->a, bufmaskorigexp->a, bfw, bfh, 1.f + (0.2f * lp.radmaexp) / sk);
|
||||
gaussianBlur(bufmaskblurexp->b, bufmaskorigexp->b, bfw, bfh, 1.f + (0.2f * lp.radmaexp) / sk);
|
||||
}
|
||||
|
||||
delete bufmaskblurexp;
|
||||
|
||||
@@ -661,6 +661,7 @@ enum ProcEventCode {
|
||||
Evlocallabsh_radius = 631,
|
||||
Evlocallabsensihs = 632,
|
||||
Evlocallabradmaskcol = 633,
|
||||
Evlocallabradmaskexp = 634,
|
||||
NUMOFEVENTS
|
||||
};
|
||||
|
||||
|
||||
@@ -2403,6 +2403,7 @@ LocallabParams::LocallabSpot::LocallabSpot() :
|
||||
LLmaskexpcurve{(double)FCT_MinMaxCPoints, 0.0, 1.0, 0.35, 0.35, 0.50, 1.0, 0.35, 0.35, 1.0, 1.0, 0.35, 0.35},
|
||||
HHmaskexpcurve{(double)FCT_MinMaxCPoints, 0.0, 1.0, 0.35, 0.35, 0.50, 1.0, 0.35, 0.35, 1.0, 1.0, 0.35, 0.35},
|
||||
blendmaskexp(0),
|
||||
radmaskexp(10.0),
|
||||
// Shadow highlight
|
||||
expshadhigh(false),
|
||||
highlights(0),
|
||||
@@ -2561,6 +2562,7 @@ bool LocallabParams::LocallabSpot::operator ==(const LocallabSpot& other) const
|
||||
&& LLmaskexpcurve == other.LLmaskexpcurve
|
||||
&& HHmaskexpcurve == other.HHmaskexpcurve
|
||||
&& blendmaskexp == other.blendmaskexp
|
||||
&& radmaskexp == other.radmaskexp
|
||||
// Shadow highlight
|
||||
&& expshadhigh == other.expshadhigh
|
||||
&& highlights == other.highlights
|
||||
@@ -3674,6 +3676,7 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo
|
||||
saveToKeyfile(!pedited || pedited->locallab.spots.at(i).LLmaskexpcurve, "Locallab", "LLmaskexpCurve_" + std::to_string(i), spot.LLmaskexpcurve, keyFile);
|
||||
saveToKeyfile(!pedited || pedited->locallab.spots.at(i).HHmaskexpcurve, "Locallab", "HHmaskexpCurve_" + std::to_string(i), spot.HHmaskexpcurve, keyFile);
|
||||
saveToKeyfile(!pedited || pedited->locallab.spots.at(i).blendmaskexp, "Locallab", "Blendmaskexp_" + std::to_string(i), spot.blendmaskexp, keyFile);
|
||||
saveToKeyfile(!pedited || pedited->locallab.spots.at(i).radmaskexp, "Locallab", "Radmaskexp_" + std::to_string(i), spot.radmaskexp, keyFile);
|
||||
// Shadow highlight
|
||||
saveToKeyfile(!pedited || pedited->locallab.spots.at(i).expshadhigh, "Locallab", "Expshadhigh_" + std::to_string(i), spot.expshadhigh, keyFile);
|
||||
saveToKeyfile(!pedited || pedited->locallab.spots.at(i).highlights, "Locallab", "highlights_" + std::to_string(i), spot.highlights, keyFile);
|
||||
@@ -4916,6 +4919,7 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited)
|
||||
assignFromKeyfile(keyFile, "Locallab", "LLmaskexpCurve_" + std::to_string(i), pedited, spot.LLmaskexpcurve, spotEdited.LLmaskexpcurve);
|
||||
assignFromKeyfile(keyFile, "Locallab", "HHmaskexpCurve_" + std::to_string(i), pedited, spot.HHmaskexpcurve, spotEdited.HHmaskexpcurve);
|
||||
assignFromKeyfile(keyFile, "Locallab", "Blendmaskexp_" + std::to_string(i), pedited, spot.blendmaskexp, spotEdited.blendmaskexp);
|
||||
assignFromKeyfile(keyFile, "Locallab", "Radmaskexp_" + std::to_string(i), pedited, spot.radmaskexp, spotEdited.radmaskexp);
|
||||
// Shadow highlight
|
||||
assignFromKeyfile(keyFile, "Locallab", "Expshadhigh_" + std::to_string(i), pedited, spot.expshadhigh, spotEdited.expshadhigh);
|
||||
assignFromKeyfile(keyFile, "Locallab", "highlights_" + std::to_string(i), pedited, spot.highlights, spotEdited.highlights);
|
||||
|
||||
@@ -1004,6 +1004,7 @@ struct LocallabParams {
|
||||
std::vector<double> LLmaskexpcurve;
|
||||
std::vector<double> HHmaskexpcurve;
|
||||
int blendmaskexp;
|
||||
double radmaskexp;
|
||||
// Shadow highlight
|
||||
bool expshadhigh;
|
||||
int highlights;
|
||||
|
||||
@@ -660,7 +660,8 @@ int refreshmap[rtengine::NUMOFEVENTS] = {
|
||||
LUMINANCECURVE, //EvLocallabs_tonalwidth
|
||||
LUMINANCECURVE, //EvLocallabsh_radius
|
||||
LUMINANCECURVE, //EvLocallabsensihs
|
||||
LUMINANCECURVE //Evlocallabradmaskcol
|
||||
LUMINANCECURVE, //Evlocallabradmaskcol
|
||||
LUMINANCECURVE //Evlocallabradmaskexp
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user