C:\ece538\impro3>java Convolve3 convolution mask -1 0 1 -2 0 2 -1 0 1
Convolve3.javaimport javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
import java.util.List;
import java.awt.image.*;
import java.io.*;
public class Convolve3 extends Application {
@Override public void start(Stage stage) {
String file1 = "blob.png";
List<String> args = getParameters().getRaw();
String filename = args.size()>0? args.get(0): file1;
int style = args.size()>1? Integer.parseInt(args.get(1)): 1;
int scl = args.size()>2? Integer.parseInt(args.get(2)): 2;
int mag = args.size()>3? Integer.parseInt(args.get(3)): 1;
BufferedImage img = ImageOp.readImage(filename);
showImage show1=null;
if (mag>1) show1 = new showImage(ImageOp.replicate(img,mag),filename);
else show1 = new showImage(img,filename);
show1.setStage(stage);
stage.setX(100);
stage.setY(100);
int width = img.getWidth();
int mask[][] = { {-1, 0, 1},{-2, 0, 2},{-1, 0, 1} };
Convolve c = new Convolve(mask);
c.setScale(scl);
c.setBipolarStyle(style);
c.showMatrix(mask,"convolution mask");
BufferedImage outp = c.doConvolve(img);
showImage show2=null;
String title = "edge enhanced";
if (mag>1) show2 = new showImage(ImageOp.replicate(outp,mag),title);
else show2 = new showImage(outp,title);
Stage stage2 = new Stage();
show2.setStage(stage2);
stage2.setX(140+stage.getWidth());
stage2.setY(100);
}
public static void main(String[] args) {
Application.launch(args);
}
}
Maintained by John Loomis, updated Tue Mar 13 11:12:48 2018