mirror of
https://github.com/opencv/opencv.git
synced 2026-12-02 21:22:43 -06:00
When HOGDescriptor::compute() is called without explicit locations on an image whose padded dimensions are smaller than winSize, HOGCache::windowsInImage() computes a negative window count along the undersized axis: If one dimension is smaller than winSize (for example, 16 x 193 with default 64 x 128 winSize), windowsInImage().area() is negative and wraps to a huge size_t in nwindows, causing descriptors.resize(dsize * nwindows) to throw std::length_error (vector<T> too long). If both dimensions are smaller than winSize, windowsInImage().area() becomes positive ((-w) * (-h)). If a dimension is 1 to winStride - 1 pixels smaller than winSize, truncating integer division yields (size - winSize) / winStride + 1 == 1 instead of 0.