Inpainting based on low-dimensional image approximation and its applications