Connect1.java

Download executable jar file Connect1.jar

   


Connect1.java


 import 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.*;
 import java.awt.image.*;
 import java.io.*;

public class Connect1 extends Application {
 
     @Override public void start(Stage stage) {
         // load the image
	String file1 = "uvwb.png";
	List<String> args = getParameters().getRaw();
	String filename =  (args.size()>0)? args.get(0): file1;
	int mag = (args.size()>1)? Integer.parseInt(args.get(1)): 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);

	double w = stage.getWidth();
	double h = stage.getHeight();

	ConnComp c = new ConnComp();
	BufferedImage out1 = c.connect(img);
	BufferedImage outp = c.label2rgb(out1);
	System.out.println(c.nobjs + " objects");


	 showImage show2 = null;
	 if (mag>1) show2 = new showImage(ImageOp.replicate(outp,mag),"labeled");
	 else  show2 = new showImage(outp,"labeled");
	 show2.writeImage("connect1","png");
	 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 Fri Mar 16 13:12:42 2018