Peter, John, and James recognized Moses and Elijah.
They had never seen them before and they recognized who they were.
Mat 17:4 And Peter said to Jesus, "Lord, it is good that we are here. If you wish, I will make three tents here, one for you and one for Moses and one for Elijah."