The question of which presidents were the "greatest" depends on who you ask, however, these names often come up (among others):
Did the public perceive any of these presidents as being among the "greatest" while they were still in office, or did this only become clear years later?
I'm curious because I was wondering whether we could even tell if a current president should be considered among the greatest, or if such designations can only be made in retrospect.
A lot of those guys you mentioned like Wilson and Truman were actually strongly disliked when they left office. So to answer your question, no because there were strong biases during the time. Even George Washington had many criticizers. It was only after their terms that people truly began to look upon them as "great."
Also props for including Polk. He was a fantastic president and as far as I know the only one that delivered on 100% of his campaign promises. He is usually over looked
Yes and no. Some, like Andrew Jackson, are still intensely polarizing even today, and had as many supporters as detractors. Even Lincoln was derided from both sides for his actions, until he was dead.
(I've found this is a common theme with presidents. Once they're dead, they must therefore be great.)
Generally, greatness as a concept comes from time and a greater understanding of the effects of any president's actions. For some, that understanding just came a little earlier than others.