Mercurial > hg > nsaunier > traffic-intelligence
comparison scripts/display-synced-trajectories.py @ 839:2c7b4e6a32dd
steps working now
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Wed, 06 Jul 2016 18:05:03 -0400 |
| parents | 2918de3d40fc |
| children | 75530d8c0090 |
comparison
equal
deleted
inserted
replaced
| 838:2918de3d40fc | 839:2c7b4e6a32dd |
|---|---|
| 64 cv2.namedWindow(windowName, cv2.WINDOW_NORMAL) | 64 cv2.namedWindow(windowName, cv2.WINDOW_NORMAL) |
| 65 #if frameRate > 0: | 65 #if frameRate > 0: |
| 66 # wait = int(round(1000./frameRate)) | 66 # wait = int(round(1000./frameRate)) |
| 67 #if interactive: | 67 #if interactive: |
| 68 wait = 0 | 68 wait = 0 |
| 69 step = 1 | |
| 70 rescale = 1. | 69 rescale = 1. |
| 71 captures = [cv2.VideoCapture(fn) for fn in filenames] | 70 captures = [cv2.VideoCapture(fn) for fn in filenames] |
| 72 if np.array([cap.isOpened() for cap in captures]).all(): | 71 if np.array([cap.isOpened() for cap in captures]).all(): |
| 73 key = -1 | 72 key = -1 |
| 74 ret = True | 73 ret = True |
| 108 # cv2.putText(images[i], text, (10,50), cv2.FONT_HERSHEY_PLAIN, 1, cvRed) | 107 # cv2.putText(images[i], text, (10,50), cv2.FONT_HERSHEY_PLAIN, 1, cvRed) |
| 109 cvutils.cvImshow(windowNames[i], images[i], rescale) # cv2.imshow('frame', img) | 108 cvutils.cvImshow(windowNames[i], images[i], rescale) # cv2.imshow('frame', img) |
| 110 key = cv2.waitKey(wait) | 109 key = cv2.waitKey(wait) |
| 111 #if cvutils.saveKey(key): | 110 #if cvutils.saveKey(key): |
| 112 # cv2.imwrite('image-{}.png'.format(frameNum), img) | 111 # cv2.imwrite('image-{}.png'.format(frameNum), img) |
| 113 nFramesShown += step | 112 nFramesShown += args.step |
| 114 if step > 1: | 113 if args.step > 1: |
| 115 for i in xrange(len(captures)): | 114 for i in xrange(len(captures)): |
| 116 captures.set(cv2.cv.CV_CAP_PROP_POS_FRAMES, firstFrameNums[i]+nFramesShown) | 115 if firstFrameNums[i]+nFramesShown >= 0: |
| 116 captures[i].set(cv2.cv.CV_CAP_PROP_POS_FRAMES, firstFrameNums[i]+nFramesShown) | |
| 117 cv2.destroyAllWindows() | 117 cv2.destroyAllWindows() |
| 118 else: | 118 else: |
| 119 print('Video captures for {} failed'.format(filenames)) | 119 print('Video captures for {} failed'.format(filenames)) |
