Mercurial > hg > nsaunier > traffic-intelligence
comparison scripts/undistort-video.py @ 1294:3deeb42dffdd
corrected bug with multiply in undistort-videos
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Tue, 08 Oct 2024 15:41:20 -0400 |
| parents | 2aa56b101041 |
| children |
comparison
equal
deleted
inserted
replaced
| 1293:4dd446835e7d | 1294:3deeb42dffdd |
|---|---|
| 55 ret, img = capture.read() | 55 ret, img = capture.read() |
| 56 if ret: | 56 if ret: |
| 57 img = cv2.remap(img, map1, map2, interpolation=cv2.INTER_LINEAR) | 57 img = cv2.remap(img, map1, map2, interpolation=cv2.INTER_LINEAR) |
| 58 cv2.imwrite(str(destinationPath/Path('undistorted-{{:0{}}}.png'.format(nZerosFilename).format(frameNum))), img) | 58 cv2.imwrite(str(destinationPath/Path('undistorted-{{:0{}}}.png'.format(nZerosFilename).format(frameNum))), img) |
| 59 if args.maskFilename is not None: | 59 if args.maskFilename is not None: |
| 60 cv2.imwrite(str(destinationPath/Path('undistorted+mask-{{:0{}}}.png'.format(nZerosFilename).format(frameNum))), cv2.multiply(img, undistortedMask, dtype = 16)) | 60 cv2.imwrite(str(destinationPath/Path('undistorted+mask-{{:0{}}}.png'.format(nZerosFilename).format(frameNum))), cv2.multiply(img, cv2.merge([undistortedMask]*3), dtype = 16)) |
| 61 frameNum += 1 | 61 frameNum += 1 |
| 62 | 62 |
| 63 if args.encodeVideo: | 63 if args.encodeVideo: |
| 64 print('Encoding the images files in video') | 64 print('Encoding the images files in video') |
| 65 from subprocess import check_call | 65 from subprocess import check_call |
