partially working optimal seam graph cut in horizontal direction