Commit 883d691c authored by marina.kolpakova's avatar marina.kolpakova

fix feature computing

parent 30b2a945
add_subdirectory(haartraining)
add_subdirectory(traincascade)
add_subdirectory(sft)
......@@ -73,6 +73,22 @@ struct ICF
return bb != b.bb || channel != b.channel;
}
float operator() (const Mat& integrals, const cv::Size& model) const
{
const int* ptr = integrals.ptr<int>(0) + (model.height * channel + bb.y) * model.width + bb.x;
int a = ptr[0];
int b = ptr[bb.width];
ptr += bb.height * model.width;
int c = ptr[bb.width];
int d = ptr[0];
return (float)(a - b + c - d);
}
private:
cv::Rect bb;
int channel;
......
......@@ -93,6 +93,10 @@ bool sft::Octave::train( const cv::Mat& trainData, const cv::Mat& _responses, co
}
std::cout << "WARNING: " << sampleIdx << std::endl;
std::cout << "WARNING: " << trainData << std::endl;
std::cout << "WARNING: " << _responses << std::endl;
std::cout << "WARNING: " << varIdx << std::endl;
std::cout << "WARNING: " << varType << std::endl;
bool update = false;
return cv::Boost::train(trainData, CV_COL_SAMPLE, _responses, varIdx, sampleIdx, varType, missingDataMask, _params,
......@@ -313,7 +317,7 @@ sft::FeaturePool::~FeaturePool(){}
float sft::FeaturePool::apply(int fi, int si, const Mat& integrals) const
{
return 0.f;
return pool[fi](integrals.row(si), model);
}
......
......@@ -113,7 +113,7 @@ int main(int argc, char** argv)
int shrinkage = cfg.shrinkage;
int octave = *it;
cv::Size model = cfg.modelWinSize;
cv::Size model = cv::Size(cfg.modelWinSize.width / cfg.shrinkage, cfg.modelWinSize.height / cfg.shrinkage );
std::string path = cfg.trainPath;
cv::Rect boundingBox(cfg.offset.x / cfg.shrinkage, cfg.offset.y / cfg.shrinkage,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment