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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started