Search code examples
opencvhistogramsvmlibsvm

opencv sliding window


Is there any built in library for sliding a window (custom size) over an image in opencv version 2.x? I tried to write the algorithm by myself but I found it very painful and probably error-prone. I need to slide over an image and create histogram for the input of svm. there is one for HOG Descriptor, which calculates HOG features but I have my own feature set so I just need an algorithm to let me slide over an image.


Solution

  • You can define a Region of Interest (ROI) on a cv::Mat object, which gives you a new Mat object referring to the sub-window. This does not copy the underlying data, merely a new header with the appropriate metadata.

    See also this other question: