From perception to cognition