comparison trafficintelligence/cvutils.py @ 1242:4cd8ace3552f

major update for classification, allowing the use of neural network classification
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Wed, 07 Feb 2024 11:43:03 -0500
parents 3905b393ade0
children 371c718e57d7
comparison
equal deleted inserted replaced
1241:ab4c72b9475c 1242:4cd8ace3552f
363 if frameNum not in boundingBoxes and obj.hasFeatures(): 363 if frameNum not in boundingBoxes and obj.hasFeatures():
364 yCropMin, yCropMax, xCropMin, xCropMax = imageBoxSize(obj, frameNum, homography, width, height) 364 yCropMin, yCropMax, xCropMin, xCropMax = imageBoxSize(obj, frameNum, homography, width, height)
365 cv2.rectangle(img, (xCropMin, yCropMin), (xCropMax, yCropMax), cvBlue[colorType], 1) 365 cv2.rectangle(img, (xCropMin, yCropMin), (xCropMax, yCropMax), cvBlue[colorType], 1)
366 objDescription = '{} '.format(obj.num) 366 objDescription = '{} '.format(obj.num)
367 if moving.userTypeNames[obj.userType] != 'unknown': 367 if moving.userTypeNames[obj.userType] != 'unknown':
368 objDescription += moving.userTypeNames[obj.userType][0].upper() 368 s = moving.userTypeNames[obj.userType]
369 objDescription += s[0].upper()+s[1]
369 if len(annotations) > 0: # if we loaded annotations, but there is no match 370 if len(annotations) > 0: # if we loaded annotations, but there is no match
370 if frameNum not in toMatches[obj.getNum()]: 371 if frameNum not in toMatches[obj.getNum()]:
371 objDescription += " FA" 372 objDescription += " FA"
372 cv2.putText(img, objDescription, obj.projectedPositions[frameNum-obj.getFirstInstant()].asint().astuple(), cv2.FONT_HERSHEY_PLAIN, 1, cvColors[colorType][obj.getNum()]) 373 cv2.putText(img, objDescription, obj.projectedPositions[frameNum-obj.getFirstInstant()].asint().astuple(), cv2.FONT_HERSHEY_PLAIN, 1, cvColors[colorType][obj.getNum()])
373 if obj.getLastInstant() == frameNum: 374 if obj.getLastInstant() == frameNum: