public SeamCarver(Picture picture) { // create a seam carver object based on the given picture int picWidth = picture.width(); int picHeight = picture.height(); currentPicture = picture; pixelColor = new Color[picWidth][picHeight]; for (int i = 0; i < picHeight; i++) { for (int j = 0; j < picWidth; j++) { pixelColor[j][i] = picture.get(j, i); } } }
private void CreatePictureFromColorMatrix(int width, int height) { verticalSeamCarve = new Picture(width, height); for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { verticalSeamCarve.set(i, j, pixelColor[i][j]); } } currentPicture = verticalSeamCarve; }
public int height() { // height of current picture return currentPicture.height(); }
public int width() { // width of current picture return currentPicture.width(); }