public static Picture seamOverlay(Picture p, boolean horizontal, int[] seamIndices)
    {
        Picture overlaid = new Picture(p.width(), p.height());

        for (int i = 0; i < p.width(); i++)
            for (int j = 0; j < p.height(); j++)
                overlaid.set(i, j, p.get(i, j));

        int width = p.width();
        int height = p.height();

        //if horizontal seam, then set one pixel in every column
        if (horizontal)
            for (int i = 0; i < width; i++)
                overlaid.set(i, seamIndices[i], new Color(255, 0, 0));
        else //if vertical, put one pixel in every row
            for (int j= 0; j < height; j++)
                overlaid.set(seamIndices[j], j, new Color(255, 0, 0));

        return overlaid;
    }