def save_record(): print(request.files['file'].filename) file = request.files['file'] file.save(os.path.join(app.config['UPLOAD_FOLDER'], file.filename)) global parsed_path parsed_path = p.process_video() out = Sample.serialize_array(parsed_path) with app.app_context(): socketio.emit('data_vis', {'data': out}, broadcast=True, namespace='/sock') return '200'
def get_checkpoints(message): itr = Checkpoint.deserialize_array(message['data']) checkpoints = [] global parsed_path for i, indv in enumerate(itr): node1, node2 = Checkpoint.deserialize(indv) checkpoint = Checkpoint(i, node1, node2) checkpoints.append(checkpoint) run = Run(parsed_path, checkpoints).summary() list_of_samples = [] for checkpoint in checkpoints: list_of_samples.append(Sample.serialize_array(checkpoint.samples)) emit('summary', {'data': run, 'cps': list_of_samples}, broadcast=True)
sample = Sample(cur_pos, cur_vel, Vec2d(0, 0), cur_time) self.path.append(sample) last_time = cur_time last_pos = cur_pos else: print("Processing complete " + str(len(self.path))) # print(path) break # When everything done, release the capture video.release() if self.debug: cv2.destroyAllWindows() return self.path if __name__ == "__main__": start_time = time.time() p = VideoProcess( video_path="./resources/car_test_2_motion.webm", debug=False) p.process_video() # p.view_path() print(Sample.serialize_array(p.path)) print(time.time() - start_time)