Mercurial Hosting > traffic-intelligence
comparison trafficintelligence/storage.py @ 1207:36f0d18e1fad
work in progress on loading kitti (issue with int)
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Wed, 26 Apr 2023 18:33:29 -0400 |
parents | 3905b393ade0 |
children | af329f3330ba |
comparison
equal
deleted
inserted
replaced
1205:3905b393ade0 | 1207:36f0d18e1fad |
---|---|
1311 invR0 = linalg.inv(reshape(kittiCalibration['R_rect'], (3, 3))) | 1311 invR0 = linalg.inv(reshape(kittiCalibration['R_rect'], (3, 3))) |
1312 transCam2Velo = transpose(kittiCalibration['Tr_cam_velo']) | 1312 transCam2Velo = transpose(kittiCalibration['Tr_cam_velo']) |
1313 | 1313 |
1314 header = ['frame', # 0, 1, ..., n | 1314 header = ['frame', # 0, 1, ..., n |
1315 'trackingid', # -1, 0 , 1, ..., k | 1315 'trackingid', # -1, 0 , 1, ..., k |
1316 'type', # 'Car', 'Pedestrian', ... | 1316 'usertype', # 'Car', 'Pedestrian', ... |
1317 'truncation', # truncated pixel ratio [0..1] | 1317 'truncation', # truncated pixel ratio [0..1] |
1318 'occlusion', # 0=visible, 1=partly occluded, 2=fully occluded, 3=unknown | 1318 'occlusion', # 0=visible, 1=partly occluded, 2=fully occluded, 3=unknown |
1319 'alpha', # object observation angle [-pi..pi] | 1319 'alpha', # object observation angle [-pi..pi] |
1320 # extract 2d bounding box in 0-based coordinates | 1320 # extract 2d bounding box in 0-based coordinates |
1321 'xmin', # left | 1321 'xmin', # left |
1379 yCoords = worldCorners[:4,1] | 1379 yCoords = worldCorners[:4,1] |
1380 t.addPositionXY(xCoords.mean(), yCoords.mean()) | 1380 t.addPositionXY(xCoords.mean(), yCoords.mean()) |
1381 for i in range(4): | 1381 for i in range(4): |
1382 featureTrajectories[i].addPositionXY(xCoords[i], yCoords[i]) | 1382 featureTrajectories[i].addPositionXY(xCoords[i], yCoords[i]) |
1383 # check https://docs.opencv.org/3.4/d9/d0c/group__calib3d.html#ga1019495a2c8d1743ed5cc23fa0daff8c | 1383 # check https://docs.opencv.org/3.4/d9/d0c/group__calib3d.html#ga1019495a2c8d1743ed5cc23fa0daff8c |
1384 newObj = moving.MovingObject(num = objNum, timeInterval = moving.TimeInterval(int(tmp.frame.min()), int(tmp.frame.max())), positions = t, userType = tmp.iloc[0].type, features = [moving.MovingObject(num = featureNum+i, timeInterval = moving.TimeInterval(int(tmp.frame.min()), int(tmp.frame.max())), positions = featureTrajectories[i]) for i in range(4)]) | 1384 |
1385 newObj = moving.MovingObject(num = objNum, timeInterval = moving.TimeInterval(int(tmp.frame.min()), int(tmp.frame.max())), positions = t, velocities = t.differentiate(True), userType = tmp.iloc[0].usertype, features = [moving.MovingObject(num = featureNum+i, timeInterval = moving.TimeInterval(int(tmp.frame.min()), int(tmp.frame.max())), positions = featureTrajectories[i], velocities = featureTrajectories[i].differentiate(True)) for i in range(4)]) | |
1385 objects.append(newObj) | 1386 objects.append(newObj) |
1386 featureNum += 4 | 1387 featureNum += 4 |
1387 return objects | 1388 return objects |
1388 | 1389 |
1389 def convertNgsimFile(inputfile, outputfile, append = False, nObjects = -1, sequenceNum = 0): | 1390 def convertNgsimFile(inputfile, outputfile, append = False, nObjects = -1, sequenceNum = 0): |