Overlapping Sliding Windows Over Image
My objective is to have a sliding window slide over an image in overlapping steps so that I can run a classifier in each window and detect if an interesting object is there. For th
Solution 1:
Alright so I figured out what the issue was.
This code didn't cause overlaps:
grid_h_max =(imgheight/winh)
grid_w_max= (imgwidth / winw)
win = sliding_window(img, window_size, shiftSize=None, flatten=False)
Dividing the entire image dimensions with those of the window dimensions are obviously going to give non-overlapping results.
To get the right number of windows per dimension, I simply allow the sliding_window function to tell me itself what the number of windows is, vertically and horizontally:
win = sliding_window(img, window_size, shiftSize=None, flatten=False)
grid_h_max = win.shape[0]
grid_w_max = win.shape[1]
This gave me approximately 5000 windows again.
Post a Comment for "Overlapping Sliding Windows Over Image"