It looks like standard depth of field technique, it just needs some depth information in the picture. Of course it's possible, even real time but what uses do you have in mind?