Commit 81d44b7e authored by Vlad Shakhuro's avatar Vlad Shakhuro

Fix warnings

parent d06d7e29
......@@ -107,8 +107,8 @@ void WBDetector::train(
int n_features;
Mat pos_data, neg_data;
Ptr<CvFeatureEvaluator> eval = CvFeatureEvaluator::create(CvFeatureParams::LBP);
eval->init(CvFeatureParams::create(CvFeatureParams::LBP), 1, Size(24, 24));
Ptr<CvFeatureEvaluator> eval = CvFeatureEvaluator::create();
eval->init(CvFeatureParams::create(), 1, Size(24, 24));
n_features = eval->getNumFeatures();
const int stages[] = {32, 64, 128, 256, 512, 1024, 2048, 4096};
......@@ -135,14 +135,14 @@ void WBDetector::train(
for (size_t k = 0; k < pos_imgs.size(); ++k) {
eval->setImage(pos_imgs[k], +1, 0, boost.get_feature_indices());
for (int j = 0; j < n_features; ++j) {
pos_data.at<uchar>(j, k) = (*eval)(j, 0);
pos_data.at<uchar>(j, k) = (*eval)(j);
}
}
for (size_t k = 0; k < neg_imgs.size(); ++k) {
eval->setImage(neg_imgs[k], 0, 0, boost.get_feature_indices());
for (int j = 0; j < n_features; ++j) {
neg_data.at<uchar>(j, k) = (*eval)(j, 0);
neg_data.at<uchar>(j, k) = (*eval)(j);
}
}
......@@ -204,8 +204,8 @@ void WBDetector::detect(
for (float scale = 0.2f; scale < 1.2f; scale *= 1.1) {
scales.push_back(scale);
}
Ptr<CvFeatureParams> params = CvFeatureParams::create(CvFeatureParams::LBP);
Ptr<CvFeatureEvaluator> eval = CvFeatureEvaluator::create(CvFeatureParams::LBP);
Ptr<CvFeatureParams> params = CvFeatureParams::create();
Ptr<CvFeatureEvaluator> eval = CvFeatureEvaluator::create();
eval->init(params, 1, Size(24, 24));
boost.detect(eval, img, scales, bboxes, confidences);
assert(confidences.size() == bboxes.size());
......
......@@ -96,7 +96,7 @@ bool CvFeatureParams::read( const FileNode &node )
return ( maxCatCount >= 0 && featSize >= 1 );
}
Ptr<CvFeatureParams> CvFeatureParams::create( int featureType )
Ptr<CvFeatureParams> CvFeatureParams::create()
{
return Ptr<CvFeatureParams>(new CvLBPFeatureParams);
}
......@@ -114,7 +114,7 @@ void CvFeatureEvaluator::init(const CvFeatureParams *_featureParams,
generateFeatures();
}
void CvFeatureEvaluator::setImage(const Mat &img, uchar clsLabel, int idx, const std::vector<int>& feature_ind)
void CvFeatureEvaluator::setImage(const Mat &, uchar clsLabel, int idx, const std::vector<int>& feature_ind)
{
//CV_Assert(img.cols == winSize.width);
//CV_Assert(img.rows == winSize.height);
......@@ -122,7 +122,7 @@ void CvFeatureEvaluator::setImage(const Mat &img, uchar clsLabel, int idx, const
cls.ptr<float>(idx)[0] = clsLabel;
}
Ptr<CvFeatureEvaluator> CvFeatureEvaluator::create(int type)
Ptr<CvFeatureEvaluator> CvFeatureEvaluator::create()
{
return Ptr<CvFeatureEvaluator>(new CvLBPEvaluator);
}
......@@ -64,8 +64,8 @@ public:
virtual void setImage(const cv::Mat& img, uchar clsLabel, int idx, const std::vector<int> &feature_ind);
virtual void setWindow(const cv::Point& p)
{ cur_sum = sum.rowRange(p.y, p.y + winSize.height).colRange(p.x, p.x + winSize.width); }
virtual float operator()(int featureIdx, int sampleIdx)
{ return (float)features[featureIdx].calc( cur_sum, offset_, sampleIdx); }
virtual float operator()(int featureIdx)
{ return (float)features[featureIdx].calc( cur_sum ); }
virtual void writeFeatures( cv::FileStorage &fs, const cv::Mat& featureMap ) const;
protected:
virtual void generateFeatures();
......@@ -75,7 +75,7 @@ protected:
public:
Feature();
Feature( int offset, int x, int y, int _block_w, int _block_h );
uchar calc( const cv::Mat& _sum, int offset, size_t y );
uchar calc( const cv::Mat& _sum );
void write( cv::FileStorage &fs ) const;
cv::Rect rect;
......@@ -90,7 +90,7 @@ protected:
int offset_;
};
inline uchar CvLBPEvaluator::Feature::calc(const cv::Mat &_sum, int offset, size_t y)
inline uchar CvLBPEvaluator::Feature::calc(const cv::Mat &_sum)
{
const int* psum = _sum.ptr<int>();
......
......@@ -110,7 +110,7 @@ public:
virtual void init( const CvFeatureParams& fp );
virtual void write( cv::FileStorage &fs ) const;
virtual bool read( const cv::FileNode &node );
static cv::Ptr<CvFeatureParams> create( int featureType );
static cv::Ptr<CvFeatureParams> create();
int maxCatCount; // 0 in case of numerical features
int featSize; // 1 in case of simple features (HAAR, LBP) and N_BINS(9)*N_CELLS(4) in case of Dalal's HOG features
};
......@@ -124,8 +124,8 @@ public:
virtual void setImage(const cv::Mat& img, uchar clsLabel, int idx, const std::vector<int> &feature_ind);
virtual void setWindow(const cv::Point& p) = 0;
virtual void writeFeatures( cv::FileStorage &fs, const cv::Mat& featureMap ) const = 0;
virtual float operator()(int featureIdx, int sampleIdx) = 0;
static cv::Ptr<CvFeatureEvaluator> create(int type);
virtual float operator()(int featureIdx) = 0;
static cv::Ptr<CvFeatureEvaluator> create();
int getNumFeatures() const { return numFeatures; }
int getMaxCatCount() const { return featureParams->maxCatCount; }
......
......@@ -317,7 +317,7 @@ int WaldBoost::predict(Ptr<CvFeatureEvaluator> eval, float *h) const
assert(feature_indices_.size() == size_t(weak_count_));
float res = 0;
for (int i = 0; i < weak_count_; ++i) {
float val = (*eval)(feature_indices_[i], 0);
float val = (*eval)(feature_indices_[i]);
int label = polarities_[i] * (val - thresholds_[i]) > 0 ? +1: -1;
res += alphas_[i] * label;
if (res < THR) {
......
......@@ -30,4 +30,3 @@ int main(int argc, char **argv)
imwrite(argv[4], img);
}
}
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