Improve retinex_pde with show processus

This commit is contained in:
Desmis 2019-07-05 13:31:04 +02:00
parent fc4fd82afb
commit 3469bc9535
13 changed files with 126 additions and 24 deletions

View File

@ -2105,6 +2105,12 @@ TP_LOCALLAB_RETI_FFTW_TOOLTIP;FFT improve quality and allow big radius.\nThe tre
TP_LOCALLAB_TRANSMISSIONGAIN;Transmission gain
TP_LOCALLAB_STREN;Compression Strength
TP_LOCALLAB_STRGRID;Strength
TP_LOCALLAB_SHOWLAPLACE;Laplacian (first)
TP_LOCALLAB_SHOWFOURIER;Fourier (dct)
TP_LOCALLAB_SHOWPOISSON;Poisson (pde)
TP_LOCALLAB_SHOWDCT;Show process Fourier
TP_LOCALLAB_SHOWMASKSOFT_TOOLTIP;Show process Fourier:\n\nshows the different stages of the process.\nLaplace - builds the second derivative according to the threshold (first step).\nFourier -shows the transformed Laplacian with DCT.\nPoisson - show solution of Poisson DCE.\nNormalize - show result whithout normalization luminance.
TP_LOCALLAB_SHOWNORMAL;Normalize luminance (no)
TP_LOCALLAB_TM;Tone Mapping
TP_LOCALLAB_STR;Strength
TP_LOCALLAB_NEIGH;Radius

View File

@ -995,14 +995,14 @@ void Crop::update(int todo)
locccmasSHCurve, lcmasSHutili, locllmasSHCurve, llmasSHutili, lochhmasSHCurve, lhmasSHutili,
locccmascbCurve, lcmascbutili, locllmascbCurve, llmascbutili, lochhmascbCurve, lhmascbutili,
locccmasretiCurve, lcmasretiutili, locllmasretiCurve, llmasretiutili, lochhmasretiCurve, lhmasretiutili,
LHutili, HHutili, cclocalcurve2, localcutili, localexutili, exlocalcurve2, hltonecurveloc2, shtonecurveloc2, tonecurveloc2, lightCurveloc2, huerefblu, chromarefblu, lumarefblu, huere, chromare, lumare, sobelre, parent->locallColorMask, parent->locallExpMask, parent->locallSHMask, parent->locallcbMask, parent->locallretiMask);
LHutili, HHutili, cclocalcurve2, localcutili, localexutili, exlocalcurve2, hltonecurveloc2, shtonecurveloc2, tonecurveloc2, lightCurveloc2, huerefblu, chromarefblu, lumarefblu, huere, chromare, lumare, sobelre, parent->locallColorMask, parent->locallExpMask, parent->locallSHMask, parent->locallcbMask, parent->locallretiMask, parent->locallsoftMask);
} else {
parent->ipf.Lab_Local(1, sp, (float**)shbuffer, labnCrop, labnCrop, reservCrop, cropx / skip, cropy / skip, skips(parent->fw, skip), skips(parent->fh, skip), skip, locRETgainCurve, lllocalcurve2,locallutili,
loclhCurve, lochhCurve, locccmasCurve, lcmasutili, locllmasCurve, llmasutili, lochhmasCurve, lhmasutili, locccmasexpCurve, lcmasexputili, locllmasexpCurve, llmasexputili, lochhmasexpCurve, lhmasexputili,
locccmasSHCurve, lcmasSHutili, locllmasSHCurve, llmasSHutili, lochhmasSHCurve, lhmasSHutili,
locccmascbCurve, lcmascbutili, locllmascbCurve, llmascbutili, lochhmascbCurve, lhmascbutili,
locccmasretiCurve, lcmasretiutili, locllmasretiCurve, llmasretiutili, lochhmasretiCurve, lhmasretiutili,
LHutili, HHutili, cclocalcurve2, localcutili, localexutili, exlocalcurve2, hltonecurveloc2, shtonecurveloc2, tonecurveloc2, lightCurveloc2, huerefblu, chromarefblu, lumarefblu, huere, chromare, lumare, sobelre, 0, 0, 0, 0, 0);
LHutili, HHutili, cclocalcurve2, localcutili, localexutili, exlocalcurve2, hltonecurveloc2, shtonecurveloc2, tonecurveloc2, lightCurveloc2, huerefblu, chromarefblu, lumarefblu, huere, chromare, lumare, sobelre, 0, 0, 0, 0, 0, 0);
}
lllocalcurve2.clear();
lightCurveloc2.clear();

View File

@ -207,6 +207,7 @@ ImProcCoordinator::ImProcCoordinator() :
locallSHMask(0),
locallcbMask(0),
locallretiMask(0),
locallsoftMask(0),
retistrsav(nullptr)
{
@ -956,13 +957,13 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange)
locccmasSHCurve, lcmasSHutili, locllmasSHCurve, llmasSHutili, lochhmasSHCurve, lhmasSHutili,
locccmascbCurve, lcmascbutili, locllmascbCurve, llmascbutili, lochhmascbCurve, lhmascbutili,
locccmasretiCurve, lcmasretiutili, locllmasretiCurve, llmasretiutili, lochhmasretiCurve, lhmasretiutili,
LHutili, HHutili, cclocalcurve, localcutili, localexutili, exlocalcurve, hltonecurveloc, shtonecurveloc, tonecurveloc, lightCurveloc, huerblu, chromarblu, lumarblu, huer, chromar, lumar, sobeler, locallColorMask, locallExpMask, locallSHMask, locallcbMask, locallretiMask);
LHutili, HHutili, cclocalcurve, localcutili, localexutili, exlocalcurve, hltonecurveloc, shtonecurveloc, tonecurveloc, lightCurveloc, huerblu, chromarblu, lumarblu, huer, chromar, lumar, sobeler, locallColorMask, locallExpMask, locallSHMask, locallcbMask, locallretiMask, locallsoftMask);
} else {
ipf.Lab_Local(3, sp, (float**)shbuffer, nprevl, nprevl, reserv, 0, 0, pW, pH, scale, locRETgainCurve, lllocalcurve, locallutili, loclhCurve, lochhCurve, locccmasCurve, lcmasutili, locllmasCurve, llmasutili, lochhmasCurve, lhmasutili, locccmasexpCurve, lcmasexputili, locllmasexpCurve, llmasexputili, lochhmasexpCurve, lhmasexputili,
locccmasSHCurve, lcmasSHutili, locllmasSHCurve, llmasSHutili, lochhmasSHCurve, lhmasSHutili,
locccmascbCurve, lcmascbutili, locllmascbCurve, llmascbutili, lochhmascbCurve, lhmascbutili,
locccmasretiCurve, lcmasretiutili, locllmasretiCurve, llmasretiutili, lochhmasretiCurve, lhmasretiutili,
LHutili, HHutili, cclocalcurve, localcutili, localexutili, exlocalcurve, hltonecurveloc, shtonecurveloc, tonecurveloc, lightCurveloc, huerblu, chromarblu, lumarblu, huer, chromar, lumar, sobeler, 0, 0, 0, 0, 0);
LHutili, HHutili, cclocalcurve, localcutili, localexutili, exlocalcurve, hltonecurveloc, shtonecurveloc, tonecurveloc, lightCurveloc, huerblu, chromarblu, lumarblu, huer, chromar, lumar, sobeler, 0, 0, 0, 0, 0, 0);
}
//recalculate references after
if (params->locallab.spots.at(sp).spotMethod == "exc") {

View File

@ -288,6 +288,7 @@ protected:
int locallSHMask;
int locallcbMask;
int locallretiMask;
int locallsoftMask;
public:
@ -356,13 +357,14 @@ public:
updaterThreadStart.unlock();
}
void setLocallabMaskVisibility (int locallColorMask, int locallExpMask, int locallSHMask, int locallcbMask, int locallretiMask) override
void setLocallabMaskVisibility (int locallColorMask, int locallExpMask, int locallSHMask, int locallcbMask, int locallretiMask, int locallsoftMask) override
{
this->locallColorMask = locallColorMask;
this->locallExpMask = locallExpMask;
this->locallSHMask = locallSHMask;
this->locallcbMask = locallcbMask;
this->locallretiMask = locallretiMask;
this->locallsoftMask = locallsoftMask;
}
void setProgressListener (ProgressListener* pl) override

View File

@ -299,7 +299,7 @@ public:
int pitch, int scale, const int luma, const int chroma/*, LUTf & Lcurve, LUTf & abcurve*/);
//locallab
void normalize_mean_dt(float *data, const float *ref, size_t size);
void retinex_pde(float *datain, float * dataout, int bfw, int bfh, float thresh, float multy, float *dE);
void retinex_pde(float *datain, float * dataout, int bfw, int bfh, float thresh, float multy, float *dE, int show);
void fftw_convol_blur(float *input, float *output, int bfw, int bfh, float radius, int fftkern, int algo);
void fftw_convol_blur2(float **input2, float **output2, int bfw, int bfh, float radius, int fftkern, int algo);
void fftw_tile_blur(int GW, int GH, int tilssize , int max_numblox_W, int min_numblox_W, float **tmp1, int numThreads, double radius);
@ -313,7 +313,7 @@ public:
const LocCCmaskSHCurve & locccmasSHCurve, bool &lcmasSHutili, const LocLLmaskSHCurve & locllmasSHCurve, bool &llmasSHutili, const LocHHmaskSHCurve & lochhmasSHCurve, bool & lhmasSHutili,
const LocCCmaskcbCurve & locccmascbCurve, bool &lcmascbutili, const LocLLmaskcbCurve & locllmascbCurve, bool &llmascbutili, const LocHHmaskcbCurve & lochhmascbCurve, bool & lhmascbutili,
const LocCCmaskretiCurve & locccmasretiCurve, bool &lcmasretiutili, const LocLLmaskretiCurve & locllmasretiCurve, bool &llmasretiutili, const LocHHmaskretiCurve & lochhmasretiCurve, bool & lhmasretiutili,
bool &LHutili, bool &HHutili, LUTf & cclocalcurve, bool & localcutili, bool & localexutili, LUTf & exlocalcurve, LUTf & hltonecurveloc, LUTf & shtonecurveloc, LUTf & tonecurveloc, LUTf & lightCurveloc, double & huerefblur, double &chromarefblur, double & lumarefblur, double &hueref, double &chromaref, double &lumaref, double &sobelref, int llColorMask, int llExpMask, int llSHMask, int llcbMask, int llretiMask);
bool &LHutili, bool &HHutili, LUTf & cclocalcurve, bool & localcutili, bool & localexutili, LUTf & exlocalcurve, LUTf & hltonecurveloc, LUTf & shtonecurveloc, LUTf & tonecurveloc, LUTf & lightCurveloc, double & huerefblur, double &chromarefblur, double & lumarefblur, double &hueref, double &chromaref, double &lumaref, double &sobelref, int llColorMask, int llExpMask, int llSHMask, int llcbMask, int llretiMask, int llsoftMask);
void addGaNoise(LabImage *lab, LabImage *dst, const float mean, const float variance, const int sk);
void BlurNoise_Localold(int call, const struct local_params& lp, LabImage* original, LabImage* transformed, const LabImage* const tmp1, int cx, int cy);
void InverseBlurNoise_Local(const struct local_params& lp, const float hueref, const float chromaref, const float lumaref, LabImage* original, LabImage* transformed, const LabImage* const tmp1, int cx, int cy, int sk);

View File

@ -252,6 +252,7 @@ struct local_params {
int showmaskSHmet;
int showmaskcbmet;
int showmaskretimet;
int showmasksoftmet;
int blurmet;
int softmet;
float noiself;
@ -397,7 +398,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, int llretiMask)
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 llsoftMask)
{
int w = oW;
int h = oH;
@ -463,7 +464,8 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall
lp.showmaskSHmet = llSHMask;
lp.showmaskcbmet = llcbMask;
lp.showmaskretimet = llretiMask;
//printf("llretiMask=%i\n", llretiMask);
lp.showmasksoftmet = llsoftMask;
printf("llsoftMask=%i\n", llsoftMask);
//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;
@ -3472,7 +3474,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, 0);
calcLocalParams(sp, oW, oH, params->locallab, lp, 0, 0, 0, 0, 0, 0);
int begy = lp.yc - lp.lyT;
int begx = lp.xc - lp.lxL;
int yEn = lp.yc + lp.ly;
@ -3899,7 +3901,7 @@ static float *discrete_laplacian_threshold(float *data_out, const float *data_in
return data_out;
}
void ImProcFunctions::retinex_pde(float *datain, float * dataout, int bfw, int bfh, float thresh, float multy, float *dE)
void ImProcFunctions::retinex_pde(float *datain, float * dataout, int bfw, int bfh, float thresh, float multy, float *dE, int show)
{
/*
* Copyright 2009-2011 IPOL Image Processing On Line http://www.ipol.im/
@ -3921,6 +3923,14 @@ void ImProcFunctions::retinex_pde(float *datain, float * dataout, int bfw, int b
#endif
fftwf_plan dct_fw, dct_fw04, dct_bw;
float *data_fft, *data_fft04, *data_tmp, *data, *data_tmp04;
float *datashow = nullptr;
if(show != 0) {
if (NULL == (datashow = (float *) fftwf_malloc(sizeof(float) * bfw * bfh))) {
fprintf(stderr, "allocation error\n");
abort();
}
}
if (NULL == (data_tmp = (float *) fftwf_malloc(sizeof(float) * bfw * bfh))) {
fprintf(stderr, "allocation error\n");
abort();
@ -3935,6 +3945,13 @@ void ImProcFunctions::retinex_pde(float *datain, float * dataout, int bfw, int b
fprintf(stderr, "allocation error\n");
abort();
}
if(show == 1) {
for (int y = 0; y < bfh ; y++) {
for (int x = 0; x < bfw; x++) {
datashow[y * bfw + x] = data_tmp[y * bfw + x];
}
}
}
//second call to laplacian with 40% strength ==> reduce effect if we are far from ref (deltaE)
(void) discrete_laplacian_threshold(data_tmp04, datain, bfw, bfh, 0.4f * thresh);
if (NULL == (data_fft04 = (float *) fftwf_malloc(sizeof(float) * bfw * bfh))) {
@ -3962,6 +3979,13 @@ void ImProcFunctions::retinex_pde(float *datain, float * dataout, int bfw, int b
data_fft[y * bfw + x] = prov * data_fft[y * bfw + x] + (1.f - prov) * data_fft04[y * bfw + x];
}
}
if(show == 2) {
for (int y = 0; y < bfh ; y++) {
for (int x = 0; x < bfw; x++) {
datashow[y * bfw + x] = data_fft[y * bfw + x];
}
}
}
fftwf_free(data_fft04);
fftwf_free(data_tmp);
fftwf_free(data_tmp04);
@ -3970,6 +3994,13 @@ void ImProcFunctions::retinex_pde(float *datain, float * dataout, int bfw, int b
/* solve the Poisson PDE in Fourier space */
/* 1. / (float) (bfw * bfh)) is the DCT normalisation term, see libfftw */
(void) retinex_poisson_dct(data_fft, bfw, bfh, 1./(double) (bfw * bfh));
if(show == 3) {
for (int y = 0; y < bfh ; y++) {
for (int x = 0; x < bfw; x++) {
datashow[y * bfw + x] = data_fft[y * bfw + x];
}
}
}
dct_bw = fftwf_plan_r2r_2d(bfh, bfw, data_fft, data, FFTW_REDFT01, FFTW_REDFT01, FFTW_ESTIMATE | FFTW_DESTROY_INPUT);
fftwf_execute(dct_bw);
@ -3979,16 +4010,28 @@ void ImProcFunctions::retinex_pde(float *datain, float * dataout, int bfw, int b
fftwf_cleanup();
if (multiThread) {
fftwf_cleanup_threads();
}
if( show != 4) {
normalize_mean_dt(data, datain, bfw * bfh);
}
normalize_mean_dt(data, datain, bfw * bfh);
if(show == 0 || show == 4) {
#ifdef _OPENMP
#pragma omp parallel for
#endif
for (int y = 0; y < bfh ; y++) {
for (int x = 0; x < bfw; x++) {
dataout[y * bfw + x] = CLIPLOC(multy * data[y * bfw + x]);
for (int y = 0; y < bfh ; y++) {
for (int x = 0; x < bfw; x++) {
dataout[y * bfw + x] = CLIPLOC(multy * data[y * bfw + x]);
}
}
} else if(show == 1 || show == 2 || show == 3) {
for (int y = 0; y < bfh ; y++) {
for (int x = 0; x < bfw; x++) {
dataout[y * bfw + x] = CLIPLOC(multy * datashow[y * bfw + x]);
}
}
fftwf_free(datashow);
}
}
@ -4606,7 +4649,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o
const LocCCmaskSHCurve & locccmasSHCurve, bool &lcmasSHutili, const LocLLmaskSHCurve & locllmasSHCurve, bool &llmasSHutili, const LocHHmaskSHCurve & lochhmasSHCurve, bool & lhmasSHutili,
const LocCCmaskcbCurve & locccmascbCurve, bool &lcmascbutili, const LocLLmaskcbCurve & locllmascbCurve, bool &llmascbutili, const LocHHmaskcbCurve & lochhmascbCurve, bool & lhmascbutili,
const LocCCmaskretiCurve & locccmasretiCurve, bool &lcmasretiutili, const LocLLmaskretiCurve & locllmasretiCurve, bool &llmasretiutili, const LocHHmaskretiCurve & lochhmasretiCurve, bool & lhmasretiutili,
bool & LHutili, bool & HHutili, LUTf & cclocalcurve, bool & localcutili, bool & localexutili, LUTf & exlocalcurve, LUTf & hltonecurveloc, LUTf & shtonecurveloc, LUTf & tonecurveloc, LUTf & lightCurveloc, double & huerefblur, double &chromarefblur, double & lumarefblur, double & hueref, double & chromaref, double & lumaref, double & sobelref, int llColorMask, int llExpMask, int llSHMask, int llcbMask, int llretiMask)
bool & LHutili, bool & HHutili, LUTf & cclocalcurve, bool & localcutili, bool & localexutili, LUTf & exlocalcurve, LUTf & hltonecurveloc, LUTf & shtonecurveloc, LUTf & tonecurveloc, LUTf & lightCurveloc, double & huerefblur, double &chromarefblur, double & lumarefblur, double & hueref, double & chromaref, double & lumaref, double & sobelref, int llColorMask, int llExpMask, int llSHMask, int llcbMask, int llretiMask, int llsoftMask)
{
/* comment on processus deltaE
* the algo uses 3 different ways to manage deltaE according to the type of intervention
@ -4636,7 +4679,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, llretiMask);
calcLocalParams(sp, oW, oH, params->locallab, lp, llColorMask, llExpMask, llSHMask, llcbMask, llretiMask, llsoftMask);
const float radius = lp.rad / (sk * 1.4f); //0 to 70 ==> see skip
int strred = 1;//(lp.strucc - 1);
@ -6498,7 +6541,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o
}
}
ImProcFunctions::retinex_pde(datain, dataout, bfwr, bfhr, 8.f * lp.strng, 1.f, dE);
ImProcFunctions::retinex_pde(datain, dataout, bfwr, bfhr, 8.f * lp.strng, 1.f, dE, lp.showmasksoftmet);
#ifdef _OPENMP
#pragma omp parallel for schedule(dynamic,16)
#endif

View File

@ -726,6 +726,7 @@ enum ProcEventCode {
Evlocallabequiltm = 696,
Evlocallabfftwlc = 697,
Evlocallabfftwreti = 698,
EvlocallabshowmasksoftMethod = 699,
NUMOFEVENTS
};

View File

@ -725,7 +725,8 @@ int refreshmap[rtengine::NUMOFEVENTS] = {
LUMINANCECURVE, // Evlocallabequilret
LUMINANCECURVE, // Evlocallabequiltm
LUMINANCECURVE, // Evlocallabfftwlc
LUMINANCECURVE // Evlocallabfftwreti
LUMINANCECURVE, // Evlocallabfftwreti
LUMINANCECURVE //EvlocallabshowmasksoftMethod
};

View File

@ -499,7 +499,7 @@ public:
virtual void updateUnLock() = 0;
virtual void setLocallabMaskVisibility(int locallColorMask, int locallExpMask, int locallSHMask, int locallcbMask, int locallretiMask) = 0;
virtual void setLocallabMaskVisibility(int locallColorMask, int locallExpMask, int locallSHMask, int locallcbMask, int locallretiMask, int locallsoftMask) = 0;
/** Creates and returns a Crop instance that acts as a window on the image
* @param editDataProvider pointer to the EditDataProvider that communicates with the EditSubscriber

View File

@ -1189,7 +1189,7 @@ private:
locccmasSHCurve, lcmasSHutili, locllmasSHCurve, llmasSHutili, lochhmasSHCurve, lhmasSHutili,
locccmascbCurve, lcmascbutili, locllmascbCurve, llmascbutili, lochhmascbCurve, lhmascbutili,
locccmasretiCurve, lcmasretiutili, locllmasretiCurve, llmasretiutili, lochhmasretiCurve, lhmasretiutili,
LHutili, HHutili, cclocalcurve, localcutili, localexutili, exlocalcurve, hltonecurveloc, shtonecurveloc, tonecurveloc, lightCurveloc, huerefblu, chromarefblu, lumarefblu, huere, chromare, lumare, sobelre, 0, 0, 0, 0, 0);
LHutili, HHutili, cclocalcurve, localcutili, localexutili, exlocalcurve, hltonecurveloc, shtonecurveloc, tonecurveloc, lightCurveloc, huerefblu, chromarefblu, lumarefblu, huere, chromare, lumare, sobelre, 0, 0, 0, 0, 0, 0);
// Clear local curves

View File

@ -337,6 +337,7 @@ Locallab::Locallab():
blurMethod(Gtk::manage(new MyComboBoxText())),
//soft Method
softMethod(Gtk::manage(new MyComboBoxText())),
showmasksoftMethod(Gtk::manage(new MyComboBoxText())),
// Retinex
retinexMethod(Gtk::manage(new MyComboBoxText())),
showmaskretiMethod(Gtk::manage(new MyComboBoxText())),
@ -826,13 +827,32 @@ Locallab::Locallab():
softMethodConn = softMethod->signal_changed().connect(sigc::mem_fun(*this, &Locallab::softMethodChanged));
ctboxsoftmethod = Gtk::manage(new Gtk::HBox());
Gtk::Label* const labelsoftmethod = Gtk::manage(new Gtk::Label(M("TP_LOCALLAB_SHOWDCT") + ":"));
ctboxsoftmethod->pack_start(*labelsoftmethod, Gtk::PACK_SHRINK, 4);
showmasksoftMethod->append(M("TP_LOCALLAB_SHOWMNONE"));
showmasksoftMethod->append(M("TP_LOCALLAB_SHOWLAPLACE"));
showmasksoftMethod->append(M("TP_LOCALLAB_SHOWFOURIER"));
showmasksoftMethod->append(M("TP_LOCALLAB_SHOWPOISSON"));
showmasksoftMethod->append(M("TP_LOCALLAB_SHOWNORMAL"));
showmasksoftMethod->set_active(0);
if(showtooltip) showmasksoftMethod->set_tooltip_markup(M("TP_LOCALLAB_SHOWMASKSOFT_TOOLTIP"));
showmasksoftMethodConn = showmasksoftMethod->signal_changed().connect(sigc::mem_fun(*this, &Locallab::showmasksoftMethodChanged));
ctboxsoftmethod->pack_start(*showmasksoftMethod);
streng->setAdjusterListener(this);
laplace->setAdjusterListener(this);
sensisf->setAdjusterListener(this);
ToolParamBlock* const softBox = Gtk::manage(new ToolParamBlock());
softBox->pack_start(*softMethod);
// softBox->pack_start(*showmasksoftMethod, Gtk::PACK_SHRINK, 4);
softBox->pack_start(*ctboxsoftmethod);
softBox->pack_start(*streng);
softBox->pack_start(*laplace);
softBox->pack_start(*sensisf);
@ -3054,8 +3074,10 @@ void Locallab::softMethodChanged()
// printf("softMethodChanged\n");
if (softMethod->get_active_row_number() == 0) {
laplace->hide();
ctboxsoftmethod->hide();
} else {
laplace->show();
ctboxsoftmethod->show();
}
if (getEnabled() && expsoft->getEnabled()) {
@ -3185,6 +3207,23 @@ void Locallab::showmaskretiMethodChanged()
}
}
void Locallab::showmasksoftMethodChanged()
{
// printf("showmaskcolMethodChanged\n");
// When one mask state is changed, other masks are deactivated
disableListener();
showmaskexpMethod->set_active(0);
showmaskSHMethod->set_active(0);
showmaskcbMethod->set_active(0);
showmaskretiMethod->set_active(0);
enableListener();
if (listener) {
listener->panelChanged(EvlocallabshowmasksoftMethod, "");
}
}
void Locallab::resetMaskVisibility()
{
// printf("resetMaskVisibility\n");
@ -3206,6 +3245,7 @@ Locallab::llMaskVisibility* Locallab::getMaskVisibility()
maskStruct->SHMask = showmaskSHMethod->get_active_row_number();
maskStruct->cbMask = showmaskcbMethod->get_active_row_number();
maskStruct->retiMask = showmaskretiMethod->get_active_row_number();
maskStruct->softMask = showmasksoftMethod->get_active_row_number();
// printf("SHmask=%i \n", maskStruct->SHMask);
printf("retimask=%i \n", maskStruct->retiMask);
@ -5343,6 +5383,7 @@ void Locallab::enableListener()
// Soft Light
enablesoftConn.block(false);
softMethodConn.block(false);
showmasksoftMethodConn.block(false);
// Blur & Noise
enableblurConn.block(false);
blurMethodConn.block(false);
@ -5404,6 +5445,7 @@ void Locallab::disableListener()
// Soft Light
enablesoftConn.block(true);
softMethodConn.block(true);
showmasksoftMethodConn.block(true);
// Blur & Noise
enableblurConn.block(true);
blurMethodConn.block(true);

View File

@ -305,6 +305,9 @@ private:
//soft light
MyComboBoxText* const softMethod;
sigc::connection softMethodConn;
MyComboBoxText* const showmasksoftMethod;
sigc::connection showmasksoftMethodConn;
// Retinex
MyComboBoxText* const retinexMethod;
sigc::connection retinexMethodConn;
@ -327,6 +330,7 @@ private:
Gtk::Frame* residFrame;
LabGrid *labgrid;
// Others
Gtk::HBox* ctboxsoftmethod;
/**
* Used to store the default ProcParams when setDefaults function is called
* When an other spot is selected, this default ProcParams is used to update adjusters default values
@ -391,6 +395,7 @@ private:
void blurMethodChanged();
// Soft light
void softMethodChanged();
void showmasksoftMethodChanged();
// Retinex
void retinexMethodChanged();
void showmaskretiMethodChanged();
@ -432,6 +437,7 @@ public:
int SHMask;
int cbMask;
int retiMask;
int softMask;
};
void resetMaskVisibility();

View File

@ -466,9 +466,9 @@ void ToolPanelCoordinator::panelChanged(const rtengine::ProcEvent& event, const
}
// Manage Locallab mask visibility
if (event == rtengine::EvlocallabshowmaskcolMethod || event == rtengine::EvlocallabshowmaskexpMethod || event == rtengine::EvlocallabshowmaskSHMethod || event == rtengine::EvlocallabshowmaskcbMethod || event == rtengine::EvlocallabshowmaskretiMethod ) {
if (event == rtengine::EvlocallabshowmaskcolMethod || event == rtengine::EvlocallabshowmaskexpMethod || event == rtengine::EvlocallabshowmaskSHMethod || event == rtengine::EvlocallabshowmasksoftMethod || event == rtengine::EvlocallabshowmaskcbMethod || event == rtengine::EvlocallabshowmaskretiMethod ) {
Locallab::llMaskVisibility* maskStruc = locallab->getMaskVisibility();
ipc->setLocallabMaskVisibility(maskStruc->colorMask, maskStruc->expMask, maskStruc->SHMask, maskStruc->cbMask, maskStruc->retiMask);
ipc->setLocallabMaskVisibility(maskStruc->colorMask, maskStruc->expMask, maskStruc->SHMask, maskStruc->cbMask, maskStruc->retiMask, maskStruc->softMask);
}
ipc->endUpdateParams(changeFlags); // starts the IPC processing
@ -576,7 +576,7 @@ void ToolPanelCoordinator::profileChange(
// Reset Locallab mask visibility when a picture is loaded
if (event == rtengine::EvPhotoLoaded) {
locallab->resetMaskVisibility();
ipc->setLocallabMaskVisibility(0, 0, 0, 0, 0);
ipc->setLocallabMaskVisibility(0, 0, 0, 0, 0, 0);
}
// start the IPC processing