Hi,
offset
is calculated as int offset = winSize.width + 1;
in line 123 of https://github.com/Itseez/opencv/blob/master/apps/traincascade/haarfeatures.cpp file.
This offset is later used to access to image as a 1-D array as the step
variable in https://github.com/Itseez/opencv/blob/master/apps/traincascade/traincascade_features.h 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);
what is the purpose of this +1 in int offset = winSize.width + 1;
, why is it not int offset = winSize.width;
?