Mercurial > hg > nsaunier > traffic-intelligence
comparison python/cvutils.py @ 864:8f28b4fcf129
minor
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Wed, 09 Nov 2016 18:00:39 -0500 |
| parents | 2faabcbde2c4 |
| children | 1fdafa9f6bf4 |
comparison
equal
deleted
inserted
replaced
| 863:a8ca72dc1564 | 864:8f28b4fcf129 |
|---|---|
| 300 else: | 300 else: |
| 301 croppedImg = None | 301 croppedImg = None |
| 302 return croppedImg, yCropMin, yCropMax, xCropMin, xCropMax | 302 return croppedImg, yCropMin, yCropMax, xCropMin, xCropMax |
| 303 | 303 |
| 304 | 304 |
| 305 def displayTrajectories(videoFilename, objects, boundingBoxes = {}, homography = None, firstFrameNum = 0, lastFrameNumArg = None, printFrames = True, rescale = 1., nFramesStep = 1, saveAllImages = False, undistort = False, intrinsicCameraMatrix = None, distortionCoefficients = None, undistortedImageMultiplication = 1., annotations = [], gtMatches = {}, toMatches = {}): | 305 def displayTrajectories(videoFilename, objects, boundingBoxes = {}, homography = None, firstFrameNum = 0, lastFrameNumArg = None, printFrames = True, rescale = 1., nFramesStep = 1, saveAllImages = False, nZerosFilenameArg = None, undistort = False, intrinsicCameraMatrix = None, distortionCoefficients = None, undistortedImageMultiplication = 1., annotations = [], gtMatches = {}, toMatches = {}): |
| 306 '''Displays the objects overlaid frame by frame over the video ''' | 306 '''Displays the objects overlaid frame by frame over the video ''' |
| 307 capture = cv2.VideoCapture(videoFilename) | 307 capture = cv2.VideoCapture(videoFilename) |
| 308 width = int(capture.get(cv2.cv.CV_CAP_PROP_FRAME_WIDTH)) | 308 width = int(capture.get(cv2.cv.CV_CAP_PROP_FRAME_WIDTH)) |
| 309 height = int(capture.get(cv2.cv.CV_CAP_PROP_FRAME_HEIGHT)) | 309 height = int(capture.get(cv2.cv.CV_CAP_PROP_FRAME_HEIGHT)) |
| 310 | 310 |
| 321 capture.set(cv2.cv.CV_CAP_PROP_POS_FRAMES, firstFrameNum) | 321 capture.set(cv2.cv.CV_CAP_PROP_POS_FRAMES, firstFrameNum) |
| 322 if lastFrameNumArg is None: | 322 if lastFrameNumArg is None: |
| 323 lastFrameNum = maxint | 323 lastFrameNum = maxint |
| 324 else: | 324 else: |
| 325 lastFrameNum = lastFrameNumArg | 325 lastFrameNum = lastFrameNumArg |
| 326 nZerosFilename = int(ceil(log10(lastFrameNum))) | 326 if nZerosFilenameArg is None: |
| 327 nZerosFilename = int(ceil(log10(lastFrameNum))) | |
| 328 else: | |
| 329 nZerosFilename = nZerosFilenameArg | |
| 327 objectToDeleteIds = [] | 330 objectToDeleteIds = [] |
| 328 while ret and not quitKey(key) and frameNum <= lastFrameNum: | 331 while ret and not quitKey(key) and frameNum <= lastFrameNum: |
| 329 ret, img = capture.read() | 332 ret, img = capture.read() |
| 330 if ret: | 333 if ret: |
| 331 if undistort: | 334 if undistort: |
