Color toning - set opacity to linear does not turns color toning off - issue2014
This commit is contained in:
parent
75597282fd
commit
e894794e1a
@ -1166,7 +1166,7 @@ void OpacityCurve::Set(const Curve *pCurve) {
|
||||
//lutOpacityCurve.dump("opacity");
|
||||
}
|
||||
|
||||
void OpacityCurve::Set(const std::vector<double> &curvePoints) {
|
||||
void OpacityCurve::Set(const std::vector<double> &curvePoints, bool &opautili) {
|
||||
FlatCurve* tcurve = NULL;
|
||||
|
||||
if (!curvePoints.empty() && curvePoints[0]>FCT_Linear && curvePoints[0]<FCT_Unchanged) {
|
||||
@ -1174,7 +1174,7 @@ void OpacityCurve::Set(const std::vector<double> &curvePoints) {
|
||||
tcurve->setIdentityValue(0.);
|
||||
}
|
||||
if (tcurve) {
|
||||
Set(tcurve);
|
||||
Set(tcurve);opautili=true;
|
||||
delete tcurve;
|
||||
tcurve = NULL;
|
||||
}
|
||||
|
@ -335,7 +335,7 @@ class OpacityCurve {
|
||||
|
||||
void Reset();
|
||||
void Set(const Curve *pCurve);
|
||||
void Set(const std::vector<double> &curvePoints);
|
||||
void Set(const std::vector<double> &curvePoints, bool &opautili);
|
||||
|
||||
// TODO: transfer this method to the Color class...
|
||||
float blend (float x, float lower, float upper) const {
|
||||
|
@ -239,7 +239,7 @@ void Crop::update (int todo) {
|
||||
|
||||
if (todo & M_RGBCURVE)
|
||||
parent->ipf.rgbProc (baseCrop, laboCrop, this, parent->hltonecurve, parent->shtonecurve, parent->tonecurve, cshmap,
|
||||
params.toneCurve.saturation, parent->rCurve, parent->gCurve, parent->bCurve, satLimit ,satLimitOpacity, parent->ctColorCurve, parent->ctOpacityCurve, parent->clToningcurve,parent->cl2Toningcurve,
|
||||
params.toneCurve.saturation, parent->rCurve, parent->gCurve, parent->bCurve, satLimit ,satLimitOpacity, parent->ctColorCurve, parent->ctOpacityCurve, parent->opautili, parent->clToningcurve,parent->cl2Toningcurve,
|
||||
parent->customToneCurve1, parent->customToneCurve2, parent->beforeToneCurveBW, parent->afterToneCurveBW,rrm, ggm, bbm,
|
||||
parent->bwAutoR, parent->bwAutoG, parent->bwAutoB);
|
||||
|
||||
|
@ -83,7 +83,7 @@ ImProcCoordinator::ImProcCoordinator ()
|
||||
|
||||
pW(-1), pH(-1),
|
||||
plistener(NULL), imageListener(NULL), aeListener(NULL), hListener(NULL),acListener(NULL), abwListener(NULL),actListener(NULL),
|
||||
resultValid(false), changeSinceLast(0), updaterRunning(false), destroying(false),utili(false),autili(false),lldenoiseutili(false),
|
||||
resultValid(false), changeSinceLast(0), updaterRunning(false), destroying(false),utili(false),autili(false),lldenoiseutili(false), opautili(false),
|
||||
butili(false),ccutili(false),cclutili(false),clcutili(false),fullw(1),fullh(1)
|
||||
|
||||
{}
|
||||
@ -356,7 +356,10 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) {
|
||||
{wiprof[1][0],wiprof[1][1],wiprof[1][2]},
|
||||
{wiprof[2][0],wiprof[2][1],wiprof[2][2]}
|
||||
};
|
||||
params.colorToning.getCurves(ctColorCurve, ctOpacityCurve, wp, wip);
|
||||
opautili=false;
|
||||
params.colorToning.getCurves(ctColorCurve, ctOpacityCurve, wp, wip, opautili);
|
||||
if(opautili) printf("OPA OUI\n");
|
||||
if(!opautili) printf("OPA NON\n");
|
||||
|
||||
bool clctoningutili=false;
|
||||
bool llctoningutili=false;
|
||||
@ -412,7 +415,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) {
|
||||
// if it's just crop we just need the histogram, no image updates
|
||||
if ( todo & M_RGBCURVE ) {
|
||||
ipf.rgbProc (oprevi, oprevl, NULL, hltonecurve, shtonecurve, tonecurve, shmap, params.toneCurve.saturation,
|
||||
rCurve, gCurve, bCurve, satLimit ,satLimitOpacity, ctColorCurve, ctOpacityCurve, clToningcurve, cl2Toningcurve, customToneCurve1, customToneCurve2,beforeToneCurveBW, afterToneCurveBW, rrm, ggm, bbm, bwAutoR, bwAutoG, bwAutoB, params.toneCurve.expcomp, params.toneCurve.hlcompr, params.toneCurve.hlcomprthresh);
|
||||
rCurve, gCurve, bCurve, satLimit ,satLimitOpacity, ctColorCurve, ctOpacityCurve, opautili, clToningcurve, cl2Toningcurve, customToneCurve1, customToneCurve2,beforeToneCurveBW, afterToneCurveBW, rrm, ggm, bbm, bwAutoR, bwAutoG, bwAutoB, params.toneCurve.expcomp, params.toneCurve.hlcompr, params.toneCurve.hlcomprthresh);
|
||||
if(params.blackwhite.enabled && params.blackwhite.autoc && abwListener) {
|
||||
if (settings->verbose)
|
||||
printf("ImProcCoordinator / Auto B&W coefs: R=%.2f G=%.2f B=%.2f\n", bwAutoR, bwAutoG, bwAutoB);
|
||||
|
@ -121,6 +121,7 @@ class ImProcCoordinator : public StagedImageProcessor {
|
||||
bool cclutili;
|
||||
bool clcutili;
|
||||
bool lldenoiseutili;
|
||||
bool opautili;
|
||||
ToneCurve customToneCurve1;
|
||||
ToneCurve customToneCurve2;
|
||||
ColorGradientCurve ctColorCurve;
|
||||
|
@ -2134,14 +2134,14 @@ float mo=0.f;
|
||||
|
||||
|
||||
void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, EditBuffer *editBuffer, LUTf & hltonecurve, LUTf & shtonecurve, LUTf & tonecurve,
|
||||
SHMap* shmap, int sat, LUTf & rCurve, LUTf & gCurve, LUTf & bCurve, float satLimit ,float satLimitOpacity, const ColorGradientCurve & ctColorCurve, const OpacityCurve & ctOpacityCurve, LUTf & clToningcurve,LUTf & cl2Toningcurve,
|
||||
SHMap* shmap, int sat, LUTf & rCurve, LUTf & gCurve, LUTf & bCurve, float satLimit ,float satLimitOpacity, const ColorGradientCurve & ctColorCurve, const OpacityCurve & ctOpacityCurve, bool opautili, LUTf & clToningcurve,LUTf & cl2Toningcurve,
|
||||
const ToneCurve & customToneCurve1,const ToneCurve & customToneCurve2, const ToneCurve & customToneCurvebw1,const ToneCurve & customToneCurvebw2, double &rrm, double &ggm, double &bbm, float &autor, float &autog, float &autob ) {
|
||||
rgbProc (working, lab, editBuffer, hltonecurve, shtonecurve, tonecurve, shmap, sat, rCurve, gCurve, bCurve, satLimit ,satLimitOpacity, ctColorCurve, ctOpacityCurve, clToningcurve, cl2Toningcurve,customToneCurve1, customToneCurve2, customToneCurvebw1, customToneCurvebw2,rrm, ggm, bbm, autor, autog, autob, params->toneCurve.expcomp, params->toneCurve.hlcompr, params->toneCurve.hlcomprthresh);
|
||||
rgbProc (working, lab, editBuffer, hltonecurve, shtonecurve, tonecurve, shmap, sat, rCurve, gCurve, bCurve, satLimit ,satLimitOpacity, ctColorCurve, ctOpacityCurve, opautili, clToningcurve, cl2Toningcurve,customToneCurve1, customToneCurve2, customToneCurvebw1, customToneCurvebw2,rrm, ggm, bbm, autor, autog, autob, params->toneCurve.expcomp, params->toneCurve.hlcompr, params->toneCurve.hlcomprthresh);
|
||||
}
|
||||
|
||||
// Process RGB image and convert to LAB space
|
||||
void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, EditBuffer *editBuffer, LUTf & hltonecurve, LUTf & shtonecurve, LUTf & tonecurve,
|
||||
SHMap* shmap, int sat, LUTf & rCurve, LUTf & gCurve, LUTf & bCurve, float satLimit ,float satLimitOpacity, const ColorGradientCurve & ctColorCurve, const OpacityCurve & ctOpacityCurve, LUTf & clToningcurve,LUTf & cl2Toningcurve,
|
||||
SHMap* shmap, int sat, LUTf & rCurve, LUTf & gCurve, LUTf & bCurve, float satLimit ,float satLimitOpacity, const ColorGradientCurve & ctColorCurve, const OpacityCurve & ctOpacityCurve, bool opautili, LUTf & clToningcurve,LUTf & cl2Toningcurve,
|
||||
const ToneCurve & customToneCurve1, const ToneCurve & customToneCurve2, const ToneCurve & customToneCurvebw1,const ToneCurve & customToneCurvebw2,double &rrm, double &ggm, double &bbm, float &autor, float &autog, float &autob, double expcomp, int hlcompr, int hlcomprthresh) {
|
||||
|
||||
LUTf iGammaLUTf;
|
||||
@ -2300,7 +2300,6 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, EditBuffer *e
|
||||
bool hasToneCurvebw2 = bool(customToneCurvebw2);
|
||||
|
||||
bool hasColorToning = params->colorToning.enabled && bool(ctOpacityCurve) && bool(ctColorCurve);
|
||||
|
||||
// float satLimit = float(params->colorToning.satProtectionThreshold)/100.f*0.7f+0.3f;
|
||||
// float satLimitOpacity = 1.f-(float(params->colorToning.saturatedOpacity)/100.f);
|
||||
float strProtect = (float(params->colorToning.strength)/100.f);
|
||||
@ -2973,7 +2972,7 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, EditBuffer *e
|
||||
}
|
||||
|
||||
//colortoning with shift color XYZ or Lch
|
||||
else if (params->colorToning.method=="Lab") {
|
||||
else if (params->colorToning.method=="Lab" && opautili) {
|
||||
int algm=0;
|
||||
bool twocol = true;//true=500 color false=2 color
|
||||
int metchrom;
|
||||
@ -3010,7 +3009,7 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, EditBuffer *e
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (params->colorToning.method.substr(0,3)=="RGB") {
|
||||
else if (params->colorToning.method.substr(0,3)=="RGB" && opautili) {
|
||||
// color toning
|
||||
for (int i=istart,ti=0; i<tH; i++,ti++) {
|
||||
for (int j=jstart,tj=0; j<tW; j++,tj++) {
|
||||
@ -3026,8 +3025,9 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, EditBuffer *e
|
||||
float l_ = Color::gamma_srgb(l*65535.f)/65535.f;
|
||||
|
||||
// get the opacity and tweak it to preserve saturated colors
|
||||
float opacity = (1.f-min<float>(s/satLimit, 1.f)*(1.f-satLimitOpacity)) * ctOpacityCurve.lutOpacityCurve[l_*500.f];
|
||||
|
||||
float opacity;
|
||||
if(ctOpacityCurve) opacity = (1.f-min<float>(s/satLimit, 1.f)*(1.f-satLimitOpacity)) * ctOpacityCurve.lutOpacityCurve[l_*500.f];
|
||||
if(!ctOpacityCurve) opacity=0.f;
|
||||
float r2, g2, b2;
|
||||
ctColorCurve.getVal(l_, r2, g2, b2); // get the color from the color curve
|
||||
|
||||
@ -3555,7 +3555,7 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, EditBuffer *e
|
||||
}
|
||||
|
||||
//colortoning with shift color Lab
|
||||
else if (params->colorToning.method=="Lab") {
|
||||
else if (params->colorToning.method=="Lab" && opautili) {
|
||||
int algm=0;
|
||||
bool twocol = true;
|
||||
int metchrom;
|
||||
@ -3598,7 +3598,7 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, EditBuffer *e
|
||||
}
|
||||
}
|
||||
|
||||
else if (params->colorToning.method.substr(0,3)=="RGB") {
|
||||
else if (params->colorToning.method.substr(0,3)=="RGB" && opautili) {
|
||||
// color toning
|
||||
#ifdef _OPENMP
|
||||
#pragma omp parallel for schedule(dynamic, 5)
|
||||
@ -4209,8 +4209,8 @@ void ImProcFunctions::labtoning (float r, float g, float b, float &ro, float &go
|
||||
|
||||
// get the opacity and tweak it to preserve saturated colors
|
||||
//float l_ = Color::gamma_srgb(l*65535.f)/65535.f;
|
||||
float opacity = (1.f-min<float>(s/satLimit, 1.f)*(1.f-satLimitOpacity)) * ctOpacityCurve.lutOpacityCurve[l*500.f];
|
||||
|
||||
float opacity;
|
||||
opacity = (1.f-min<float>(s/satLimit, 1.f)*(1.f-satLimitOpacity)) * ctOpacityCurve.lutOpacityCurve[l*500.f];
|
||||
float opacity2 = (1.f-min<float>(s/satLimit, 1.f)*(1.f-satLimitOpacity));
|
||||
|
||||
//float ro, go, bo;
|
||||
|
@ -195,10 +195,10 @@ class ImProcFunctions {
|
||||
|
||||
void firstAnalysis (Imagefloat* working, const ProcParams* params, LUTu & vhist16, double gamma);
|
||||
void rgbProc (Imagefloat* working, LabImage* lab, EditBuffer *editBuffer, LUTf & hltonecurve, LUTf & shtonecurve, LUTf & tonecurve,
|
||||
SHMap* shmap, int sat, LUTf & rCurve, LUTf & gCurve, LUTf & bCurve, float satLimit , float satLimitOpacity, const ColorGradientCurve & ctColorCurve, const OpacityCurve & ctOpacityCurve,LUTf & clcurve, LUTf & cl2curve, const ToneCurve & customToneCurve1, const ToneCurve & customToneCurve2,
|
||||
SHMap* shmap, int sat, LUTf & rCurve, LUTf & gCurve, LUTf & bCurve, float satLimit , float satLimitOpacity, const ColorGradientCurve & ctColorCurve, const OpacityCurve & ctOpacityCurve, bool opautili, LUTf & clcurve, LUTf & cl2curve, const ToneCurve & customToneCurve1, const ToneCurve & customToneCurve2,
|
||||
const ToneCurve & customToneCurvebw1,const ToneCurve & customToneCurvebw2, double &rrm, double &ggm, double &bbm, float &autor, float &autog, float &autob);
|
||||
void rgbProc (Imagefloat* working, LabImage* lab, EditBuffer *editBuffer, LUTf & hltonecurve, LUTf & shtonecurve, LUTf & tonecurve,
|
||||
SHMap* shmap, int sat, LUTf & rCurve, LUTf & gCurve, LUTf & bCurve, float satLimit , float satLimitOpacity,const ColorGradientCurve & ctColorCurve, const OpacityCurve & ctOpacityCurve, LUTf & clcurve, LUTf & cl2curve, const ToneCurve & customToneCurve1, const ToneCurve & customToneCurve2,
|
||||
SHMap* shmap, int sat, LUTf & rCurve, LUTf & gCurve, LUTf & bCurve, float satLimit , float satLimitOpacity,const ColorGradientCurve & ctColorCurve, const OpacityCurve & ctOpacityCurve, bool opautili, LUTf & clcurve, LUTf & cl2curve, const ToneCurve & customToneCurve1, const ToneCurve & customToneCurve2,
|
||||
const ToneCurve & customToneCurvebw1,const ToneCurve & customToneCurvebw2, double &rrm, double &ggm, double &bbm, float &autor, float &autog, float &autob,
|
||||
double expcomp, int hlcompr, int hlcomprthresh);
|
||||
void labtoning (float r, float g, float b, float &ro, float &go, float &bo, int algm, int metchrom, int twoc, float satLimit, float satLimitOpacity, const ColorGradientCurve & ctColorCurve, const OpacityCurve & ctOpacityCurve, LUTf & clToningcurve,LUTf & cl2Toningcurve, float iplow, float iphigh, double wp[3][3], double wip[3][3] );
|
||||
|
@ -383,7 +383,7 @@ void ColorToningParams::slidersToCurve(std::vector<double> &colorCurve, std::vec
|
||||
opacityCurve.at(8) = 0.35;
|
||||
}
|
||||
|
||||
void ColorToningParams::getCurves(ColorGradientCurve &colorCurveLUT, OpacityCurve &opacityCurveLUT, const double xyz_rgb[3][3], const double rgb_xyz[3][3]) const {
|
||||
void ColorToningParams::getCurves(ColorGradientCurve &colorCurveLUT, OpacityCurve &opacityCurveLUT, const double xyz_rgb[3][3], const double rgb_xyz[3][3], bool &opautili) const {
|
||||
float satur=0.8f;
|
||||
float lumin=0.5f;//middle of luminance for optimization of gamut - no real importance...as we work in XYZ and gamut control
|
||||
|
||||
@ -402,15 +402,15 @@ void ColorToningParams::getCurves(ColorGradientCurve &colorCurveLUT, OpacityCurv
|
||||
if(twocolor=="Separ") satur=0.9f;
|
||||
if(twocolor=="All" || twocolor=="Two") satur=0.9f;
|
||||
colorCurveLUT.SetXYZ(cCurve, xyz_rgb, rgb_xyz, satur, lumin);
|
||||
opacityCurveLUT.Set(oCurve);
|
||||
opacityCurveLUT.Set(oCurve, opautili);
|
||||
}
|
||||
else if(method=="Splitlr" || method=="Splitco") {
|
||||
colorCurveLUT.SetXYZ(cCurve, xyz_rgb, rgb_xyz, satur, lumin);
|
||||
opacityCurveLUT.Set(oCurve);
|
||||
opacityCurveLUT.Set(oCurve, opautili);
|
||||
}
|
||||
else if(method.substr(0,3)=="RGB") {
|
||||
colorCurveLUT.SetRGB(cCurve, xyz_rgb, rgb_xyz);
|
||||
opacityCurveLUT.Set(oCurve);
|
||||
opacityCurveLUT.Set(oCurve, opautili);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -307,7 +307,7 @@ class ColorToningParams {
|
||||
/// @brief Specifically transform the sliders values to their curve equivalences
|
||||
void slidersToCurve(std::vector<double> &colorCurve, std::vector<double> &opacityCurve) const;
|
||||
/// @brief Fill the ColorGradientCurve and OpacityCurve LUTf from the control points curve or sliders value
|
||||
void getCurves(ColorGradientCurve &colorCurveLUT, OpacityCurve &opacityCurveLUT, const double xyz_rgb[3][3], const double rgb_xyz[3][3]) const;
|
||||
void getCurves(ColorGradientCurve &colorCurveLUT, OpacityCurve &opacityCurveLUT, const double xyz_rgb[3][3], const double rgb_xyz[3][3], bool &opautili) const;
|
||||
|
||||
static void getDefaultColorCurve(std::vector<double> &curve);
|
||||
static void getDefaultOpacityCurve(std::vector<double> &curve);
|
||||
|
@ -866,7 +866,8 @@ IImage8* Thumbnail::processImage (const procparams::ProcParams& params, int rhei
|
||||
{wiprof[1][0],wiprof[1][1],wiprof[1][2]},
|
||||
{wiprof[2][0],wiprof[2][1],wiprof[2][2]}
|
||||
};
|
||||
params.colorToning.getCurves(ctColorCurve, ctOpacityCurve, wp, wip);
|
||||
bool opautili=false;
|
||||
params.colorToning.getCurves(ctColorCurve, ctOpacityCurve, wp, wip, opautili);
|
||||
//params.dirpyrDenoise.getCurves(dnNoisCurve, lldenoisutili);
|
||||
|
||||
LabImage* labView = new LabImage (fw,fh);
|
||||
@ -898,7 +899,7 @@ IImage8* Thumbnail::processImage (const procparams::ProcParams& params, int rhei
|
||||
}
|
||||
|
||||
autor = autog = autob = -9000.f; // This will ask to compute the "auto" values for the B&W tool
|
||||
ipf.rgbProc (baseImg, labView, NULL, curve1, curve2, curve, shmap, params.toneCurve.saturation, rCurve, gCurve, bCurve, satLimit ,satLimitOpacity, ctColorCurve, ctOpacityCurve, clToningcurve, cl2Toningcurve, customToneCurve1, customToneCurve2, customToneCurvebw1, customToneCurvebw2,rrm, ggm, bbm, autor, autog, autob, expcomp, hlcompr, hlcomprthresh);
|
||||
ipf.rgbProc (baseImg, labView, NULL, curve1, curve2, curve, shmap, params.toneCurve.saturation, rCurve, gCurve, bCurve, satLimit ,satLimitOpacity, ctColorCurve, ctOpacityCurve, opautili, clToningcurve, cl2Toningcurve, customToneCurve1, customToneCurve2, customToneCurvebw1, customToneCurvebw2,rrm, ggm, bbm, autor, autog, autob, expcomp, hlcompr, hlcomprthresh);
|
||||
|
||||
// freeing up some memory
|
||||
customToneCurve1.Reset();
|
||||
|
@ -240,7 +240,8 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p
|
||||
{wiprof[1][0],wiprof[1][1],wiprof[1][2]},
|
||||
{wiprof[2][0],wiprof[2][1],wiprof[2][2]}
|
||||
};
|
||||
params.colorToning.getCurves(ctColorCurve, ctOpacityCurve, wp, wip);
|
||||
bool opautili=false;
|
||||
params.colorToning.getCurves(ctColorCurve, ctOpacityCurve, wp, wip, opautili);
|
||||
|
||||
bool clctoningutili=false;
|
||||
CurveFactory::curveToningCL(clctoningutili, params.colorToning.clcurve, clToningcurve, 1);
|
||||
@ -271,7 +272,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p
|
||||
}
|
||||
|
||||
autor = -9000.f; // This will ask to compute the "auto" values for the B&W tool (have to be inferior to -5000)
|
||||
ipf.rgbProc (baseImg, labView, NULL, curve1, curve2, curve, shmap, params.toneCurve.saturation, rCurve, gCurve, bCurve, satLimit ,satLimitOpacity, ctColorCurve, ctOpacityCurve, clToningcurve, cl2Toningcurve,customToneCurve1, customToneCurve2,customToneCurvebw1, customToneCurvebw2, rrm, ggm, bbm, autor, autog, autob, expcomp, hlcompr, hlcomprthresh);
|
||||
ipf.rgbProc (baseImg, labView, NULL, curve1, curve2, curve, shmap, params.toneCurve.saturation, rCurve, gCurve, bCurve, satLimit ,satLimitOpacity, ctColorCurve, ctOpacityCurve, opautili, clToningcurve, cl2Toningcurve,customToneCurve1, customToneCurve2,customToneCurvebw1, customToneCurvebw2, rrm, ggm, bbm, autor, autog, autob, expcomp, hlcompr, hlcomprthresh);
|
||||
if (settings->verbose)
|
||||
printf("Output image / Auto B&W coefs: R=%.2f G=%.2f B=%.2f\n", autor, autog, autob);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user