Added a new Test with computer generated images. Images in real life

still work better for some reason.
This commit is contained in:
Paul Schaller 2024-01-02 15:14:26 +01:00
parent 59dc2f6626
commit e6cb2c7249
81 changed files with 83 additions and 0 deletions

View File

@ -196,6 +196,89 @@ public class ExampleTest {
System.out.println(); System.out.println();
} }
@Test
public void scannerTestComputerGeneratedTree() {
System.out.println("ScannerTestComputerGeneratedTree:");
try {
BufferedImage southImages[] = new BufferedImage[20];
BufferedImage eastImages[] = new BufferedImage[20];
BufferedImage northImages[] = new BufferedImage[20];
BufferedImage westImages[] = new BufferedImage[20];
for(int i = 1; i <= 20; i++) {
southImages[i - 1] = ImageIO.read(ExampleTest.class.getResourceAsStream("/ComputerTree/Weihnachtsbaum/Süd00" + ((i < 10) ? "0" : "") + Integer.toString(i) + ".jpg"));
eastImages[i - 1] = ImageIO.read(ExampleTest.class.getResourceAsStream("/ComputerTree/Weihnachtsbaum/Ost00" + ((i < 10) ? "0" : "") + Integer.toString(i) + ".jpg"));
northImages[i - 1] = ImageIO.read(ExampleTest.class.getResourceAsStream("/ComputerTree/Weihnachtsbaum/Nord00" + ((i < 10) ? "0" : "") + Integer.toString(i) + ".jpg"));
westImages[i - 1] = ImageIO.read(ExampleTest.class.getResourceAsStream("/ComputerTree/Weihnachtsbaum/West00" + ((i < 10) ? "0" : "") + Integer.toString(i) + ".jpg"));
}
Scanner scanner = new FourSidedScanner(southImages, eastImages, northImages, westImages);
scanner.setGammaDelta((byte)(0.1 * 255));
Homograph homo = scanner.scan();
homo.merge();
homo.renormalize();
Point3D points[] = homo.getPoints();
System.out.println(Arrays.toString(points));
boolean foundXMin = false; // -1
boolean foundXMax = false; // 1
boolean foundYMin = false; // -1
boolean foundYMax = false; // 1
boolean foundZMin = false; // 0
boolean foundZMax = false; // 1
for(int i = 0; i < points.length; i++) {
if(Math.abs(points[i].x - (-1.0)) < 0.001) {
foundXMin = true;
}
if(Math.abs(points[i].x - (1.0)) < 0.001) {
foundXMax = true;
}
if(Math.abs(points[i].y - (-1.0)) < 0.001) {
foundYMin = true;
}
if(Math.abs(points[i].y - (1.0)) < 0.001) {
foundYMax = true;
}
/*if(Math.abs(points[i].z - (1.0)) < 0.001) {
foundZMax = true;
}*/
if(Math.abs(points[i].z - (0.0)) < 0.001) {
foundZMin = true;
}
}
if(foundXMin && foundXMax && foundYMin && foundYMax /*&& foundZMin*/ /*&& foundZMax*/) {
assertTrue(true);
}else {
System.out.println(foundXMin );
System.out.println(foundXMax );
System.out.println(foundYMin );
System.out.println(foundYMax );
System.out.println(foundZMin );
System.out.println(foundZMax );
assertTrue(false);
}
} catch (IOException e) {
e.printStackTrace();
}
System.out.println("-----EndOf ScannerTestComputerGeneratedTree");
System.out.println();
}
@Test @Test
public void generateVisualTestImages() { public void generateVisualTestImages() {

Binary file not shown.

After

Width:  |  Height:  |  Size: 478 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 477 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 481 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 479 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 478 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 479 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 479 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 478 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 482 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 482 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 477 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 478 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 478 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 479 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 478 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 474 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 477 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 479 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 481 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 480 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 489 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 488 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 492 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 491 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 486 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 487 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 489 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 488 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 490 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 489 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 488 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 488 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 490 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 487 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 487 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 488 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 488 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 489 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 491 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 489 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 525 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 526 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 528 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 525 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 524 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 524 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 526 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 526 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 528 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 527 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 527 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 525 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 525 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 525 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 524 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 527 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 526 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 528 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 526 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 527 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 528 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 528 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 531 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 529 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 530 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 529 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 530 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 529 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 533 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 530 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 530 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 528 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 527 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 530 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 531 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 526 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 528 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 531 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 530 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 531 KiB