Generalized solution of linear systems and image restoration