We should not only factor in their time period, but also their precise mental and social context — including their brain chemistry.
But so the truly correct answer is that we should not judge people at all.
We should not make heroes or villains of anyone. Instead, we should just judge ideas.
Consider any idea that you have that you consider to be a good idea - for instance, the idea that slavery is bad.
How did you come to believe that? Is it because you were taught it from the time that you were a child? If you learned it later in life, was it because an important mentor told you? Or an important life event? And is it possible that someone who doesn't hold that viewpoint may have had different people telling them different things at formative periods of their life? Or perhaps they had events in their life that taught them it was a dog eat dog world, and that morality simply wasn't an accurate concept?
The fact of the matter is, we don’t choose our ideas. Our ideas choose us. We have a will, but it is not a free will. The more you examine your own thoughts, the more it becomes impossible to deny that truth.
But there's more.
Anytime you make a judgment about someone, you are leaving the realm of fact, and entering a realm of pure speculation.
And within this context, you can choose to be as generous or as miserly with your judgments as you like. You can choose to say that Hitler did everything just because he was compelled to by some mental illness, or you can say Martin Luther King did everything out of pure selfishness.
It's a realm of pure bias. And bias is not what we need in order to have good conversations with each other and make a better world together.