Ask Your Question

fatih's profile - activity

2015-03-23 14:31:45 -0600 received badge  Student (source)
2015-03-21 04:29:24 -0600 received badge  Enthusiast
2015-03-18 10:17:47 -0600 received badge  Scholar (source)
2015-03-18 08:34:10 -0600 received badge  Editor (source)
2015-03-18 05:28:07 -0600 asked a question Offset calculation for a Mat object (traincascade)

Hi,

offset is calculated as int offset = winSize.width + 1;in line 123 of https://github.com/Itseez/opencv/blob... file.

This offset is renamed as step and then step is used to calculate some p values in https://github.com/Itseez/opencv/blob... file by multiplying with combinations of some parameters of the rect rectangle in CV_SUM_OFFSETS definition:

#define CV_SUM_OFFSETS( p0, p1, p2, p3, rect, step )                  \
/* (x, y) */                                                          \
(p0) = (rect).x + (step) * (rect).y;                                  \
/* (x + w, y) */                                                      \
(p1) = (rect).x + (rect).width + (step) * (rect).y;                   \
/* (x + w, y) */                                                      \
(p2) = (rect).x + (step) * ((rect).y + (rect).height);                \
/* (x + w, y + h) */                                                  \
(p3) = (rect).x + (rect).width + (step) * ((rect).y + (rect).height);

These p values are later used in line 79 of https://github.com/Itseez/opencv/blob... file, to access locations in integral sum images (tilted or untilted one), like:

inline float CvHaarEvaluator::Feature::calc( const cv::Mat &_sum, const cv::Mat &_tilted, size_t y) const
{
    const int* img = tilted ? _tilted.ptr<int>((int)y) : _sum.ptr<int>((int)y);
    float ret = rect[0].weight * (img[fastRect[0].p0] - img[fastRect[0].p1] - img[fastRect[0].p2] + img[fastRect[0].p3] ) +
        rect[1].weight * (img[fastRect[1].p0] - img[fastRect[1].p1] - img[fastRect[1].p2] + img[fastRect[1].p3] );
    if( rect[2].weight != 0.0f )
        ret += rect[2].weight * (img[fastRect[2].p0] - img[fastRect[2].p1] - img[fastRect[2].p2] + img[fastRect[2].p3] );
    return ret;
}

what is the purpose of this +1 in int offset = winSize.width + 1;, why is it not int offset = winSize.width;? By adding this one I suspect that we are calculating incorrect p values. An explanation on these p values is available at http://docs.opencv.org/modules/imgpro...

2015-03-16 10:47:36 -0600 commented answer What are the literature papers on which traincascade is based?

Currently, I do not have any idea about the similarity of the methods in paper 2 and 3 between each other and to the implementation in opencv. I just wanted to share.

2015-03-16 10:45:24 -0600 received badge  Supporter (source)
2015-03-16 10:45:21 -0600 commented answer What are the literature papers on which traincascade is based?

Thank you very much.

For HOG implementation, I found the following papers with similar approaches: 1. "Porikli F., Integral Histogram: A Fast Way to Extract Histograms in Cartesian Spaces" -> Describes the method to compute histograms (not histograms of gradients) of all possible target regions in an image. 2. "Said et.al., Human Detection Based on Integral Histograms of Oriented Gradients and SVM" -> Extends the method in 1 for computing integral histograms of oriented gradients to be used with SVM. 3. "Zhu et.al, Fast Human Detection Using a Cascade of Histograms of Oriented Gradients" -> Another study, extending 1 for again computing integral histograms of oriented gradients, to be used with AdaBoost.

2015-03-16 06:10:34 -0600 asked a question What are the literature papers on which traincascade is based?

Hi,

I am working on cascade classifiers and trying to understand the details of the implementations in "apps/traincascade" folder of the source code. In http://docs.opencv.org/doc/user_guide..., three papers are mentioned about Haar like features and LBP.

I found "Zhu et.al., Fast Human Detection Using a Cascade of Histograms of Oriented Gradients, 2006" paper seems to be related with HOG implementation. Is this paper correct? Do you suggest any other papers (can also be related with boosting)?