A Geometric Approach to Image Labeling