Fixes for auto-exposure, restoring histogram to curves, and labelling of colors in HSV equalizer.

This commit is contained in:
Emil Martinec
2010-11-13 15:41:08 -06:00
parent d0717b8b85
commit d6b59d7215
8 changed files with 34 additions and 23 deletions

View File

@@ -634,8 +634,8 @@ TP_HLREC_LABEL;Highlight Reconstruction
TP_HLREC_LUMINANCE;Luminance Recovery
TP_HLREC_METHOD;Method:
TP_HSVEQUALIZER1;Red
TP_HSVEQUALIZER2;Orange
TP_HSVEQUALIZER3;Yellow
TP_HSVEQUALIZER2;Yellow
TP_HSVEQUALIZER3;Lime
TP_HSVEQUALIZER4;Green
TP_HSVEQUALIZER5;Aqua
TP_HSVEQUALIZER6;Blue

View File

@@ -4,7 +4,7 @@ Version=20101111
[Exposure]
Auto=true
Clip=0.01
Clip=0.0001
Compensation=0
Brightness=0
Contrast=12

View File

@@ -4,7 +4,7 @@ Version=20101111
[Exposure]
Auto=true
Clip=0.01
Clip=0.0001
Compensation=0
Brightness=0
Contrast=0

View File

@@ -1,10 +1,9 @@
[Version]
Version=20101111
[Exposure]
Auto=false
Clip=0.001
Clip=0.0001
Compensation=0
Brightness=0
Contrast=0

View File

@@ -734,8 +734,7 @@ void CurveFactory::complexCurve (double ecomp, double black, double hlcompr, dou
// apply custom/parametric/NURBS curve, if any
if (tcurve) {
if (outBeforeCCurveHistogram) {
cum *= (float)val/val0;
float hval = brightcurve->getVal (cum);
float hval = shCurve[(int)(hlCurve[i])]*(float)val/(65535*val0);
//if (needigamma)
// hval = igamma2 (hval);
int hi = (int)(255.0*CLIPD(hval));

View File

@@ -389,6 +389,15 @@ void ImProcCoordinator::updateHistograms (int x1, int y1, int x2, int y2) {
for (int i=y1; i<y2; i++)
for (int j=x1; j<x2; j++)
Lhist[nprevl->L[i][j]/256]++;
/*for (int i=0; i<256; i++) {
Lhist[i] = (int)(256*sqrt(Lhist[i]));
rhist[i] = (int)(256*sqrt(rhist[i]));
ghist[i] = (int)(256*sqrt(ghist[i]));
bhist[i] = (int)(256*sqrt(bhist[i]));
bcrgbhist[i] = (int)(256*sqrt(bcrgbhist[i]));
bcLhist[i] = (int)(256*sqrt(bcLhist[i]));
}*/
}
void ImProcCoordinator::progress (Glib::ustring str, int pr) {

View File

@@ -615,7 +615,7 @@ void ImProcFunctions::getAutoExp (unsigned int* histogram, int histcompr, doubl
double corr = pow(2.0, expcomp);
// black point selection is based on the linear result (yielding better visual results)
bl = (int)(shc /* * corr*/);
bl = (int)(shc * corr);
// compute the white point of the exp. compensated gamma corrected image
double awg = (int)(CurveFactory::gamma2 (aw * corr / 65536.0) * 65536.0);
@@ -624,17 +624,17 @@ void ImProcFunctions::getAutoExp (unsigned int* histogram, int histcompr, doubl
for (int i=0; i<65536>>histcompr; i++)
gavg += histogram[i] * CurveFactory::gamma2((int)(corr*(i<<histcompr)<65535 ? corr*(i<<histcompr) : 65535)) / sum;
if (bl < gavg) {
int maxaw = (gavg - bl) * 4 / 3 + bl; // dont let aw be such large that the histogram average goes above 3/4
double mavg = 65536.0 / (awg-bl) * (gavg - bl);
//double mavg = 65536.0 / (awg-bl) * (gavg - bl);
if (awg < maxaw)
awg = maxaw;
}
awg = CurveFactory::igamma2 ((float)(awg/65535.0)) * 65535.0; //need to inverse gamma transform to get correct exposure compensation parameter
br = log(65535.0 / (awg-bl)) / log(2.0);
bl = (int)((65535*bl)/awg);
br = log(65535.0 / (awg)) / log(2.0);
if (br<0)
br = 0;
}

View File

@@ -2014,17 +2014,21 @@ int RawImageSource::getAEHistogram (unsigned int* histogram, int& histcompr) {
end = ri->width-border;
}
if (ri->filters)
for (int j=start; j<end; j++)
/*if (ISGREEN(ri,i,j))
histogram[rawData[i][j]>>histcompr]+=2;
else*/
histogram[rawData[i][j]>>histcompr]+=4;
else
for (int j=start; j<3*end; j++) {
histogram[rawData[i][j+0]>>histcompr]++;
histogram[rawData[i][j+1]>>histcompr]+=2;
histogram[rawData[i][j+2]>>histcompr]++;
}
for (int j=start; j<end; j++) {
if (ISGREEN(ri,i,j))
histogram[CLIP((int)(camwb_green*rawData[i][j]))>>histcompr]+=4;
else if (ISRED(ri,i,j))
histogram[CLIP((int)(camwb_red*rawData[i][j]))>>histcompr]+=4;
else if (ISBLUE(ri,i,j))
histogram[CLIP((int)(camwb_blue*rawData[i][j]))>>histcompr]+=4;
} else {
for (int j=start; j<3*end; j++) {
histogram[CLIP((int)(rawData[i][j+0]>>histcompr))]++;
histogram[CLIP((int)(rawData[i][j+1]>>histcompr))]+=2;
histogram[CLIP((int)(rawData[i][j+2]>>histcompr))]++;
}
}
}
return 1;
}