#include "windows.h"
#include "loadbmp.h" // from http://gpwiki.org/index.php/LoadBMPCpp
#include "fdlib.h"
void main(int argc, char *argv[])
{
int i, n, x[256], y[256], size[256], w, h, threshold;
BMPImg *bi;
unsigned char *bgrdata, *graydata;
if (argc==1)
{
printf("usage: fdtest bmpfilename [threshold]n");
exit(0);
}
bi = new BMPImg();
printf("nloading %sn", argv[1]);
bi->Load(argv[1]);
w = bi->GetWidth();
h = bi->GetHeight();
printf("image is %dx%d pixelsn", w, h);
bgrdata = bi->GetImg();
graydata = new unsigned char[w*h];
for (i=0; i<w*h; i++)
{
graydata[i] = (unsigned char) ((.11*bgrdata[3*i] + .59*bgrdata[3*i+1] + .3*bgrdata[3*i+2]));
//if (i<10) printf("%d ", graydata[i]);
}
threshold = argc>2 ? atoi(argv[2]) : 0;
printf("detecting with threshold = %dn", threshold);
fdlib_detectfaces(graydata, w, h, threshold);
n = fdlib_getndetections();
if (n==1)
printf("%d face foundn", n);
else
printf("%d faces foundn", n);
for (i=0; i<n; i++)
{
fdlib_getdetection(i, x+i, y+i, size+i);
printf("x:%d y:%d size:%dn", x[i], y[i], size[i]);
}
delete[] graydata;
delete bi;
}
I need to know what graydata would look like. I am trying to port this to python and need to know the correct way to pass a python datatype to fdlib_detectfaces()
I have no experience with C++.