A linear framework for region-based image segmentation and inpainting involving curvature penalization