Seam carving implemented in matlab