Topic 1 - Variables and Data Types
Topic 2 - Conditionals and Strings
Topic 3 - Loops
Topic 4 - Arrays
Topic 5 - File Handling
Semester 1 Projects
Topic 6 - Classes/Objects and Methods
Topic 7 - ArrayLists
Semester Projects

Part 2c: Show Seam

Implement the following method to show a seam on a Picture:

  • public Picture showSeam()
    should return a new Picture, a modified copy of this, which includes the vertical seam (found from computeSeam) drawn in red.

This method should return a copy of this with the lowest-cost seam, as computed by computeSeam, shown in red. To do this, you’ll probably want to start by

  1. computing the best seam and
  2. making a new copy of this. For instance, these lines will accomplish these two things:
int[] seam = this.computeSeam(); 
Picture newPicture = new Picture(this);

From there, you’ll need to loop through and change some of the pixels of newPicture to be red – namely those on the seam! Here is an example from the okinawa.jpg image:

Tests

When you complete this part, all of the tests from PictureTest_ShowSeam.java should pass.