Bayesian analysis of weak gravitational lensing