hw/hw5/SeamCarver.java
public int[] findVerticalSeam() {

        int row = energy.length;
        int col = energy[0].length;
        int[] vSeam = new int[row];
        double[] candidate;

        vSeam[0] = findMin(energy[0]);

        for (int index = 1; index < row; index += 1) {
            candidate = new double[col];

            for (int e = 0; e < candidate.length; e += 1) {
                candidate[e] = Integer.MAX_VALUE;
            }

            System.arraycopy(energy[index], vSeam[index - 1] - 1, candidate, vSeam[index - 1] - 1, 3);

            vSeam[index] = findMin(candidate);
        }

        return vSeam;
    }
/** sequence of indices for vertical seam */
sequence of indices for vertical seam
sequence of indices for vertical seam
public int[] findVerticalSeam() {
        int row = energy.length;
        int col = energy[0].length;
        int[] vSeam = new int[row];
        double[] candidate;
        vSeam[0] = findMin(energy[0]);
        for (int index = 1; index < row; index += 1) {
            candidate = new double[col];
            for (int e = 0; e < candidate.length; e += 1) {
                candidate[e] = Integer.MAX_VALUE;
            }
            System.arraycopy(energy[index], vSeam[index - 1] - 1, candidate, vSeam[index - 1] - 1, 3);
            vSeam[index] = findMin(candidate);
        }
        return vSeam;
    }
public int [ ] findVerticalSeam ( ) { int row = energy . length ; int col = energy [ 0 ] . length ; int [ ] vSeam = new int [ row ] ; double [ ] candidate ; vSeam [ 0 ] = findMin ( energy [ 0 ] ) ; for ( int index = 1 ; index < row ; index += 1 ) { candidate = new double [ col ] ; for ( int e = 0 ; e < candidate . length ; e += 1 ) { candidate [ e ] = Integer . MAX_VALUE ; } System . arraycopy ( energy [ index ] , vSeam [ index - 1 ] - 1 , candidate , vSeam [ index - 1 ] - 1 , 3 ) ; vSeam [ index ] = findMin ( candidate ) ; } return vSeam ; }
sequence of indices for vertical seam
sequence of indices for vertical seam