Some improvments
This commit is contained in:
parent
ee63f51e5c
commit
7ac9629a7e
@ -103,7 +103,7 @@ public:
|
||||
{
|
||||
rm = gm = bm = 1.0;
|
||||
}
|
||||
virtual void getAutoWBMultipliersloc(double &tempref, double &greenref, double &tempitc, double &greenitc, float &studgood, int begx, int begy, int yEn, int xEn, int cx, int cy, int bf_h, int bf_w, double &rm, double &gm, double &bm, const procparams::WBParams & wbpar, const procparams::ColorManagementParams &cmp, const procparams::RAWParams &raw)
|
||||
virtual void getAutoWBMultipliersitc(double &tempref, double &greenref, double &tempitc, double &greenitc, float &studgood, int begx, int begy, int yEn, int xEn, int cx, int cy, int bf_h, int bf_w, double &rm, double &gm, double &bm, const procparams::WBParams & wbpar, const procparams::ColorManagementParams &cmp, const procparams::RAWParams &raw)
|
||||
{
|
||||
rm = gm = bm = 1.0;
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ public:
|
||||
|
||||
virtual void convertColorSpace (Imagefloat* image, const ColorManagementParams &cmp, const ColorTemp &wb) = 0; // DIRTY HACK: this method is derived in rawimagesource and strimagesource, but (...,RAWParams raw) will be used ONLY for raw images
|
||||
virtual void getAutoWBMultipliers (double &rm, double &gm, double &bm) = 0;
|
||||
virtual void getAutoWBMultipliersloc(double &tempref, double &greenref, double &tempitc, double & greenitc, float &studgood, int begx, int begy, int yEn, int xEn, int cx, int cy, int bf_h, int bf_w, double &rm, double &gm, double &bm, const WBParams & wbpar, const ColorManagementParams &cmp, const RAWParams &raw) = 0;
|
||||
virtual void getAutoWBMultipliersitc(double &tempref, double &greenref, double &tempitc, double & greenitc, float &studgood, int begx, int begy, int yEn, int xEn, int cx, int cy, int bf_h, int bf_w, double &rm, double &gm, double &bm, const WBParams & wbpar, const ColorManagementParams &cmp, const RAWParams &raw) = 0;
|
||||
virtual ColorTemp getWB () const = 0;
|
||||
virtual ColorTemp getSpotWB (std::vector<Coord2D> &red, std::vector<Coord2D> &green, std::vector<Coord2D> &blue, int tran, double equal) = 0;
|
||||
virtual void WBauto(double &tempref, double &greenref, array2D<float> &redloc, array2D<float> &greenloc, array2D<float> &blueloc, int bfw, int bfh, double &avg_rm, double &avg_gm, double &avg_bm, double &tempitc, double &greenitc, float &studgood, bool &twotimes, const WBParams & wbpar, int begx, int begy, int yEn, int xEn, int cx, int cy, const ColorManagementParams &cmp, const RAWParams &raw) = 0;
|
||||
|
@ -222,7 +222,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange)
|
||||
int readyphase = 0;
|
||||
|
||||
bool highDetailNeeded = options.prevdemo == PD_Sidecar ? true : (todo & M_HIGHQUAL);
|
||||
printf("metwb=%s \n", params->wb.method.c_str());
|
||||
// printf("metwb=%s \n", params->wb.method.c_str());
|
||||
|
||||
// Check if any detail crops need high detail. If not, take a fast path short cut
|
||||
if (!highDetailNeeded) {
|
||||
@ -244,7 +244,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange)
|
||||
RAWParams rp = params->raw;
|
||||
ColorManagementParams cmp = params->icm;
|
||||
LCurveParams lcur = params->labCurve;
|
||||
printf("metwb2=%s \n", params->wb.method.c_str());
|
||||
printf("metwb2=%s \n", params->wb.method.c_str());
|
||||
|
||||
if (!highDetailNeeded) {
|
||||
// if below 100% magnification, take a fast path
|
||||
@ -349,15 +349,13 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange)
|
||||
|
||||
bool autowb0 = false;
|
||||
// autowb0 = (params->wb.method == "autold" || params->wb.method == "aut" || params->wb.method == "autosdw" || params->wb.method == "autedgsdw" || params->wb.method == "autitcgreen" || params->wb.method == "autedgrob" || params->wb.method == "autedg" || params->wb.method == "autorobust");
|
||||
autowb0 = (params->wb.method == "autold" || params->wb.method == "autitcgreen");
|
||||
autowb0 = (params->wb.method == "autold" || params->wb.method == "autitcgreen");//in some cases autowb0 does not work ....params->wb.method still at "camera" instead of auto !!!
|
||||
printf("autowb0=%s \n", params->wb.method.c_str());
|
||||
|
||||
|
||||
|
||||
// if (autowb0) {
|
||||
// printf("OK rgbloc avant\n");
|
||||
imgsrc->getrgbloc(false, false, false, 0, 0, fh, fw, 0, 0, fh, fw);
|
||||
// printf("OK rgbloc apres\n");
|
||||
// }
|
||||
|
||||
if ((todo & (M_RETINEX | M_INIT)) && params->retinex.enabled) {
|
||||
@ -378,9 +376,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange)
|
||||
|
||||
bool autowb = false;
|
||||
autowb = (params->wb.method == "autold" || params->wb.method == "aut" || params->wb.method == "autosdw" || params->wb.method == "autedgsdw" || params->wb.method == "autitcgreen" || params->wb.method == "autedgrob" || params->wb.method == "autedg" || params->wb.method == "autorobust");
|
||||
if(autowb) printf("AUTOAUTO\n");
|
||||
if(!autowb) printf("PAS--NON\n");
|
||||
printf("auto=%s \n", params->wb.method.c_str());
|
||||
printf("automethod=%s \n", params->wb.method.c_str());
|
||||
|
||||
if (todo & (M_INIT | M_LINDENOISE | M_HDR)) {
|
||||
MyMutex::MyLock initLock(minit); // Also used in crop window
|
||||
@ -399,33 +395,19 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange)
|
||||
currWB = ColorTemp();
|
||||
} else if (params->wb.method == "Camera") {
|
||||
currWB = imgsrc->getWB();
|
||||
// } else if (params->wb.method == "Auto") {
|
||||
lastAwbauto = ""; //reinitialize auto
|
||||
} else if (autowb) {
|
||||
if (lastAwbEqual != params->wb.equal || lastAwbTempBias != params->wb.tempBias || lastAwbauto != params->wb.method) {
|
||||
double rm, gm, bm;
|
||||
double tempitc = 5000.f;
|
||||
double greenitc = 1.;
|
||||
// imgsrc->getAutoWBMultipliers(rm, gm, bm);
|
||||
currWBitc = imgsrc->getWB();
|
||||
double tempref = currWBitc.getTemp() * (1. + params->wb.tempBias);
|
||||
double greenref = currWBitc.getGreen();
|
||||
printf("tempref=%f greref=%f\n", tempref, greenref);
|
||||
printf("tempref=%f greref=%f\n", tempref, greenref);
|
||||
|
||||
imgsrc->getAutoWBMultipliersloc(tempref, greenref, tempitc, greenitc, studgood, 0, 0, fh, fw, 0, 0, fh, fw, rm, gm, bm, params->wb, params->icm, params->raw);
|
||||
imgsrc->getAutoWBMultipliersitc(tempref, greenref, tempitc, greenitc, studgood, 0, 0, fh, fw, 0, 0, fh, fw, rm, gm, bm, params->wb, params->icm, params->raw);
|
||||
|
||||
/*
|
||||
if (rm != -1.) {
|
||||
autoWB.update(rm, gm, bm, params->wb.equal, params->wb.tempBias);
|
||||
lastAwbEqual = params->wb.equal;
|
||||
lastAwbTempBias = params->wb.tempBias;
|
||||
} else {
|
||||
lastAwbEqual = -1.;
|
||||
lastAwbTempBias = 0.0;
|
||||
autoWB.useDefaults(params->wb.equal);
|
||||
}
|
||||
*/
|
||||
//double rr,gg,bb;
|
||||
//autoWB.getMultipliers(rr,gg,bb);
|
||||
if (params->wb.method == "autitcgreen") {
|
||||
params->wb.temperature = tempitc;
|
||||
params->wb.green = greenitc;
|
||||
@ -441,10 +423,6 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange)
|
||||
}
|
||||
|
||||
autoWB.update(rm, gm, bm, params->wb.equal, bias);
|
||||
//double temper = autoWB.getTemp();
|
||||
//double gre = autoWB.getGreen();
|
||||
//printf("temper=%f gre=%f \n", temper, gre);
|
||||
|
||||
lastAwbEqual = params->wb.equal;
|
||||
lastAwbTempBias = params->wb.tempBias;
|
||||
lastAwbauto = params->wb.method;
|
||||
@ -1254,7 +1232,7 @@ bool ImProcCoordinator::getAutoWB(double& temp, double& green, double equal, dou
|
||||
double greenitc = 1.;
|
||||
float studgood = 1000.f;
|
||||
double tempref, greenref;
|
||||
imgsrc->getAutoWBMultipliersloc(tempref, greenref, tempitc, greenitc, studgood, 0, 0, fh, fw, 0, 0, fh, fw, rm, gm, bm, params->wb, params->icm, params->raw);
|
||||
imgsrc->getAutoWBMultipliersitc(tempref, greenref, tempitc, greenitc, studgood, 0, 0, fh, fw, 0, 0, fh, fw, rm, gm, bm, params->wb, params->icm, params->raw);
|
||||
|
||||
if (rm != -1) {
|
||||
autoWB.update(rm, gm, bm, equal, tempBias);
|
||||
|
@ -7590,7 +7590,6 @@ void RawImageSource::WBauto(double & tempref, double & greenref, array2D<float>
|
||||
}
|
||||
|
||||
|
||||
printf("ok avant itc\n");
|
||||
if (wbpar.method == "autitcgreen") {
|
||||
bool extra = false;
|
||||
|
||||
@ -7611,11 +7610,9 @@ printf("ok avant itc\n");
|
||||
tempitc = 5000.;
|
||||
// greenitc = greenref;
|
||||
itc = true;
|
||||
printf("ok avant itc 2\n");
|
||||
|
||||
if (itc) {
|
||||
ItcWB(extra, tempref, greenref, tempitc, greenitc, studgood, redloc, greenloc, blueloc, bfw, bfh, avg_rm, avg_gm, avg_bm, cmp, raw, wbpar);
|
||||
printf("ok apres itc \n");
|
||||
}
|
||||
}
|
||||
|
||||
@ -7734,7 +7731,7 @@ printf("ok apres itc \n");
|
||||
void RawImageSource::getrgbloc(bool local, bool gamma, bool cat02, int begx, int begy, int yEn, int xEn, int cx, int cy, int bf_h, int bf_w)
|
||||
{
|
||||
//used by auto WB local to calculate red, green, blue in local region
|
||||
printf("OK RGBLOC\n");
|
||||
// printf("OK RGBLOC\n");
|
||||
// int bfh = bf_h + 3, bfw = bf_w + 3;
|
||||
int bfh = H, bfw = W;
|
||||
|
||||
@ -7875,7 +7872,7 @@ void RawImageSource::getrgbloc(bool local, bool gamma, bool cat02, int begx, in
|
||||
}
|
||||
|
||||
//void RawImageSource::getAutoWBMultipliers (double &rm, double &gm, double &bm)
|
||||
void RawImageSource::getAutoWBMultipliersloc(double & tempref, double & greenref, double & tempitc, double & greenitc, float &studgood, int begx, int begy, int yEn, int xEn, int cx, int cy, int bf_h, int bf_w, double & rm, double & gm, double & bm, const WBParams & wbpar, const ColorManagementParams & cmp, const RAWParams & raw)
|
||||
void RawImageSource::getAutoWBMultipliersitc(double & tempref, double & greenref, double & tempitc, double & greenitc, float &studgood, int begx, int begy, int yEn, int xEn, int cx, int cy, int bf_h, int bf_w, double & rm, double & gm, double & bm, const WBParams & wbpar, const ColorManagementParams & cmp, const RAWParams & raw)
|
||||
{
|
||||
BENCHFUN
|
||||
constexpr double clipHigh = 64000.0;
|
||||
@ -7907,7 +7904,7 @@ void RawImageSource::getAutoWBMultipliersloc(double & tempref, double & greenref
|
||||
// int bfh = bf_h + 3, bfw = bf_w + 3;
|
||||
int bfh = H, bfw = W;
|
||||
if (wbpar.method == "autold") {
|
||||
printf("OK auto OLD\n");
|
||||
// printf("OK auto OLD\n");
|
||||
if (fuji) {
|
||||
for (int i = 32; i < H - 32; i++) {
|
||||
int fw = ri->get_FujiWidth();
|
||||
@ -8083,9 +8080,9 @@ void RawImageSource::getAutoWBMultipliersloc(double & tempref, double & greenref
|
||||
|
||||
if (wbpar.method == "aut" || wbpar.method == "autosdw" || wbpar.method == "autedgsdw" || wbpar.method == "autitcgreen" || wbpar.method == "autedgrob" || wbpar.method == "autedg" || wbpar.method == "autorobust") {
|
||||
bool twotimes = false;
|
||||
printf("OK avant auto\n");
|
||||
// printf("OK avant auto\n");
|
||||
WBauto(tempref, greenref, redloc, greenloc, blueloc, bfw, bfh, avg_rm, avg_gm, avg_bm, tempitc, greenitc, studgood, twotimes, wbpar, begx, begy, yEn, xEn, cx, cy, cmp, raw);
|
||||
printf("OK apres auto\n");
|
||||
// printf("OK apres auto\n");
|
||||
|
||||
}
|
||||
|
||||
|
@ -141,7 +141,7 @@ public:
|
||||
void cfaboxblur (RawImage *riFlatFile, float* cfablur, int boxH, int boxW);
|
||||
void scaleColors (int winx, int winy, int winw, int winh, const RAWParams &raw, array2D<float> &rawData); // raw for cblack
|
||||
void WBauto(double &tempref, double &greenref, array2D<float> &redloc, array2D<float> &greenloc, array2D<float> &blueloc, int bfw, int bfh, double &avg_rm, double &avg_gm, double &avg_bm, double &tempitc, double &greenitc, float &studgood, bool &twotimes, const WBParams & wbpar, int begx, int begy, int yEn, int xEn, int cx, int cy, const ColorManagementParams &cmp, const RAWParams &raw);
|
||||
void getAutoWBMultipliersloc(double &tempref, double &greenref, double &tempitc, double &greenitc, float &studgood, int begx, int begy, int yEn, int xEn, int cx, int cy, int bf_h, int bf_w, double &rm, double &gm, double &bm, const WBParams & wbpar, const ColorManagementParams &cmp, const RAWParams &raw);
|
||||
void getAutoWBMultipliersitc(double &tempref, double &greenref, double &tempitc, double &greenitc, float &studgood, int begx, int begy, int yEn, int xEn, int cx, int cy, int bf_h, int bf_w, double &rm, double &gm, double &bm, const WBParams & wbpar, const ColorManagementParams &cmp, const RAWParams &raw);
|
||||
void getrgbloc(bool local, bool gamma, bool cat02, int begx, int begy, int yEn, int xEn, int cx, int cy, int bf_h, int bf_w);
|
||||
|
||||
void getImage (const ColorTemp &ctemp, int tran, Imagefloat* image, const PreviewProps &pp, const procparams::ToneCurveParams &hrp, const procparams::RAWParams &raw) override;
|
||||
|
@ -318,7 +318,7 @@ void StdImageSource::WBauto(double &tempref, double &greenref, array2D<float> &r
|
||||
void StdImageSource::getrgbloc(bool local, bool gamma, bool cat02, int begx, int begy, int yEn, int xEn, int cx, int cy, int bf_h, int bf_w)
|
||||
{}
|
||||
|
||||
void StdImageSource::getAutoWBMultipliersloc(double &tempref, double &greenref, double &tempitc, double &greenitc, float &studgood, int begx, int begy, int yEn, int xEn, int cx, int cy, int bf_h, int bf_w, double &rm, double &gm, double &bm, const WBParams & wbpar, const ColorManagementParams &cmp, const RAWParams &raw)
|
||||
void StdImageSource::getAutoWBMultipliersitc(double &tempref, double &greenref, double &tempitc, double &greenitc, float &studgood, int begx, int begy, int yEn, int xEn, int cx, int cy, int bf_h, int bf_w, double &rm, double &gm, double &bm, const WBParams & wbpar, const ColorManagementParams &cmp, const RAWParams &raw)
|
||||
{
|
||||
if (redAWBMul != -1.) {
|
||||
rm = redAWBMul;
|
||||
@ -327,7 +327,7 @@ void StdImageSource::getAutoWBMultipliersloc(double &tempref, double &greenref,
|
||||
return;
|
||||
}
|
||||
|
||||
img->getAutoWBMultipliersloc(tempref, greenref, tempitc, greenitc,studgood, begx, begy, yEn, xEn, cx, cy, bf_h, bf_w, rm, gm, bm, params->wb, params->icm, params->raw);
|
||||
img->getAutoWBMultipliersitc(tempref, greenref, tempitc, greenitc,studgood, begx, begy, yEn, xEn, cx, cy, bf_h, bf_w, rm, gm, bm, params->wb, params->icm, params->raw);
|
||||
|
||||
redAWBMul = rm;
|
||||
greenAWBMul = gm;
|
||||
|
@ -52,7 +52,7 @@ public:
|
||||
void getAutoWBMultipliers (double &rm, double &gm, double &bm) override;
|
||||
ColorTemp getSpotWB (std::vector<Coord2D> &red, std::vector<Coord2D> &green, std::vector<Coord2D> &blue, int tran, double equal) override;
|
||||
void WBauto(double &tempref, double &greenref, array2D<float> &redloc, array2D<float> &greenloc, array2D<float> &blueloc, int bfw, int bfh, double &avg_rm, double &avg_gm, double &avg_bm, double &tempitc, double &greenitc, float &studgood, bool &twotimes, const WBParams & wbpar, int begx, int begy, int yEn, int xEn, int cx, int cy, const ColorManagementParams &cmp, const RAWParams &raw);
|
||||
void getAutoWBMultipliersloc(double &tempref, double &greenref, double &tempitc, double &greenitc, float &studgood, int begx, int begy, int yEn, int xEn, int cx, int cy, int bf_h, int bf_w, double &rm, double &gm, double &bm, const WBParams & wbpar, const ColorManagementParams &cmp, const RAWParams &raw);
|
||||
void getAutoWBMultipliersitc(double &tempref, double &greenref, double &tempitc, double &greenitc, float &studgood, int begx, int begy, int yEn, int xEn, int cx, int cy, int bf_h, int bf_w, double &rm, double &gm, double &bm, const WBParams & wbpar, const ColorManagementParams &cmp, const RAWParams &raw);
|
||||
|
||||
eSensorType getSensorType() const override {return ST_NONE;}
|
||||
bool isMono() const override {return false;}
|
||||
|
Loading…
x
Reference in New Issue
Block a user