Can't compare the two, but I'll have a go.
Cannavaro had only two weak moments in his career - his spell at Inter, who ruined a lot of players with their constant fails and turnover of players, and the end of his career when he was past his best.
It's easy to forget just how good he was as a young defender, he was playing in the best league in the world against many world class and legendary strikers, and he was a world class defender himself by the age of 23-24 (by today's standards, at least). Add in that spell with Juventus and the national team (also at times with Madrid), he was insane.
Barzagli is only getting close to those heights at the end of his career, after bouncing back from failed early promise. Right now Barzagli could play in the company of Cannavaro, but he is not the same level of player. That's what's great about Italian players, however, the longevity and late bloomers.