Mercurial Hosting > traffic-intelligence
comparison python/cvutils.py @ 346:5f75d6c23ed5
added opencv function to destroy OpenCV windows (seems to work only on Windows)
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Wed, 26 Jun 2013 15:42:45 -0400 |
parents | 6b65b26c1e46 |
children | 22ddb8f85495 |
comparison
equal
deleted
inserted
replaced
345:fa64b2e3a64f | 346:5f75d6c23ed5 |
---|---|
107 if ret: | 107 if ret: |
108 print('frame {0}'.format(frameNum)) | 108 print('frame {0}'.format(frameNum)) |
109 frameNum+=1 | 109 frameNum+=1 |
110 cv2.imshow('frame', img) | 110 cv2.imshow('frame', img) |
111 key = cv2.waitKey(wait) | 111 key = cv2.waitKey(wait) |
112 cv2.destroyAllWindows() | |
112 | 113 |
113 def getImagesFromVideo(filename, nImages = 1, saveImage = False): | 114 def getImagesFromVideo(filename, nImages = 1, saveImage = False): |
114 '''Returns nImages images from the video sequence''' | 115 '''Returns nImages images from the video sequence''' |
115 images = [] | 116 images = [] |
116 capture = cv2.VideoCapture(filename) | 117 capture = cv2.VideoCapture(filename) |
160 cv2.imshow('frame', img) | 161 cv2.imshow('frame', img) |
161 key = cv2.waitKey() | 162 key = cv2.waitKey() |
162 if saveKey(key): | 163 if saveKey(key): |
163 cv2.imwrite('image.png', img) | 164 cv2.imwrite('image.png', img) |
164 frameNum += 1 | 165 frameNum += 1 |
166 cv2.destroyAllWindows() | |
165 | 167 |
166 def printCvMat(cvmat, out = stdout): | 168 def printCvMat(cvmat, out = stdout): |
167 '''Prints the cvmat to out''' | 169 '''Prints the cvmat to out''' |
168 for i in xrange(cvmat.rows): | 170 for i in xrange(cvmat.rows): |
169 for j in xrange(cvmat.cols): | 171 for j in xrange(cvmat.cols): |