Question: Intro to JAVA please see below thanks! -------------------------------------------------------------------------------------------- In order to analyze images, one wants to isolate individual features. The first step is to locate

Intro to JAVA please see below thanks!

--------------------------------------------------------------------------------------------

In order to analyze images, one wants to isolate individual features. The first step is to locate feature boundaries through edge detection. In its simplest form, one compares each pixel with its neighbors. If the difference is large, color the pixel black; otherwise, color it white. We give you a Picture class that yields a two-dimensional array of gray levels. Process each pixel as described, but only take the average of the pixels to the right, bottom, and bottom right (so that you dont evaluate pixels that were already processed). Leave the last row and column alone. Complete the following code.

CODE:

public class EdgeDetect { public static void main(String[] args) { Picture picture = new Picture("eiffel-tower-picture.jpg"); int[][] grays = picture.getGrayLevels();

for (. . .) { for (. . .) { int neighborAverage = . . .; if (Math.abs(grays[i][j] - neighborAverage) > 20) { grays[i][j] = 0; } else { grays[i][j] = 255; } } } Picture edges = new Picture(grays); edges.draw(); } }

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!