Question: Image processing relies on multi - dimensional arrays. Write a method selectRect that simulates selecting and returning a rectangular area of a 2 D image.

Image processing relies on multi-dimensional arrays. Write a method selectRect that simulates selecting and returning a rectangular area of a 2D image.
// Returns a full 2d int array with data from the rectangular area
// specified by startRow, startCol, endRow, and endCol (assume
// startRow<=endRow and startCol<=endCol) if those four indexes are
// valid.
// Return null if image is null or has zero rows or zero cols.
// Also return null if any row/col index is invalid.
public static int[][] selectRect(int[][] image,
int startRow, int startCol,
int endRow, int endCol){
// ADD code
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!