__author__ = 'Shuran'
import imutils

def window_slides(image, stepSize, windowSize):
    #slide a window over the image
    for y in xrange(0,image.shape[0],stepSize):
        for x in xrange(0, image.shape[1],stepSize):
            #yield current window
            yield (x,y, image[y:y+windowSize[1], x:x+windowSize[0]])

def pyramid(image, scale=1.5, minSize=(100, 250)):
	# yield the original image
	yield image

	# keep looping over the pyramid
	while True:
		# compute the new dimensions of the image and resize it
		w = int(image.shape[1] / scale)
		image = imutils.resize(image, width=w)

		# if the resized image does not meet the supplied minimum
		# size, then stop constructing the pyramid
		if image.shape[0] < minSize[1] or image.shape[1] < minSize[0]:
			break

		# yield the next image in the pyramid
		yield image