Mercurial > hg > nsaunier > traffic-intelligence
comparison python/cvutils.py @ 981:c3e690c5536e
corrected bug in display trajectories
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Tue, 27 Feb 2018 15:24:57 -0500 |
| parents | 184f1dd307f9 |
| children | 132d84ce9f0c |
comparison
equal
deleted
inserted
replaced
| 980:23f98ebb113f | 981:c3e690c5536e |
|---|---|
| 26 from matplotlib.mlab import find | 26 from matplotlib.mlab import find |
| 27 from matplotlib.pyplot import imread, imsave | 27 from matplotlib.pyplot import imread, imsave |
| 28 | 28 |
| 29 videoFilenameExtensions = ['mov', 'avi', 'mp4', 'MOV', 'AVI', 'MP4'] | 29 videoFilenameExtensions = ['mov', 'avi', 'mp4', 'MOV', 'AVI', 'MP4'] |
| 30 | 30 |
| 31 #import aggdraw # agg on top of PIL (antialiased drawing) | 31 #importaggdraw # agg on top of PIL (antialiased drawing) |
| 32 | 32 |
| 33 | 33 |
| 34 cvRed = {'default': (0,0,255), | 34 cvRed = {'default': (0,0,255), |
| 35 'colorblind': (0,114,178)} | 35 'colorblind': (0,114,178)} |
| 36 cvGreen = {'default': (0,255,0), | 36 cvGreen = {'default': (0,255,0), |
| 316 capture.set(cv2.cv.CV_CAP_PROP_POS_FRAMES, firstFrameNum) | 316 capture.set(cv2.cv.CV_CAP_PROP_POS_FRAMES, firstFrameNum) |
| 317 if lastFrameNumArg is None: | 317 if lastFrameNumArg is None: |
| 318 lastFrameNum = float("inf") | 318 lastFrameNum = float("inf") |
| 319 else: | 319 else: |
| 320 lastFrameNum = lastFrameNumArg | 320 lastFrameNum = lastFrameNumArg |
| 321 if nZerosFilenameArg is None: | 321 if saveAllImages: |
| 322 nZerosFilename = int(ceil(log10(lastFrameNum))) | 322 if nZerosFilenameArg is None: |
| 323 else: | 323 if lastFrameNumArg is None: |
| 324 nZerosFilename = nZerosFilenameArg | 324 nZerosFilename = int(ceil(log10(objects[-1].getLastInstant()))) |
| 325 else: | |
| 326 nZerosFilename = int(ceil(log10(lastFrameNum))) | |
| 327 else: | |
| 328 nZerosFilename = nZerosFilenameArg | |
| 325 while ret and not quitKey(key) and frameNum <= lastFrameNum: | 329 while ret and not quitKey(key) and frameNum <= lastFrameNum: |
| 326 ret, img = capture.read() | 330 ret, img = capture.read() |
| 327 if ret: | 331 if ret: |
| 328 if undistort: | 332 if undistort: |
| 329 img = cv2.remap(img, map1, map2, interpolation=cv2.INTER_LINEAR) | 333 img = cv2.remap(img, map1, map2, interpolation=cv2.INTER_LINEAR) |
