38 fstream objs(defFileName, ios::in);
40 while (!objs.fail() && !objs.eof()) {
45 objs >> type >> fname >> threshold;
47 if (objs.fail() || objs.eof())
break;
51 cout << type.c_str() <<
" "
52 << fname.c_str() <<
" "
56 matchers.push_back(
new MatchImage(type.c_str(),
57 fname.c_str(), threshold));
66 IplImage *pImage = cvLoadImage(fileName, CV_LOAD_IMAGE_UNCHANGED);
67 if(pImage!=
nullptr && pImage->depth==IPL_DEPTH_8U) {
69 for(
size_t u=0;u<4;++u) {
70 cout << pImage->channelSeq[u];
74 cout <<
"size= " << pImage->width <<
"x" << pImage->height
75 <<
" (" << pImage->width*pImage->height <<
")"
79 std::vector<Var<float>> m(pImage->nChannels);
81 const unsigned char* p =
reinterpret_cast<unsigned char*
>(pImage->imageData);
83 for(
int y=0; y<pImage->height; ++y) {
84 const unsigned char* row = p + y*pImage->widthStep;
85 for(
int x=0; x<pImage->width; ++x) {
86 if(row[pImage->alphaChannel-1] < 100) {
87 row += pImage->nChannels;
89 for(
int c=0;c<pImage->nChannels;++c) {
97 for(
const auto &x : m) {
98 if(x.get_num_cases() > 1) {
99 cout <<
"M=" << x.get_mean()
100 <<
" SD=" << sqrt(x.get_var())
101 <<
" N=" << x.get_num_cases() << endl;
105 cvReleaseImage(&pImage);
107 means.resize(m.size());
110 for(
size_t u=0;u<m.size();++u) {
111 means[u] = m[u].get_mean();
112 sd[u] = sqrt(m[u].get_var());