A graph based image processing framework