from datetime import datetime


def to_time(s):
    """ Captures time from image name and convert to time variable """
    s = s.replace('/Users/lucasosouza/Documents/CarND/P3-final/IMG/center_', '')
    s = s.replace('.jpg', '')
    s = datetime.strptime(s, '%Y_%m_%d_%H_%M_%S_%f')
    
    return s