src/io/github/marwlod/seam_carving/SeamCarver.java
// remove horizontal seam from current picture
remove horizontal seam from current picture
remove horizontal seam from current picture
public void removeHorizontalSeam(int[] seam) {
        validateSeam(seam, picWidth, picHeight);
        Picture shorterPicture = new Picture(picWidth, picHeight-1);
        int[][] shorterRgb = new int[picWidth][picHeight-1];
        for (int x = 0; x < picWidth; x++) {
            for (int y = 0, oldY = 0; y < picHeight-1; y++, oldY++) {
                if (y == seam[x]) oldY++;
                shorterPicture.set(x, y, picture.get(x, oldY));
                shorterRgb[x][y] = rgb[x][oldY];
            }
        }
        picture = shorterPicture;
        rgb = shorterRgb;
        picHeight--;
    }
public void removeHorizontalSeam ( int [ ] seam ) { validateSeam ( seam , picWidth , picHeight ) ; Picture shorterPicture = new Picture ( picWidth , picHeight - 1 ) ; int [ ] [ ] shorterRgb = new int [ picWidth ] [ picHeight - 1 ] ; for ( int x = 0 ; x < picWidth ; x ++ ) { for ( int y = 0 , oldY = 0 ; y < picHeight - 1 ; y ++ , oldY ++ ) { if ( y == seam [ x ] ) oldY ++ ; shorterPicture . set ( x , y , picture . get ( x , oldY ) ) ; shorterRgb [ x ] [ y ] = rgb [ x ] [ oldY ] ; } } picture = shorterPicture ; rgb = shorterRgb ; picHeight -- ; }
remove horizontal seam from current picture
remove horizontal seam from current picture