/** Tests some simple edgelet computations.
*
* Components of this set of experiments are:
*
* - This main, the test, EdgeletTest
*
- The Edgelet object with x and y components and magnitude.
*
- The ImageGenerator creating oblique fuzzy edge in bordered image.
*
- Sobel, which operates on an image to produce and array of Edgelets.
*
* @author Bob Futrelle
* @version March 27 2004 v0.1
**/
public class EdgeletTest {
double[][] image;
Edgelet[][] edgelets;
public static void main(String[] args) {
EdgeletTest test = new EdgeletTest();
test.setup();
test.run();
test.show();
}
public void setup() {
ImageGenerator gen = new ImageGenerator();
image = gen.run();
} // setup()
public void run() {
Sobel sobel = new Sobel();
edgelets = sobel.run(image);
} // run()
/** prints a row of Edglets
**/
public void show() {
for(int i = 1; i < 9; i++) {
Edgelet e = edgelets[i][5];
System.out.println("" + e.x + " " + e.y + " " + e.mag);
}
} // show()
} // class EdgeletTest
/* The output of the above, with comments, is
as follows, which prints out x, y and magnitude
across a row of the image, columns shown, 1-8 in
the full array of 0-9. Their are weak edge elements
at 3,3, 4,4, 5,5 and 6,6, which explains why the
edge is already "seen" at 3,5, which can "see" 4,4.
Similarly 7,5 can "see" 6,6.
Image created.
0.0 765.0 765.0 picks up border as vertical edge, col 1
0.0 0.0 0.0 in a uniform region, no gradient, col 2
127.0 -127.0 254.0 begins to see the edge, at 45 degrees, col 3
509.0 -509.0 1018.0 further into the edge, col 4
765.0 -638.0 1403.0 at the maximum position in edge, col 5
511.0 -256.0 767.0 edge is fading, col 6
128.0 0.0 128.0 sees only an x component here, col 7
0.0 0.0 0.0 the other border is the same shade, so no gradient seen, col 8
*/