import java.applet.*; import java.awt.*; import java.awt.image.*; import java.net.*; import java.util.*; import java.io.*; import java.lang.Math; /** * The medial axis transform operator. * * @author Simon Horne. */ public class Mat extends Thread { Skeleton skeleton = new Skeleton(); Distance distance = new Distance(); int [][] greyLevel; /** * Default no-args constructor. */ public Mat() { } /** * Takes an image and applies the medial axis transform algorithm by * doing a distance transform and then skeletonising the result to remove * all unwanted pixels. * * @param binary the BinaryFast input image * @return the new output image */ public BinaryFast mat_image(BinaryFast binary, double scale, double offset, boolean threshold){ binary = distance.distance_image(binary,scale,offset); greyLevel = new int [binary.w][binary.h]; for(int n=0;n255)g=255; //if(g<0)g=0; binary.pixels[m][n] = greyLevel[m][n]; } } } } return binary; } }