Update SeamCarving function.