Mercurial > hg > nsaunier > traffic-intelligence
comparison scripts/compute-clearmot.py @ 1249:2aa56b101041
added mask functionality for dltrack
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Thu, 15 Feb 2024 14:09:52 -0500 |
| parents | b684135d817f |
| children |
comparison
equal
deleted
inserted
replaced
| 1248:c4c50678c856 | 1249:2aa56b101041 |
|---|---|
| 43 objects = storage.loadTrajectoriesFromSqlite(args.trackerDatabaseFilename, 'object') | 43 objects = storage.loadTrajectoriesFromSqlite(args.trackerDatabaseFilename, 'object') |
| 44 | 44 |
| 45 if args.maskFilename is not None: | 45 if args.maskFilename is not None: |
| 46 maskObjects = [] | 46 maskObjects = [] |
| 47 from matplotlib.pyplot import imread | 47 from matplotlib.pyplot import imread |
| 48 mask = imread(args.maskFilename) | 48 mask = imread(args.maskFilename, cv2.IMREAD_GRAYSCALE) |
| 49 if len(mask) > 1: | 49 #if len(mask) > 1: if loaded as RGB |
| 50 mask = mask[:,:,0] | 50 # mask = mask[:,:,0] |
| 51 for obj in objects: | 51 for obj in objects: |
| 52 maskObjects += obj.getObjectsInMask(mask, invHomography, 10) # TODO add option to keep object if at least one feature in mask | 52 maskObjects += obj.getObjectsInMask(mask, invHomography, 10) # TODO add option to keep object if at least one feature in mask |
| 53 objects = maskObjects | 53 objects = maskObjects |
| 54 | 54 |
| 55 annotations = storage.loadBBMovingObjectsFromSqlite(args.groundTruthDatabaseFilename) | 55 annotations = storage.loadBBMovingObjectsFromSqlite(args.groundTruthDatabaseFilename) |
