First version Retinex with maskss
This commit is contained in:
parent
b3576854f8
commit
aa2f68b742
@ -922,6 +922,16 @@ HISTORY_MSG_675;Local - TM soft radius
|
||||
HISTORY_MSG_676;Local Spot transition-differentiation
|
||||
HISTORY_MSG_677;Local - TM amount
|
||||
HISTORY_MSG_678;Local - TM saturation
|
||||
HISTORY_MSG_679;Local - Retinex mask C
|
||||
HISTORY_MSG_680;Local - Retinex mask L
|
||||
HISTORY_MSG_681;Local - Retinex mask CL
|
||||
HISTORY_MSG_682;Local - Retinex mask
|
||||
HISTORY_MSG_683;Local - Retinex mask Blend
|
||||
HISTORY_MSG_684;Local - Retinex mask radius
|
||||
HISTORY_MSG_685;Local - Retinex mask chroma
|
||||
HISTORY_MSG_686;Local - Retinex mask gamma
|
||||
HISTORY_MSG_687;Local - Retinex mask slope
|
||||
HISTORY_MSG_689;Local - Retinex mask transmission map
|
||||
HISTORY_MSG_CLAMPOOG;Clip out-of-gamut colors
|
||||
HISTORY_MSG_COLORTONING_LABGRID_VALUE;CT - Color correction
|
||||
HISTORY_MSG_COLORTONING_LABREGION_AB;CT - Color correction
|
||||
@ -2119,6 +2129,7 @@ TP_LOCALLAB_STYPE_TOOLTIP;You can choose between:\nSymmetrical - left handle lin
|
||||
TP_LOCALLAB_SYMSL;Symmetrical (mouse + sliders)
|
||||
TP_LOCALLAB_SYM;Symmetrical (mouse)
|
||||
TP_LOCALLAB_CURVEEDITOR_TONES_LABEL;Tone curve
|
||||
TP_LOCALLAB_TM_MASK;Use transmission map
|
||||
TP_LOCALLAB_TRANSIT;Transition Gradient
|
||||
TP_LOCALLAB_TRANSIT_TOOLTIP;Adjust smoothness of transition between affected and unaffected areas.
|
||||
TP_LOCALLAB_TRANSITVALUE;Transition value
|
||||
|
@ -297,7 +297,8 @@ public:
|
||||
void idirpyr(LabImage* data_coarse, LabImage* data_fine, int level, LUTf &rangefn_L, LUTf & nrwt_l, LUTf & nrwt_ab,
|
||||
int pitch, int scale, const int luma, const int chroma/*, LUTf & Lcurve, LUTf & abcurve*/);
|
||||
//locallab
|
||||
void MSRLocal(int sp, float** luminance, float** templ, const float* const *originalLuminance, const int width, const int height, const procparams::LocallabParams &loc, const int skip, const LocretigainCurve &locRETgainCcurve, const int chrome, const int scall, const float krad, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax);
|
||||
void MSRLocal(int sp, int lum, LabImage * bufreti, LabImage * bufmask, float** luminance, float** templ, const float* const *originalLuminance, const int width, const int height, const procparams::LocallabParams &loc, const int skip, const LocretigainCurve &locRETgainCcurve, const int chrome, const int scall, const float krad, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax,
|
||||
const LocCCmaskretiCurve & locccmasretiCurve, bool &lcmasretiutili, const LocLLmaskretiCurve & locllmasretiCurve, bool &llmasretiutili, const LocHHmaskretiCurve & lochhmasretiCurve, bool & lhmasretiutili, int llretiMask, LabImage * transformed, bool retiMasktmap, bool retiMask);
|
||||
void calc_ref(int sp, LabImage* original, LabImage* transformed, int cx, int cy, int oW, int oH, int sk, double &huerefblur, double &chromarefblur, double &lumarefblur, double &hueref, double &chromaref, double &lumaref, double &sobelref, float &avg);
|
||||
void copy_ref(LabImage* spotbuffer, LabImage* original, LabImage* transformed, int cx, int cy, int sk, const struct local_params & lp, double &huerefspot, double &chromarefspot, double &lumarefspot);
|
||||
void paste_ref(LabImage* spotbuffer, LabImage* transformed, int cx, int cy, int sk, const struct local_params & lp);
|
||||
@ -314,7 +315,7 @@ public:
|
||||
static void strcurv_data(std::string retistr, int *s_datc, int &siz);
|
||||
void blendstruc(int bfw, int bfh, LabImage* bufcolorig, float radius, float stru, array2D<float> & blend2, int sk, bool multiThread);
|
||||
|
||||
void transit_shapedetect_retinex(int senstype, LabImage * bufexporig, float **buflight, float **bufchro, const float hueref, const float chromaref, const float lumaref, const struct local_params & lp, LabImage * original, LabImage * transformed, int cx, int cy, int sk);
|
||||
void transit_shapedetect_retinex(int senstype, LabImage * bufexporig, LabImage * bufmask, float **buflight, float **bufchro, const float hueref, const float chromaref, const float lumaref, const struct local_params & lp, LabImage * original, LabImage * transformed, int cx, int cy, int sk);
|
||||
void transit_shapedetect(int senstype, const LabImage *bufexporig, LabImage * originalmask, float **buflight, float **bufchro, float **buf_a_cat, float ** buf_b_cat, float ** bufhh, bool HHutili, const float hueref, const float chromaref, const float lumaref, float sobelref, float meansobel, float ** blend2, const struct local_params & lp, LabImage * original, LabImage * transformed, int cx, int cy, int sk);
|
||||
void exlabLocal(const local_params& lp, int bfh, int bfw, LabImage* bufexporig, LabImage* lab, LUTf & hltonecurve, LUTf & shtonecurve, LUTf & tonecurve);
|
||||
void Exclude_Local(float **deltaso, float hueref, float chromaref, float lumaref, float sobelref, float meansobel, const struct local_params & lp, const LabImage * original, LabImage * transformed, const LabImage * rsv, const LabImage * reserv, int cx, int cy, int sk);
|
||||
|
@ -244,6 +244,7 @@ struct local_params {
|
||||
int showmaskexpmet;
|
||||
int showmaskSHmet;
|
||||
int showmaskcbmet;
|
||||
int showmaskretimet;
|
||||
int blurmet;
|
||||
float noiself;
|
||||
float noiself0;
|
||||
@ -293,11 +294,18 @@ struct local_params {
|
||||
bool enaExpMask;
|
||||
bool enaSHMask;
|
||||
bool enacbMask;
|
||||
bool enaretiMask;
|
||||
bool enaretiMasktmap;
|
||||
int highlihs;
|
||||
int shadowhs;
|
||||
int radiushs;
|
||||
int hltonalhs;
|
||||
int shtonalhs;
|
||||
float radmareti;
|
||||
float blendmareti;
|
||||
float chromareti;
|
||||
float gammareti;
|
||||
float slomareti;
|
||||
};
|
||||
|
||||
static void SobelCannyLuma(float **sobelL, float **luma, int bfw, int bfh, float radius, bool multiThread = false)
|
||||
@ -380,7 +388,7 @@ static void SobelCannyLuma(float **sobelL, float **luma, int bfw, int bfh, float
|
||||
|
||||
|
||||
|
||||
static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locallab, struct local_params& lp, int llColorMask, int llExpMask, int llSHMask, int llcbMask)
|
||||
static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locallab, struct local_params& lp, int llColorMask, int llExpMask, int llSHMask, int llcbMask, int llretiMask)
|
||||
{
|
||||
int w = oW;
|
||||
int h = oH;
|
||||
@ -444,10 +452,14 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall
|
||||
lp.showmaskexpmet = llExpMask;
|
||||
lp.showmaskSHmet = llSHMask;
|
||||
lp.showmaskcbmet = llcbMask;
|
||||
lp.enaColorMask = locallab.spots.at(sp).enaColorMask && llColorMask == 0 && llExpMask == 0 && llSHMask == 0 && llcbMask == 0;; // Color & Light mask is deactivated if Exposure mask is visible
|
||||
lp.enaExpMask = locallab.spots.at(sp).enaExpMask && llExpMask == 0 && llColorMask == 0 && llSHMask == 0 && llcbMask == 0;; // Exposure mask is deactivated if Color & Light mask is visible
|
||||
lp.enaSHMask = locallab.spots.at(sp).enaSHMask && llSHMask == 0 && llColorMask == 0 && llExpMask == 0 && llcbMask == 0;; //
|
||||
lp.enacbMask = locallab.spots.at(sp).enacbMask && llcbMask == 0 && llColorMask == 0 && llExpMask == 0 && llSHMask == 0;;
|
||||
lp.showmaskretimet = llretiMask;
|
||||
printf("llretiMask=%i\n", llretiMask);
|
||||
if(locallab.spots.at(sp).enaretiMask) printf("enaritrue\n"); else printf("enaritfalse\n");
|
||||
lp.enaExpMask = locallab.spots.at(sp).enaExpMask && llExpMask == 0 && llColorMask == 0 && llSHMask == 0 && llcbMask == 0 && llretiMask == 0;// Exposure mask is deactivated if Color & Light mask is visible
|
||||
lp.enaSHMask = locallab.spots.at(sp).enaSHMask && llSHMask == 0 && llColorMask == 0 && llExpMask == 0 && llcbMask == 0 && llretiMask == 0;
|
||||
lp.enacbMask = locallab.spots.at(sp).enacbMask && llcbMask == 0 && llColorMask == 0 && llExpMask == 0 && llSHMask == 0 && llretiMask == 0;
|
||||
lp.enaretiMask = locallab.spots.at(sp).enaretiMask;// && llretiMask == 0 ;// && llColorMask == 0 && llExpMask == 0 && llSHMask == 0 && llcbMask == 0;
|
||||
if(lp.enaretiMask) printf("lp.enaretiMasktrue\n"); else printf("lp.enaretiMaskfalse\n");
|
||||
|
||||
|
||||
if (locallab.spots.at(sp).blurMethod == "norm") {
|
||||
@ -575,7 +587,8 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall
|
||||
float chromaskcb = ((float) locallab.spots.at(sp).chromaskcb);
|
||||
float gammaskcb = ((float) locallab.spots.at(sp).gammaskcb);
|
||||
float slomaskcb = ((float) locallab.spots.at(sp).slomaskcb);
|
||||
|
||||
bool enaretiMasktm = locallab.spots.at(sp).enaretiMasktmap;
|
||||
lp.enaretiMasktmap = enaretiMasktm;
|
||||
lp.cir = circr;
|
||||
lp.actsp = acti;
|
||||
lp.xc = w * local_center_x;
|
||||
@ -698,21 +711,21 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall
|
||||
|
||||
lp.threshol = thresho;
|
||||
lp.chromacb = chromcbdl;
|
||||
lp.colorena = locallab.spots.at(sp).expcolor && llExpMask == 0 && llSHMask == 0; // Color & Light tool is deactivated if Exposure mask is visible or SHMask
|
||||
lp.colorena = locallab.spots.at(sp).expcolor && llExpMask == 0 && llSHMask == 0 && llcbMask == 0 && llretiMask == 0; // Color & Light tool is deactivated if Exposure mask is visible or SHMask
|
||||
lp.blurena = locallab.spots.at(sp).expblur;
|
||||
lp.tonemapena = locallab.spots.at(sp).exptonemap;
|
||||
lp.retiena = locallab.spots.at(sp).expreti;
|
||||
lp.retiena = locallab.spots.at(sp).expreti && llExpMask == 0 && llSHMask == 0 && llcbMask == 0 && llColorMask == 0;
|
||||
lp.sharpena = locallab.spots.at(sp).expsharp;
|
||||
lp.lcena = locallab.spots.at(sp).expcontrast;
|
||||
lp.sfena = locallab.spots.at(sp).expsoft;
|
||||
lp.cbdlena = locallab.spots.at(sp).expcbdl;
|
||||
lp.cbdlena = locallab.spots.at(sp).expcbdl && llExpMask == 0 && llSHMask == 0 && llretiMask == 0 && llColorMask == 0 ;
|
||||
lp.denoiena = locallab.spots.at(sp).expdenoi;
|
||||
lp.expvib = locallab.spots.at(sp).expvibrance;
|
||||
lp.sensv = local_sensiv;
|
||||
lp.past = chromaPastel;
|
||||
lp.satur = chromaSatur;
|
||||
|
||||
lp.exposena = locallab.spots.at(sp).expexpose && llColorMask == 0 && llSHMask == 0; // Exposure tool is deactivated if Color & Light mask SHmask is visible
|
||||
lp.exposena = locallab.spots.at(sp).expexpose && llColorMask == 0 && llSHMask == 0 && llcbMask == 0 && llretiMask == 0; // Exposure tool is deactivated if Color & Light mask SHmask is visible
|
||||
lp.cut_past = cupas;
|
||||
lp.blac = locallab.spots.at(sp).black;
|
||||
lp.shcomp = locallab.spots.at(sp).shcompr;
|
||||
@ -723,7 +736,7 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall
|
||||
lp.expchroma = locallab.spots.at(sp).expchroma / 100.;
|
||||
lp.sensex = local_sensiex;
|
||||
lp.war = local_warm;
|
||||
lp.hsena = locallab.spots.at(sp).expshadhigh && llColorMask == 0 && llExpMask == 0;// Shadow Highlight tool is deactivated if Color & Light mask or SHmask is visible
|
||||
lp.hsena = locallab.spots.at(sp).expshadhigh && llColorMask == 0 && llExpMask == 0 && llcbMask == 0 && llretiMask == 0 && llcbMask == 0;// Shadow Highlight tool is deactivated if Color & Light mask or SHmask is visible
|
||||
lp.highlihs = highhs;
|
||||
lp.shadowhs = shadhs;
|
||||
lp.radiushs = radhs;
|
||||
@ -2248,7 +2261,7 @@ void ImProcFunctions::Exclude_Local(float **deltaso, float hueref, float chromar
|
||||
}
|
||||
}
|
||||
|
||||
void ImProcFunctions::transit_shapedetect_retinex(int senstype, LabImage * bufexporig, float **buflight, float **bufchro, const float hueref, const float chromaref, const float lumaref, const struct local_params & lp, LabImage * original, LabImage * transformed, int cx, int cy, int sk)
|
||||
void ImProcFunctions::transit_shapedetect_retinex(int senstype, LabImage * bufexporig, LabImage * bufmask, float **buflight, float **bufchro, const float hueref, const float chromaref, const float lumaref, const struct local_params & lp, LabImage * original, LabImage * transformed, int cx, int cy, int sk)
|
||||
{
|
||||
|
||||
BENCHFUN {
|
||||
@ -2260,12 +2273,15 @@ void ImProcFunctions::transit_shapedetect_retinex(int senstype, LabImage * bufex
|
||||
|
||||
const float refa = chromaref * cos(hueref);
|
||||
const float refb = chromaref * sin(hueref);
|
||||
const bool retishow = ((lp.showmaskretimet == 1 || lp.showmaskretimet == 2) && senstype == 4);
|
||||
const bool previewreti = ((lp.showmaskretimet == 4) && senstype == 4);
|
||||
|
||||
//balance deltaE
|
||||
float kL = lp.balance;
|
||||
float kab = 1.f;
|
||||
balancedeltaE(kL, kab);
|
||||
|
||||
bool showmas = false ;
|
||||
if(lp.showmaskretimet == 3) showmas = true;
|
||||
std::unique_ptr<LabImage> origblur(new LabImage(GW, GH));
|
||||
const float radius = 3.f / sk;
|
||||
|
||||
@ -2327,7 +2343,8 @@ void ImProcFunctions::transit_shapedetect_retinex(int senstype, LabImage * bufex
|
||||
const float dE = sqrt(kab * SQR(refa - origblur->a[y][x] / 327.68f) + kab * SQR(refb - origblur->b[y][x] / 327.68f) + kL * SQR(lumaref - rL));
|
||||
|
||||
float cli = buflight[loy - begy][lox - begx];
|
||||
float clc = bufchro[loy - begy][lox - begx];
|
||||
//float clc = bufchro[loy - begy][lox - begx];
|
||||
float clc = previewreti ? settings->previewselection * 100.f : bufchro[loy - begy][lox - begx];
|
||||
|
||||
float reducdE;
|
||||
|
||||
@ -2340,12 +2357,16 @@ void ImProcFunctions::transit_shapedetect_retinex(int senstype, LabImage * bufex
|
||||
|
||||
if (rL > 0.1f) { //to avoid crash with very low gamut in rare cases ex : L=0.01 a=0.5 b=-0.9
|
||||
if (senstype == 4) {//all except color and light (TODO) and exposure
|
||||
float lightc = bufexporig->L[loy - begy][lox - begx];
|
||||
float fli = 1.f + cli;
|
||||
// float lightc = bufexporig->L[loy - begy][lox - begx];
|
||||
// float fli = 1.f + cli;
|
||||
float diflc;// = lightc * fli - original->L[y][x];
|
||||
diflc = 328.f * realstrdE;
|
||||
diflc *= localFactor;
|
||||
transformed->L[y][x] = CLIP(original->L[y][x] + diflc);
|
||||
if(!showmas) transformed->L[y][x] = CLIP(original->L[y][x] + diflc);
|
||||
else transformed->L[y][x] = bufmask->L[loy - begy][lox - begx]; ; //bufexporig->L[loy - begy][lox - begx];
|
||||
if(retishow) {
|
||||
transformed->L[y][x] = CLIP(12000.f + diflc);
|
||||
}
|
||||
}
|
||||
|
||||
float fliab = 1.f;
|
||||
@ -2361,10 +2382,24 @@ void ImProcFunctions::transit_shapedetect_retinex(int senstype, LabImage * bufex
|
||||
|
||||
transformed->a[y][x] = CLIPC(original->a[y][x] + difa);
|
||||
transformed->b[y][x] = CLIPC(original->b[y][x] + difb);
|
||||
if(showmas) {
|
||||
transformed->a[y][x] = bufmask->a[loy - begy][lox - begx];
|
||||
transformed->b[y][x] = bufmask->b[loy - begy][lox - begx];
|
||||
}
|
||||
if(retishow) {
|
||||
transformed->a[y][x] = CLIPC(difa);
|
||||
transformed->b[y][x] = CLIPC(difb);
|
||||
}
|
||||
if(previewreti) {
|
||||
transformed->a[y][x] = 0.f;
|
||||
transformed->b[y][x] = difb;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// if(showmas) return;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -3287,7 +3322,7 @@ void ImProcFunctions::calc_ref(int sp, LabImage * original, LabImage * transform
|
||||
if (params->locallab.enabled) {
|
||||
//always calculate hueref, chromaref, lumaref before others operations use in normal mode for all modules exceprt denoise
|
||||
struct local_params lp;
|
||||
calcLocalParams(sp, oW, oH, params->locallab, lp, 0, 0, 0, 0);
|
||||
calcLocalParams(sp, oW, oH, params->locallab, lp, 0, 0, 0, 0, 0);
|
||||
int begy = lp.yc - lp.lyT;
|
||||
int begx = lp.xc - lp.lxL;
|
||||
int yEn = lp.yc + lp.ly;
|
||||
@ -3735,7 +3770,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o
|
||||
int del = 3; // to avoid crash with [loy - begy] and [lox - begx] and bfh bfw // with gtk2 [loy - begy-1] [lox - begx -1 ] and del = 1
|
||||
|
||||
struct local_params lp;
|
||||
calcLocalParams(sp, oW, oH, params->locallab, lp, llColorMask, llExpMask, llSHMask, llcbMask);
|
||||
calcLocalParams(sp, oW, oH, params->locallab, lp, llColorMask, llExpMask, llSHMask, llcbMask, llretiMask);
|
||||
|
||||
const float radius = lp.rad / (sk * 1.4f); //0 to 70 ==> see skip
|
||||
int strred = 1;//(lp.strucc - 1);
|
||||
@ -4866,6 +4901,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o
|
||||
float meanfab, fab;
|
||||
|
||||
mean_fab(xstart, ystart, bfw, bfh, loctemp.get(), original, fab, meanfab, lp.chromacbm);
|
||||
// printf("fab=%f \n", fab);
|
||||
|
||||
#ifdef _OPENMP
|
||||
#pragma omp parallel for schedule(dynamic,16)
|
||||
@ -5685,6 +5721,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o
|
||||
int GH = transformed->H;
|
||||
|
||||
LabImage *bufreti = nullptr;
|
||||
LabImage *bufmask = nullptr;
|
||||
int bfh = int (lp.ly + lp.lyT) + del; //bfw bfh real size of square zone
|
||||
int bfw = int (lp.lx + lp.lxL) + del;
|
||||
array2D<float> buflight(bfw, bfh);
|
||||
@ -5699,6 +5736,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o
|
||||
Hd = bfh;
|
||||
Wd = bfw;
|
||||
bufreti = new LabImage(bfw, bfh);
|
||||
bufmask = new LabImage(bfw, bfh);
|
||||
|
||||
#ifdef _OPENMP
|
||||
#pragma omp parallel for
|
||||
@ -5731,6 +5769,9 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o
|
||||
bufreti->L[loy - begy][lox - begx] = original->L[y][x];
|
||||
bufreti->a[loy - begy][lox - begx] = original->a[y][x];
|
||||
bufreti->b[loy - begy][lox - begx] = original->b[y][x];
|
||||
bufmask->L[loy - begy][lox - begx] = original->L[y][x];
|
||||
bufmask->a[loy - begy][lox - begx] = original->a[y][x];
|
||||
bufmask->b[loy - begy][lox - begx] = original->b[y][x];
|
||||
}
|
||||
}
|
||||
|
||||
@ -5835,7 +5876,8 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o
|
||||
}
|
||||
|
||||
float minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax;
|
||||
ImProcFunctions::MSRLocal(sp, orig, tmpl->L, orig1, Wd, Hd, params->locallab, sk, locRETgainCcurve, 0, 4, 0.8f, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax);
|
||||
ImProcFunctions::MSRLocal(sp, 1, bufreti, bufmask, orig, tmpl->L, orig1, Wd, Hd, params->locallab, sk, locRETgainCcurve, 0, 4, 0.8f, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax,
|
||||
locccmasretiCurve, lcmasretiutili, locllmasretiCurve, llmasretiutili, lochhmasretiCurve, lhmasretiutili, llretiMask, transformed, lp.enaretiMasktmap, lp.enaretiMask);
|
||||
#ifdef _OPENMP
|
||||
#pragma omp parallel for
|
||||
#endif
|
||||
@ -5859,7 +5901,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o
|
||||
maxL = rtengine::max(maxL, buflight[ir][jr]);
|
||||
}
|
||||
}
|
||||
|
||||
printf("minLlab=%f maxllab=%f\n", minL, maxL);
|
||||
float coef = 0.01f * (max(fabs(minL), fabs(maxL)));
|
||||
|
||||
|
||||
@ -5873,7 +5915,8 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o
|
||||
// softprocess(bufreti, buflight, lp.softradiusret, Hd, Wd, sk, multiThread);
|
||||
}
|
||||
|
||||
transit_shapedetect_retinex(4, bufreti, buflight, bufchro, hueref, chromaref, lumaref, lp, original, transformed, cx, cy, sk);
|
||||
transit_shapedetect_retinex(4, bufreti, bufmask, buflight, bufchro, hueref, chromaref, lumaref, lp, original, transformed, cx, cy, sk);
|
||||
|
||||
} else {
|
||||
InverseReti_Local(lp, hueref, chromaref, lumaref, original, transformed, tmpl, cx, cy, 0, sk);
|
||||
}
|
||||
@ -5906,7 +5949,8 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o
|
||||
}
|
||||
}
|
||||
|
||||
ImProcFunctions::MSRLocal(sp, orig, tmpl->L, orig1, Wd, Hd, params->locallab, sk, locRETgainCcurve, 1, 4, 0.8f, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax);
|
||||
ImProcFunctions::MSRLocal(sp, 0, bufreti, bufmask, orig, tmpl->L, orig1, Wd, Hd, params->locallab, sk, locRETgainCcurve, 1, 4, 0.8f, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax,
|
||||
locccmasretiCurve, lcmasretiutili, locllmasretiCurve, llmasretiutili, lochhmasretiCurve, lhmasretiutili, llretiMask, transformed, lp.enaretiMasktmap, lp.enaretiMask);
|
||||
|
||||
if (!lp.invret && call <= 3) {
|
||||
|
||||
@ -5965,8 +6009,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o
|
||||
|
||||
|
||||
if (!lp.invret) {
|
||||
transit_shapedetect_retinex(5, tmpl, buflight, bufchro, hueref, chromaref, lumaref, lp, original, transformed, cx, cy, sk);
|
||||
|
||||
transit_shapedetect_retinex(5, tmpl, bufmask, buflight, bufchro, hueref, chromaref, lumaref, lp, original, transformed, cx, cy, sk);
|
||||
} else {
|
||||
InverseReti_Local(lp, hueref, chromaref, lumaref, original, transformed, tmpl, cx, cy, 1, sk);
|
||||
}
|
||||
@ -5976,7 +6019,9 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o
|
||||
delete tmpl;
|
||||
delete [] origBuffer;
|
||||
delete [] origBuffer1;
|
||||
|
||||
if (bufmask) {
|
||||
delete bufmask;
|
||||
}
|
||||
if (bufreti) {
|
||||
delete bufreti;
|
||||
}
|
||||
|
@ -52,9 +52,45 @@
|
||||
#include "guidedfilter.h"
|
||||
|
||||
#define clipretinex( val, minv, maxv ) (( val = (val < minv ? minv : val ) ) > maxv ? maxv : val )
|
||||
#define CLIPLOC(x) LIM(x,0.f,32767.f)
|
||||
|
||||
namespace
|
||||
{
|
||||
void calcGammaLut(double gamma, double ts, LUTf &gammaLut)
|
||||
{
|
||||
double pwr = 1.0 / gamma;
|
||||
double gamm = gamma;
|
||||
const double gamm2 = gamma;
|
||||
rtengine::GammaValues g_a;
|
||||
|
||||
if (gamm2 < 1.0) {
|
||||
std::swap(pwr, gamm);
|
||||
}
|
||||
|
||||
rtengine::Color::calcGamma(pwr, ts, 0, g_a); // call to calcGamma with selected gamma and slope
|
||||
|
||||
const double start = gamm2 < 1. ? g_a[2] : g_a[3];
|
||||
const double add = g_a[4];
|
||||
const double mul = 1.0 + g_a[4];
|
||||
|
||||
if (gamm2 < 1.) {
|
||||
#pragma omp parallel for schedule(dynamic, 1024)
|
||||
|
||||
for (int i = 0; i < 65536; i++) {
|
||||
const double x = rtengine::Color::igammareti(i / 65535.0, gamm, start, ts, mul, add);
|
||||
gammaLut[i] = 0.5 * rtengine::CLIP(x * 65535.0); // CLIP avoid in some case extra values
|
||||
}
|
||||
} else {
|
||||
#pragma omp parallel for schedule(dynamic, 1024)
|
||||
|
||||
for (int i = 0; i < 65536; i++) {
|
||||
const double x = rtengine::Color::gammareti(i / 65535.0, gamm, start, ts, mul, add);
|
||||
gammaLut[i] = 0.5 * rtengine::CLIP(x * 65535.0); // CLIP avoid in some case extra values
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void retinex_scales(float* scales, int nscales, int mode, int s, float high)
|
||||
{ if(s < 3) s = 3;//to avoid crash in MSRlocal if nei small
|
||||
|
||||
@ -806,11 +842,12 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, float **e
|
||||
}
|
||||
}
|
||||
|
||||
void ImProcFunctions::MSRLocal(int sp, float** luminance, float** templ, const float* const *originalLuminance, const int width, const int height, const LocallabParams &loc, const int skip, const LocretigainCurve &locRETgainCcurve, const int chrome, const int scall, const float krad, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax)
|
||||
void ImProcFunctions::MSRLocal(int sp, int lum, LabImage * bufreti, LabImage * bufmask, float** luminance, float** templ, const float* const *originalLuminance, const int width, const int height, const LocallabParams &loc, const int skip, const LocretigainCurve &locRETgainCcurve, const int chrome, const int scall, const float krad, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax,
|
||||
const LocCCmaskretiCurve & locccmasretiCurve, bool &lcmasretiutili, const LocLLmaskretiCurve & locllmasretiCurve, bool &llmasretiutili, const LocHHmaskretiCurve & lochhmasretiCurve, bool & lhmasretiutili, int llretiMask, LabImage * transformed, bool retiMasktmap, bool retiMask)
|
||||
{
|
||||
BENCHFUN
|
||||
bool py = true;
|
||||
|
||||
//printf("msrllretimask=%i\n", llretiMask);
|
||||
if (py) {//enabled
|
||||
float mean, stddv, maxtr, mintr;
|
||||
float delta;
|
||||
@ -979,6 +1016,165 @@ void ImProcFunctions::MSRLocal(int sp, float** luminance, float** templ, const f
|
||||
|
||||
}
|
||||
|
||||
if(lum == 1 && (llretiMask == 3 || llretiMask == 0 || llretiMask == 2 || llretiMask == 4)) {//only mask with luminance
|
||||
// printf("OK masques\n");
|
||||
array2D<float> loctemp(W_L, H_L);
|
||||
array2D<float> ble(W_L, H_L);
|
||||
array2D<float> guid(W_L, H_L);
|
||||
std::unique_ptr<LabImage> bufmaskblurreti;
|
||||
bufmaskblurreti.reset(new LabImage(W_L, H_L));
|
||||
std::unique_ptr<LabImage> bufmaskorigreti;
|
||||
bufmaskorigreti.reset(new LabImage(W_L, H_L));
|
||||
#ifdef _OPENMP
|
||||
#pragma omp parallel for schedule(dynamic,16)
|
||||
#endif
|
||||
|
||||
for (int y = 0; y < H_L; y++) {
|
||||
for (int x = 0; x < W_L; x++) {
|
||||
if(retiMasktmap) loctemp[y][x] = out[y][x];
|
||||
else loctemp[y][x] = bufreti->L[y][x];
|
||||
}
|
||||
}
|
||||
|
||||
float minL = loctemp[0][0];
|
||||
float maxL = minL;
|
||||
#ifdef _OPENMP
|
||||
#pragma omp parallel for reduction(min:minL) reduction(max:maxL) schedule(dynamic,16)
|
||||
#endif
|
||||
|
||||
for (int ir = 0; ir < H_L; ir++) {
|
||||
for (int jr = 0; jr < W_L; jr++) {
|
||||
minL = rtengine::min(minL, loctemp[ir][jr]);
|
||||
maxL = rtengine::max(maxL, loctemp[ir][jr]);
|
||||
}
|
||||
}
|
||||
|
||||
// printf("minL=%f maxL=%f\n", minL, maxL);
|
||||
float fab = 4000.f;//value must be good in most cases
|
||||
|
||||
#ifdef _OPENMP
|
||||
#pragma omp parallel for schedule(dynamic,16)
|
||||
#endif
|
||||
|
||||
for (int ir = 0; ir < H_L; ir++) {
|
||||
for (int jr = 0; jr < W_L; jr++) {
|
||||
float kmaskLexp = 0;
|
||||
float kmaskCH = 0;
|
||||
|
||||
if (locllmasretiCurve && llmasretiutili) {
|
||||
float ligh = loctemp[ir][jr] / 32768.f;
|
||||
kmaskLexp = 32768.f * LIM01(1.f - locllmasretiCurve[500.f * ligh]);
|
||||
}
|
||||
|
||||
|
||||
if (locllmasretiCurve && llmasretiutili && retiMasktmap) {
|
||||
}
|
||||
|
||||
if (llretiMask != 4) {
|
||||
if (locccmasretiCurve && lcmasretiutili) {
|
||||
float chromask = 0.0001f + sqrt(SQR((bufreti->a[ir][jr]) / fab) + SQR((bufreti->b[ir][jr]) / fab));
|
||||
kmaskCH = LIM01(1.f - locccmasretiCurve[500.f * chromask]);
|
||||
}
|
||||
}
|
||||
|
||||
if (lochhmasretiCurve && lhmasretiutili) {
|
||||
float huema = xatan2f(bufreti->b[ir][jr], bufreti->a[ir][jr]);
|
||||
float h = Color::huelab_to_huehsv2(huema);
|
||||
h += 1.f / 6.f;
|
||||
|
||||
if (h > 1.f) {
|
||||
h -= 1.f;
|
||||
}
|
||||
float valHH = LIM01(1.f - lochhmasretiCurve[500.f * h]);
|
||||
|
||||
if (llretiMask != 4) {
|
||||
kmaskCH += valHH;
|
||||
}
|
||||
|
||||
kmaskLexp += 32768.f * valHH;
|
||||
}
|
||||
// printf("km=%f ",kmaskLexp);
|
||||
bufmaskblurreti->L[ir][jr] = CLIPLOC(kmaskLexp);
|
||||
bufmaskblurreti->a[ir][jr] = kmaskCH;
|
||||
bufmaskblurreti->b[ir][jr] = kmaskCH;
|
||||
ble[ir][jr] = bufmaskblurreti->L[ir][jr] / 32768.f;
|
||||
guid[ir][jr] = bufreti->L[ir][jr] / 32768.f;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (loc.spots.at(sp).radmaskreti > 0.f) {
|
||||
guidedFilter(guid, ble, ble, loc.spots.at(sp).radmaskreti * 10.f / skip, 0.001, multiThread, 4);
|
||||
}
|
||||
|
||||
LUTf lutTonemaskreti(65536);
|
||||
calcGammaLut(loc.spots.at(sp).gammaskreti, loc.spots.at(sp).slomaskreti, lutTonemaskreti);
|
||||
float radiusb = 1.f / skip;
|
||||
|
||||
#ifdef _OPENMP
|
||||
#pragma omp parallel for schedule(dynamic,16)
|
||||
#endif
|
||||
|
||||
for (int ir = 0; ir < H_L; ir++)
|
||||
for (int jr = 0; jr < W_L; jr++) {
|
||||
float L_;
|
||||
bufmaskblurreti->L[ir][jr] = LIM01(ble[ir][jr]) * 32768.f;
|
||||
L_ = 2.f * bufmaskblurreti->L[ir][jr];
|
||||
bufmaskblurreti->L[ir][jr] = lutTonemaskreti[L_];
|
||||
}
|
||||
|
||||
//blend
|
||||
#ifdef _OPENMP
|
||||
#pragma omp parallel
|
||||
#endif
|
||||
{
|
||||
gaussianBlur(bufmaskblurreti->L, bufmaskorigreti->L, W_L, H_L, radiusb);
|
||||
gaussianBlur(bufmaskblurreti->a, bufmaskorigreti->a, W_L, H_L, 1.f + (0.5f * loc.spots.at(sp).radmaskreti) / skip);
|
||||
gaussianBlur(bufmaskblurreti->b, bufmaskorigreti->b, W_L, H_L, 1.f + (0.5f * loc.spots.at(sp).radmaskreti) / skip);
|
||||
}
|
||||
|
||||
|
||||
if(llretiMask != 3 && retiMask) {
|
||||
float modr = 0.01f * (float) loc.spots.at(sp).blendmaskreti;
|
||||
#ifdef _OPENMP
|
||||
#pragma omp parallel for schedule(dynamic,16)
|
||||
#endif
|
||||
for (int y = 0; y < H_L; y++) {
|
||||
for (int x = 0; x < W_L; x++) {
|
||||
if(retiMasktmap){
|
||||
out[y][x] += fabs(modr) * bufmaskorigreti->L[y][x];
|
||||
out[y][x] = LIM(out[y][x],0.f,60000.f);
|
||||
} else {
|
||||
bufreti->L[y][x] += bufmaskorigreti->L[y][x] * modr;
|
||||
}
|
||||
|
||||
bufreti->a[y][x] *= (1.f + bufmaskorigreti->a[y][x] * modr);
|
||||
bufreti->b[y][x] *= (1.f + bufmaskorigreti->b[y][x] * modr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(llretiMask == 3){
|
||||
|
||||
#ifdef _OPENMP
|
||||
#pragma omp parallel for schedule(dynamic,16)
|
||||
#endif
|
||||
for (int y = 0; y < H_L; y++) {
|
||||
for (int x = 0; x < W_L; x++) {
|
||||
bufmask->L[y][x] = 6000.f + CLIPLOC(bufmaskorigreti->L[y][x]);
|
||||
bufmask->a[y][x] = bufreti->a[y][x] * bufmaskorigreti->a[y][x];
|
||||
bufmask->b[y][x] = bufreti->b[y][x] * bufmaskorigreti->b[y][x];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef __SSE2__
|
||||
vfloat pondv = F2V(pond);
|
||||
vfloat limMinv = F2V(ilimD);
|
||||
@ -1039,6 +1235,7 @@ void ImProcFunctions::MSRLocal(int sp, float** luminance, float** templ, const f
|
||||
for (int i = 0; i < H_L; i ++)
|
||||
for (int j = 0; j < W_L; j++) {
|
||||
luminance[i][j]= ble[i][j] * 32768.f;
|
||||
// printf("lu=%f ", luminance[i][j]);
|
||||
}
|
||||
|
||||
if (shmap) {
|
||||
@ -1051,6 +1248,12 @@ void ImProcFunctions::MSRLocal(int sp, float** luminance, float** templ, const f
|
||||
delete [] outBuffer;
|
||||
outBuffer = nullptr;
|
||||
delete [] srcBuffer;
|
||||
mean = 0.f;
|
||||
stddv = 0.f;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
mean = 0.f;
|
||||
stddv = 0.f;
|
||||
@ -1157,7 +1360,7 @@ void ImProcFunctions::MSRLocal(int sp, float** luminance, float** templ, const f
|
||||
}
|
||||
|
||||
delta = maxi - mini;
|
||||
//printf("maxi=%f mini=%f mean=%f std=%f delta=%f maxtr=%f mintr=%f\n", maxi, mini, mean, stddv, delta, maxtr, mintr);
|
||||
printf("maxi=%f mini=%f mean=%f std=%f delta=%f maxtr=%f mintr=%f\n", maxi, mini, mean, stddv, delta, maxtr, mintr);
|
||||
|
||||
if (!delta) {
|
||||
delta = 1.0f;
|
||||
|
@ -715,6 +715,7 @@ enum ProcEventCode {
|
||||
Evlocallabgammaskreti = 685,
|
||||
Evlocallabslomaskreti = 686,
|
||||
EvlocallabshowmaskretiMethod = 687,
|
||||
EvLocallabEnaretiMasktmap = 688,
|
||||
NUMOFEVENTS
|
||||
};
|
||||
|
||||
|
@ -2482,6 +2482,7 @@ LocallabParams::LocallabSpot::LocallabSpot() :
|
||||
LLmaskreticurve{(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},
|
||||
HHmaskreticurve{(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},
|
||||
enaretiMask(false),
|
||||
enaretiMasktmap(false),
|
||||
blendmaskreti(0),
|
||||
radmaskreti(10.0),
|
||||
chromaskreti(0.0),
|
||||
@ -2690,6 +2691,7 @@ bool LocallabParams::LocallabSpot::operator ==(const LocallabSpot& other) const
|
||||
&& LLmaskreticurve == other.LLmaskreticurve
|
||||
&& HHmaskreticurve == other.HHmaskreticurve
|
||||
&& enaretiMask == other.enaretiMask
|
||||
&& enaretiMasktmap == other.enaretiMasktmap
|
||||
&& blendmaskreti == other.blendmaskreti
|
||||
&& radmaskreti == other.radmaskreti
|
||||
&& chromaskreti == other.chromaskreti
|
||||
@ -3854,6 +3856,7 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo
|
||||
saveToKeyfile(!pedited || pedited->locallab.spots.at(i).inversret, "Locallab", "Inversret_" + std::to_string(i), spot.inversret, keyFile);
|
||||
saveToKeyfile(!pedited || pedited->locallab.spots.at(i).softradiusret, "Locallab", "Softradiusret_" + std::to_string(i), spot.softradiusret, keyFile);
|
||||
saveToKeyfile(!pedited || pedited->locallab.spots.at(i).enaretiMask, "Locallab", "EnaretiMask_" + std::to_string(i), spot.enaretiMask, keyFile);
|
||||
saveToKeyfile(!pedited || pedited->locallab.spots.at(i).enaretiMasktmap, "Locallab", "EnaretiMasktmap_" + std::to_string(i), spot.enaretiMasktmap, keyFile);
|
||||
saveToKeyfile(!pedited || pedited->locallab.spots.at(i).blendmaskreti, "Locallab", "Blendmaskreti_" + std::to_string(i), spot.blendmaskreti, keyFile);
|
||||
saveToKeyfile(!pedited || pedited->locallab.spots.at(i).radmaskreti, "Locallab", "Radmaskreti_" + std::to_string(i), spot.radmaskreti, keyFile);
|
||||
saveToKeyfile(!pedited || pedited->locallab.spots.at(i).chromaskreti, "Locallab", "Chromaskreti_" + std::to_string(i), spot.chromaskreti, keyFile);
|
||||
@ -5159,6 +5162,7 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited)
|
||||
assignFromKeyfile(keyFile, "Locallab", "LLmaskretiCurve_" + std::to_string(i), pedited, spot.LLmaskreticurve, spotEdited.LLmaskreticurve);
|
||||
assignFromKeyfile(keyFile, "Locallab", "HHmaskretiCurve_" + std::to_string(i), pedited, spot.HHmaskreticurve, spotEdited.HHmaskreticurve);
|
||||
assignFromKeyfile(keyFile, "Locallab", "EnaretiMask_" + std::to_string(i), pedited, spot.enaretiMask, spotEdited.enaretiMask);
|
||||
assignFromKeyfile(keyFile, "Locallab", "EnaretiMasktmap_" + std::to_string(i), pedited, spot.enaretiMasktmap, spotEdited.enaretiMasktmap);
|
||||
assignFromKeyfile(keyFile, "Locallab", "Blendmaskreti_" + std::to_string(i), pedited, spot.blendmaskreti, spotEdited.blendmaskreti);
|
||||
assignFromKeyfile(keyFile, "Locallab", "Radmaskreti_" + std::to_string(i), pedited, spot.radmaskreti, spotEdited.radmaskreti);
|
||||
assignFromKeyfile(keyFile, "Locallab", "Chromaskreti_" + std::to_string(i), pedited, spot.chromaskreti, spotEdited.chromaskreti);
|
||||
|
@ -1083,6 +1083,7 @@ struct LocallabParams {
|
||||
std::vector<double> LLmaskreticurve;
|
||||
std::vector<double> HHmaskreticurve;
|
||||
bool enaretiMask;
|
||||
bool enaretiMasktmap;
|
||||
int blendmaskreti;
|
||||
double radmaskreti;
|
||||
double chromaskreti;
|
||||
|
@ -714,7 +714,8 @@ int refreshmap[rtengine::NUMOFEVENTS] = {
|
||||
LUMINANCECURVE, //Evlocallabchromaskreti
|
||||
LUMINANCECURVE, //Evlocallabgammaskreti
|
||||
LUMINANCECURVE, //Evlocallabslomaskreti
|
||||
LUMINANCECURVE //EvlocallabshowmaskretiMethod
|
||||
LUMINANCECURVE, //EvlocallabshowmaskretiMethod
|
||||
LUMINANCECURVE //EvLocallabEnaretiMasktmap
|
||||
};
|
||||
|
||||
|
||||
|
@ -159,7 +159,7 @@ Locallab::Locallab():
|
||||
blendmaskreti(Gtk::manage(new Adjuster(M("TP_LOCALLAB_BLENDMASKCOL"), -100, 100, 1, 0))),
|
||||
radmaskreti(Gtk::manage(new Adjuster(M("TP_LOCALLAB_RADMASKCOL"), 0.0, 100.0, 0.1, 10.))),
|
||||
chromaskreti(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CHROMASKCOL"), -100.0, 100.0, 0.1, 0.))),
|
||||
gammaskreti(Gtk::manage(new Adjuster(M("TP_LOCALLAB_GAMMASKCOL"), 0.25, 4.0, 0.01, 1.))),
|
||||
gammaskreti(Gtk::manage(new Adjuster(M("TP_LOCALLAB_GAMMASKCOL"), 0.1, 5.0, 0.01, 1.))),
|
||||
slomaskreti(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SLOMASKCOL"), 0.0, 15.0, 0.1, 0.))),
|
||||
// Sharpening
|
||||
sharcontrast(Gtk::manage(new Adjuster(M("TP_SHARPENING_CONTRAST"), 0, 200, 1, 20))),
|
||||
@ -222,6 +222,7 @@ Locallab::Locallab():
|
||||
// Retinex
|
||||
inversret(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_INVERS")))),
|
||||
enaretiMask(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_ENABLE_MASK")))),
|
||||
enaretiMasktmap(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_TM_MASK")))),
|
||||
// Sharpening
|
||||
inverssha(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_INVERS")))),
|
||||
//CBDL
|
||||
@ -887,12 +888,13 @@ Locallab::Locallab():
|
||||
|
||||
maskretiCurveEditorG->curveListComplete();
|
||||
enaretiMaskConn = enaretiMask->signal_toggled().connect(sigc::mem_fun(*this, &Locallab::enaretiMaskChanged));
|
||||
enaretiMasktmapConn = enaretiMasktmap->signal_toggled().connect(sigc::mem_fun(*this, &Locallab::enaretiMasktmapChanged));
|
||||
|
||||
showmaskretiMethod->append(M("TP_LOCALLAB_SHOWMNONE"));
|
||||
showmaskretiMethod->append(M("TP_LOCALLAB_SHOWMODIF"));
|
||||
showmaskretiMethod->append(M("TP_LOCALLAB_SHOWMODIFMASK"));
|
||||
showmaskretiMethod->append(M("TP_LOCALLAB_SHOWMASK"));
|
||||
showmaskretiMethod->append(M("TP_LOCALLAB_PREVIEWSEL"));
|
||||
// showmaskretiMethod->append(M("TP_LOCALLAB_PREVIEWSEL"));
|
||||
|
||||
|
||||
showmaskretiMethod->set_active(0);
|
||||
@ -910,6 +912,7 @@ Locallab::Locallab():
|
||||
ToolParamBlock* const maskretiBox = Gtk::manage(new ToolParamBlock());
|
||||
maskretiBox->pack_start(*showmaskretiMethod, Gtk::PACK_SHRINK, 4);
|
||||
maskretiBox->pack_start(*enaretiMask, Gtk::PACK_SHRINK, 0);
|
||||
maskretiBox->pack_start(*enaretiMasktmap, Gtk::PACK_SHRINK, 0);
|
||||
maskretiBox->pack_start(*maskretiCurveEditorG, Gtk::PACK_SHRINK, 4); // Padding is mandatory to correct behavior of curve editor
|
||||
maskretiBox->pack_start(*blendmaskreti, Gtk::PACK_SHRINK, 0);
|
||||
maskretiBox->pack_start(*radmaskreti, Gtk::PACK_SHRINK, 0);
|
||||
@ -928,7 +931,7 @@ Locallab::Locallab():
|
||||
retiBox->pack_start(*softradiusret);
|
||||
retiBox->pack_start(*sensih);
|
||||
retiBox->pack_start(*LocalcurveEditorgainT, Gtk::PACK_SHRINK, 4); // Padding is mandatory to correct behavior of curve editor
|
||||
// retiBox->pack_start(*expmaskreti);
|
||||
retiBox->pack_start(*expmaskreti);
|
||||
retiBox->pack_start(*inversret);
|
||||
expreti->add(*retiBox);
|
||||
expreti->setLevel(2);
|
||||
@ -2124,6 +2127,7 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited)
|
||||
pp->locallab.spots.at(pp->locallab.selspot).CCmaskreticurve = CCmaskretishape->getCurve();
|
||||
pp->locallab.spots.at(pp->locallab.selspot).HHmaskreticurve = HHmaskretishape->getCurve();
|
||||
pp->locallab.spots.at(pp->locallab.selspot).enaretiMask = enaretiMask->get_active();
|
||||
pp->locallab.spots.at(pp->locallab.selspot).enaretiMasktmap = enaretiMasktmap->get_active();
|
||||
pp->locallab.spots.at(pp->locallab.selspot).blendmaskreti = blendmaskreti->getIntValue();
|
||||
pp->locallab.spots.at(pp->locallab.selspot).radmaskreti = radmaskreti->getValue();
|
||||
pp->locallab.spots.at(pp->locallab.selspot).chromaskreti = chromaskreti->getValue();
|
||||
@ -2334,6 +2338,7 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited)
|
||||
pe->locallab.spots.at(pp->locallab.selspot).LLmaskreticurve = pe->locallab.spots.at(pp->locallab.selspot).LLmaskreticurve || !LLmaskretishape->isUnChanged();
|
||||
pe->locallab.spots.at(pp->locallab.selspot).HHmaskreticurve = pe->locallab.spots.at(pp->locallab.selspot).HHmaskreticurve || !HHmaskretishape->isUnChanged();
|
||||
pe->locallab.spots.at(pp->locallab.selspot).enaretiMask = pe->locallab.spots.at(pp->locallab.selspot).enaretiMask || !enaretiMask->get_inconsistent();
|
||||
pe->locallab.spots.at(pp->locallab.selspot).enaretiMasktmap = pe->locallab.spots.at(pp->locallab.selspot).enaretiMasktmap || !enaretiMasktmap->get_inconsistent();
|
||||
pe->locallab.spots.at(pp->locallab.selspot).blendmaskreti = pe->locallab.spots.at(pp->locallab.selspot).blendmaskreti || blendmaskreti->getEditedState();
|
||||
pe->locallab.spots.at(pp->locallab.selspot).radmaskreti = pe->locallab.spots.at(pp->locallab.selspot).radmaskreti || radmaskreti->getEditedState();
|
||||
pe->locallab.spots.at(pp->locallab.selspot).chromaskreti = pe->locallab.spots.at(pp->locallab.selspot).chromaskreti || chromaskreti->getEditedState();
|
||||
@ -2531,6 +2536,7 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited)
|
||||
pedited->locallab.spots.at(pp->locallab.selspot).softradiustm = pedited->locallab.spots.at(pp->locallab.selspot).softradiustm || softradiustm->getEditedState();
|
||||
pedited->locallab.spots.at(pp->locallab.selspot).amount = pedited->locallab.spots.at(pp->locallab.selspot).amount || amount->getEditedState();
|
||||
pedited->locallab.spots.at(pp->locallab.selspot).enaretiMask = pedited->locallab.spots.at(pp->locallab.selspot).enaretiMask || !enaretiMask->get_inconsistent();
|
||||
pedited->locallab.spots.at(pp->locallab.selspot).enaretiMasktmap = pedited->locallab.spots.at(pp->locallab.selspot).enaretiMasktmap || !enaretiMasktmap->get_inconsistent();
|
||||
// Retinex
|
||||
pedited->locallab.spots.at(pp->locallab.selspot).expreti = pedited->locallab.spots.at(pp->locallab.selspot).expreti || !expreti->get_inconsistent();
|
||||
pedited->locallab.spots.at(pp->locallab.selspot).retinexMethod = pedited->locallab.spots.at(pp->locallab.selspot).retinexMethod || retinexMethod->get_active_text() != M("GENERAL_UNCHANGED");
|
||||
@ -2547,6 +2553,7 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited)
|
||||
pedited->locallab.spots.at(pp->locallab.selspot).LLmaskreticurve = pedited->locallab.spots.at(pp->locallab.selspot).LLmaskreticurve || !LLmaskretishape->isUnChanged();
|
||||
pedited->locallab.spots.at(pp->locallab.selspot).HHmaskreticurve = pedited->locallab.spots.at(pp->locallab.selspot).HHmaskreticurve || !HHmaskretishape->isUnChanged();
|
||||
pedited->locallab.spots.at(pp->locallab.selspot).enaretiMask = pedited->locallab.spots.at(pp->locallab.selspot).enaretiMask || !enaretiMask->get_inconsistent();
|
||||
pedited->locallab.spots.at(pp->locallab.selspot).enaretiMasktmap = pedited->locallab.spots.at(pp->locallab.selspot).enaretiMasktmap || !enaretiMasktmap->get_inconsistent();
|
||||
pedited->locallab.spots.at(pp->locallab.selspot).blendmaskreti = pedited->locallab.spots.at(pp->locallab.selspot).blendmaskreti || blendmaskreti->getEditedState();
|
||||
pedited->locallab.spots.at(pp->locallab.selspot).radmaskreti = pedited->locallab.spots.at(pp->locallab.selspot).radmaskreti || radmaskreti->getEditedState();
|
||||
pedited->locallab.spots.at(pp->locallab.selspot).chromaskreti = pedited->locallab.spots.at(pp->locallab.selspot).chromaskreti || chromaskreti->getEditedState();
|
||||
@ -3017,7 +3024,7 @@ Locallab::llMaskVisibility* Locallab::getMaskVisibility()
|
||||
maskStruct->cbMask = showmaskcbMethod->get_active_row_number();
|
||||
maskStruct->retiMask = showmaskretiMethod->get_active_row_number();
|
||||
// printf("SHmask=%i \n", maskStruct->SHMask);
|
||||
// printf("cbmask=%i \n", maskStruct->cbMask);
|
||||
printf("retimask=%i \n", maskStruct->retiMask);
|
||||
|
||||
return maskStruct;
|
||||
}
|
||||
@ -3096,7 +3103,7 @@ void Locallab::enaSHMaskChanged()
|
||||
|
||||
void Locallab::enaretiMaskChanged()
|
||||
{
|
||||
// printf("enacbMaskChanged\n");
|
||||
printf("enaretimaskChanged\n");
|
||||
|
||||
if (multiImage) {
|
||||
if (enaretiMask->get_inconsistent()) {
|
||||
@ -3118,6 +3125,29 @@ void Locallab::enaretiMaskChanged()
|
||||
}
|
||||
}
|
||||
|
||||
void Locallab::enaretiMasktmapChanged()
|
||||
{
|
||||
// printf("enacbMaskChanged\n");
|
||||
|
||||
if (multiImage) {
|
||||
if (enaretiMasktmap->get_inconsistent()) {
|
||||
enaretiMasktmap->set_inconsistent(false);
|
||||
enaretiMasktmapConn.block(true);
|
||||
enaretiMasktmap->set_active(false);
|
||||
enaretiMasktmapConn.block(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (getEnabled() && expreti->getEnabled()) {
|
||||
if (listener) {
|
||||
if (enaretiMasktmap->get_active()) {
|
||||
listener->panelChanged(EvLocallabEnaretiMasktmap, M("GENERAL_ENABLED"));
|
||||
} else {
|
||||
listener->panelChanged(EvLocallabEnaretiMasktmap, M("GENERAL_DISABLED"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Locallab::enacbMaskChanged()
|
||||
{
|
||||
@ -3414,15 +3444,17 @@ void Locallab::inversretChanged()
|
||||
if (multiImage && inversret->get_inconsistent()) {
|
||||
sensih->show();
|
||||
softradiusret->show();
|
||||
|
||||
expmaskreti->show();
|
||||
} else if (inversret->get_active()) {
|
||||
sensih->show();
|
||||
dehaz->show();
|
||||
softradiuscol->show();
|
||||
expmaskreti->hide();
|
||||
} else {
|
||||
sensih->show();
|
||||
dehaz->show();
|
||||
softradiusret->show();
|
||||
expmaskreti->show();
|
||||
}
|
||||
|
||||
if (getEnabled() && expreti->getEnabled()) {
|
||||
@ -4980,6 +5012,7 @@ void Locallab::enableListener()
|
||||
retinexMethodConn.block(false);
|
||||
inversretConn.block(false);
|
||||
enaretiMaskConn.block(false);
|
||||
enaretiMasktmapConn.block(false);
|
||||
showmaskretiMethodConn.block(false);
|
||||
// Sharpening
|
||||
enablesharpConn.block(false);
|
||||
@ -5035,6 +5068,7 @@ void Locallab::disableListener()
|
||||
retinexMethodConn.block(true);
|
||||
inversretConn.block(true);
|
||||
enaretiMaskConn.block(true);
|
||||
enaretiMasktmapConn.block(true);
|
||||
showmaskretiMethodConn.block(true);
|
||||
// Sharpening
|
||||
enablesharpConn.block(true);
|
||||
@ -5206,6 +5240,7 @@ void Locallab::updateLocallabGUI(const rtengine::procparams::ProcParams* pp, con
|
||||
LLmaskretishape->setCurve(pp->locallab.spots.at(index).LLmaskreticurve);
|
||||
HHmaskretishape->setCurve(pp->locallab.spots.at(index).HHmaskreticurve);
|
||||
enaretiMask->set_active(pp->locallab.spots.at(index).enaretiMask);
|
||||
enaretiMasktmap->set_active(pp->locallab.spots.at(index).enaretiMasktmap);
|
||||
blendmaskreti->setValue(pp->locallab.spots.at(index).blendmaskreti);
|
||||
radmaskreti->setValue(pp->locallab.spots.at(index).radmaskreti);
|
||||
chromaskreti->setValue(pp->locallab.spots.at(index).chromaskreti);
|
||||
@ -5450,6 +5485,7 @@ void Locallab::updateLocallabGUI(const rtengine::procparams::ProcParams* pp, con
|
||||
LLmaskretishape->setUnChanged(!spotState->LLmaskreticurve);
|
||||
HHmaskretishape->setUnChanged(!spotState->HHmaskreticurve);
|
||||
enaretiMask->set_inconsistent(multiImage && !spotState->enaretiMask);
|
||||
enaretiMasktmap->set_inconsistent(multiImage && !spotState->enaretiMasktmap);
|
||||
blendmaskreti->setEditedState(spotState->blendmaskreti ? Edited : UnEdited);
|
||||
radmaskreti->setEditedState(spotState->radmaskreti ? Edited : UnEdited);
|
||||
chromaskreti->setEditedState(spotState->chromaskreti ? Edited : UnEdited);
|
||||
|
@ -260,6 +260,8 @@ private:
|
||||
sigc::connection inversretConn;
|
||||
Gtk::CheckButton* const enaretiMask;
|
||||
sigc::connection enaretiMaskConn;
|
||||
Gtk::CheckButton* const enaretiMasktmap;
|
||||
sigc::connection enaretiMasktmapConn;
|
||||
// Sharpening
|
||||
Gtk::CheckButton* const inverssha;
|
||||
sigc::connection inversshaConn;
|
||||
@ -346,6 +348,7 @@ private:
|
||||
// Retinex
|
||||
void inversretChanged();
|
||||
void enaretiMaskChanged();
|
||||
void enaretiMasktmapChanged();
|
||||
// Sharpening
|
||||
void inversshaChanged();
|
||||
//CBDL
|
||||
|
@ -1072,6 +1072,7 @@ void ParamsEdited::initFrom(const std::vector<rtengine::procparams::ProcParams>&
|
||||
locallab.spots.at(j).LLmaskreticurve = locallab.spots.at(j).LLmaskreticurve && pSpot.LLmaskreticurve == otherSpot.LLmaskreticurve;
|
||||
locallab.spots.at(j).HHmaskreticurve = locallab.spots.at(j).HHmaskreticurve && pSpot.HHmaskreticurve == otherSpot.HHmaskreticurve;
|
||||
locallab.spots.at(j).enaretiMask = locallab.spots.at(j).enaretiMask && pSpot.enaretiMask == otherSpot.enaretiMask;
|
||||
locallab.spots.at(j).enaretiMasktmap = locallab.spots.at(j).enaretiMasktmap && pSpot.enaretiMasktmap == otherSpot.enaretiMasktmap;
|
||||
locallab.spots.at(j).blendmaskreti = locallab.spots.at(j).blendmaskreti && pSpot.blendmaskreti == otherSpot.blendmaskreti;
|
||||
locallab.spots.at(j).radmaskreti = locallab.spots.at(j).radmaskreti && pSpot.radmaskreti == otherSpot.radmaskreti;
|
||||
locallab.spots.at(j).chromaskreti = locallab.spots.at(j).chromaskreti && pSpot.chromaskreti == otherSpot.chromaskreti;
|
||||
@ -3109,6 +3110,10 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng
|
||||
toEdit.locallab.spots.at(i).enaretiMask = mods.locallab.spots.at(i).enaretiMask;
|
||||
}
|
||||
|
||||
if (locallab.spots.at(i).enaretiMasktmap) {
|
||||
toEdit.locallab.spots.at(i).enaretiMasktmap = mods.locallab.spots.at(i).enaretiMasktmap;
|
||||
}
|
||||
|
||||
if (locallab.spots.at(i).blendmaskreti) {
|
||||
toEdit.locallab.spots.at(i).blendmaskreti = mods.locallab.spots.at(i).blendmaskreti;
|
||||
}
|
||||
@ -4405,6 +4410,7 @@ LocallabParamsEdited::LocallabSpotEdited::LocallabSpotEdited(bool v) :
|
||||
LLmaskreticurve(v),
|
||||
HHmaskreticurve(v),
|
||||
enaretiMask(v),
|
||||
enaretiMasktmap(v),
|
||||
blendmaskreti(v),
|
||||
radmaskreti(v),
|
||||
chromaskreti(v),
|
||||
@ -4610,6 +4616,7 @@ void LocallabParamsEdited::LocallabSpotEdited::set(bool v)
|
||||
LLmaskreticurve = v;
|
||||
HHmaskreticurve = v;
|
||||
enaretiMask = v;
|
||||
enaretiMasktmap = v;
|
||||
blendmaskreti = v;
|
||||
radmaskreti = v;
|
||||
chromaskreti = v;
|
||||
|
@ -499,6 +499,7 @@ public:
|
||||
bool LLmaskreticurve;
|
||||
bool HHmaskreticurve;
|
||||
bool enaretiMask;
|
||||
bool enaretiMasktmap;
|
||||
bool blendmaskreti;
|
||||
bool radmaskreti;
|
||||
bool chromaskreti;
|
||||
|
Loading…
x
Reference in New Issue
Block a user