Hi
in some code that I am maintaining, we call cv::HOGDescriptor::compute. After ROS opencv package upgraded to 2.4.9 from 2.4.6 it started to crash. Nothing else has changed in my code. I am not familiar at all with HOG descriptors, so I'm not sure how to go about this, so I'm hoping somebody can tell me what has changed lately in this function.
here is the error that I get: opencv2/core/core.hpp:345: size_t cv::alignSize(size_t, int): Assertion `(n & (n - 1)) == 0' failed. (this is checking that n is power of 2)
and here is some of my code (hopefully enough of it to give you a sense of what's going on):
hog_ = new cv::HOGDescriptor(win_size_, block_size_, block_stride_,
cell_size_, num_bins_,
1, -1, 0, 0.2, false);
// -- Get list of Points to do computation at from u and v offset percents.
coords_ = vector<cv::Point>(u_offset_pcts_.size());
for(size_t i = 0; i < u_offset_pcts_.size(); i++) {
int u = u_offset_pcts_[i] * img.cols;
int v = v_offset_pcts_[i] * img.rows;
//Subtracting off half winSize since the feature is computed in a window where location[i] is
//the upper left corner. points[i] is the center of the window.
coords_[i] = cv::Point(u - hog_->winSize.width / 2, v - hog_->winSize.height / 2);
}
// -- Shift any points so that they don't make the window fall off the edge of the image.
for(size_t i = 0; i < coords_.size(); i++) {
if(coords_[i].x + hog_->winSize.width >= img.cols)
coords_[i].x = img.cols - hog_->winSize.width;
else if(coords_[i].x < 0)
coords_[i].x = 0;
if(coords_[i].y + hog_->winSize.height >= img.rows)
coords_[i].y = img.rows - hog_->winSize.height;
else if(coords_[i].y < 0)
coords_[i].y = 0;
}
cv_result_.clear();
hog_->compute(img, cv_result_, cv::Size(), cv::Size(), coords_);