WeakClassifier findWeakClassifier(int[] f, List<int> fxIdx)
{
double e1 = 0.0;
double e2 = 0.0;
double min1;
double min2;
int min1Idx = 0;
int min2Idx = 0;
int i, j;
WeakClassifier cls = new WeakClassifier();
double Tp = 0, Tn = 0, Sp = 0, Sn = 0;
for (i = 0; i < pos_count; i++)
Tp += w[i];
for (i = pos_count; i < img_count; i++)
Tn += w[i];
e2 = 1 - e1;
min1 = e1;
min2 = e2;
for (i = 0; i < img_count; i++)
{
if (labels[i] == 1)
Sp += w[i] * fxIdx[i];
else
Sn += w[i] * fxIdx[i];
e1 = (Sp + (Tn - Sn));
e2 = (Sn + (Tp - Sp));
if (e1 < min1)
{
min1 = e1;
min1Idx = i;
}
if (e2 < min2)
{
min2 = e2;
min2Idx = i;
}
}
if (min1 < min2)
{
cls.parity = 1;
cls.theta = ApplyFeature(f, images[min1Idx]);
cls.error = min1;
if (min1 != 0.0)
cls.alpha = Math.Log(Math.Abs((1 - min1) / min1));
}
else
{
cls.parity = -1;
cls.theta = ApplyFeature(f, images[min2Idx]);
cls.error = min2;
if (min2 != 0.0)
cls.alpha = Math.Log(Math.Abs((1 - min2) / min2));
}
cls.feature = f;
return cls;
}
Also somewhere else in code we have :
beta = (double)min_error / (1 - min_error);
if (beta != 0.0)
alfa[t] = Math.Log(Math.Abs(1 / beta));
Which usually cause alfa goes infinity , so I added the IF to prevent.
And what is input to Adaboost for detection , I mean should I
calculate gray scale values ( R+G+B / 3) and then Integral Image or
something else.
I really need your help ....
Conversion of a color image to grayscale is not unique; different weighting of the color channels effectively represent the effect of shooting black-and-white film with different-colored photographic filters on the cameras. A common strategy is to match the luminance of the grayscale image to the luminance of the color image.
To convert any color to a grayscale representation of its luminance, first one must obtain the values of its red, green, and blue (RGB) primaries in linear intensity encoding, by gamma expansion. Then, add together 30% of the red value, 59% of the green value, and 11% of the blue value (these weights depend on the exact choice of the RGB primaries, but are typical). The formula (11*R + 16*G + 5*B) /32 is also popular since it can be efficiently implemented using only integer operations. Regardless of the scale employed (0.0 to 1.0, 0 to 255, 0% to 100%, etc.), the resultant number is the desired linear luminance value; it typically needs to be gamma compressed to get back to a conventional grayscale representation.
This is not the method used to obtain the luma in the Y'UV and related color models, used in standard color TV and video systems as PAL and NTSC, as well as in the L*a*b color model. These systems directly compute a gamma-compressed luma as a linear combination of gamma-compressed primary intensities, rather than use linearization via gamma expansion and compression.
To convert a gray intensity value to RGB, simply set all the three primary color components red, green and blue to the gray value, correcting to a different gamma if necessary.
http://en.wikipedia.org/wiki/Grayscale
--
You received this message because you are subscribed to the Google Groups "Face Recognition Research Community" group.
To post to this group, send email to face...@googlegroups.com.
To unsubscribe from this group, send email to face-rec+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/face-rec?hl=en.