I'm trying to split an image into several sub-images with opencv by identifying templates of the original image and then copy the regions where I matched those templates. I'm a TOTAL newbie to opencv! I've identified the sub-images using: result = cv2.matchTemplate(img, template, cv2.TM_CCORR_NORMED) After some cleanup I get a list of tuples called points in which I iterate to show the rectangles. tw and th is the template width and height respectively. for pt in points: re = cv2.rectangle(img, pt, (pt[0] + tw, pt[1] + th), 0, 2) print('%s, %s' % (str(pt[0]), str(pt[1]))) count+=1 What I would like to accomplish is to save the octagons (https://dl.dropbox.com/u/239592/region01.png) into separated files. How can I do this? I've read something about contours but I'm not sure how to use it. Ideally I would like to contour the octagon. Thanks a lot for your help! Continue reading...