You lose information when an image is not in focus - and you can't recover that information. You can only guess what the "real" image might have been, with some (hard-coded) heuristics and statistical methods of inference. Then again, this is already done by your brain.