Now, let's have a quick look at the Java code doing the convolution, and then build the Java application with the six filter types we have already seen, along with some different images of course.
This is the main class, EdgeDetection:
package ramo.klevis.ml;import javax.imageio.ImageIO;import java.awt.*;import java.awt.image.BufferedImage;import java.io.File;import java.io.IOException;import java.util.HashMap;public class EdgeDetection {
We'll start by defining the six filters, with their values, that we saw in the previous section:
public static final String HORIZONTAL_FILTER = "Horizontal Filter";public static final String VERTICAL_FILTER = "Vertical Filter";public static final String SOBEL_FILTER_VERTICAL = "Sobel Vertical ...