예제 #1
0
        if tracked_blobs_lane3:
            # Prune out the blobs that haven't been seen in some amount of time
            for i in range(len(tracked_blobs_lane3) - 1, -1, -1):
                if frame_time - tracked_blobs_lane3[i][
                        'last_seen'] > BLOB_TRACK_TIMEOUT:  # Deleta caso de timeout
                    print("Removing expired track {}".format(
                        tracked_blobs_lane3[i]['id']))
                    #                    prev_speed = ave_speed
                    #                    final_ave_speed = 0.0
                    del tracked_blobs_lane3[i]

        # ################ PRINTA OS BLOBS ####################################
        for blob in tracked_blobs:  # Desenha os pontos centrais
            if SHOW_TRAIL:
                #                t.print_trail(blob['trail'], frame)
                t.print_trail(blob['trail'], frame_lane1)

        for blob2 in tracked_blobs_lane2:  # Desenha os pontos centrais
            if SHOW_TRAIL:
                #                t.print_trail(blob2['trail'], frame)
                t.print_trail(blob2['trail'], frame_lane2)

        for blob3 in tracked_blobs_lane3:  # Desenha os pontos centrais
            if SHOW_TRAIL:
                #                t.print_trail(blob3['trail'], frame)
                t.print_trail(blob3['trail'], frame_lane3)

            if blob['speed'] and blob['speed'][0] != 0:
                prev_len_speed.insert(0, len(blob['speed']))
                # limpa prev_len_speed se estiver muito grande
                # deixa no máx 20 valores
예제 #2
0
파일: Testes.py 프로젝트: brochj/SpeedTCC
         closest_blob['id'])] = dict(
             ave_speed=round(ave_speed, 2),
             speeds=closest_blob['speed'],
             frame=frameCount,
             real_speed=float(
                 dict_lane1['speed']),
             abs_error=round(abs_error, 2),
             per_error=round(per_error, 3),
             trail=closest_blob['trail'],
             car_id=closest_blob['id'])
 except:
     pass
 abs_error = []
 per_error = []
 if SHOW_TRAIL:
     t.print_trail(closest_blob['trail'],
                   frame)
 if SHOW_FRAME_COUNT:
     PERCE = str(
         int((100 * frameCount) /
             vehicle['videoframes']))
     cv2.putText(
         frame,
         f'frame: {frameCount} {PERCE}%',
         (r(14), r(1071)), 0, .65, t.WHITE,
         2)
 if SAVE_FRAME_F1:
     cv2.imwrite(
         'results/{}/imagens/faixa1/{}_{}_F{}_{}.png'
         .format(DATE, VIDEO,
                 dict_lane3['frame_start'],
                 lane, closest_blob['id']),