Partially implemented scanning test

This commit is contained in:
Paul Schaller 2023-11-27 14:32:42 +01:00
parent 5852418b0b
commit 595743bda2
9 changed files with 36 additions and 6 deletions

View File

@ -56,7 +56,7 @@ public class Homograph2 implements Homograph{
@Override
public void renormalize() {
//After the points are merged, depending on the implementation of the merging algorithm, the points might need to be renormalized
//This specific Algorithm does not need to be remerged
//This specific Algorithm does not need to be renormalized
//TODO double check that fact with a test
}

View File

@ -10,17 +10,20 @@ public class TwoSidedScanner extends SingleColorScanner {
private SideScanner frontSideScanner;
private SideScanner rightSideScanner;
BufferedImage frontSideImages[];
BufferedImage rightSideImages[];
public TwoSidedScanner(BufferedImage frontSideImages[], BufferedImage rightSideImages[]) {
this.frontSideImages = frontSideImages;
this.rightSideImages = rightSideImages;
//TODO
frontSideScanner = new SingleColoredSideScanner(frontSideImages, this.gammaDelta, , , );
rightSideScanner = new SingleColoredSideScanner(rightSideImages, this.gammaDelta, , , );
}
@Override
public Homograph scan() {
// TODO Auto-generated method stub
frontSideScanner = new SingleColoredSideScanner(frontSideImages, this.gammaDelta, , , );
rightSideScanner = new SingleColoredSideScanner(rightSideImages, this.gammaDelta, , , );
frontSideScanner.scan();
frontSideScanner.normalizePoints();
Point2D[] frontPoints = frontSideScanner.getPoints();

View File

@ -14,6 +14,10 @@ import javax.imageio.ImageIO;
import org.junit.jupiter.api.Test;
import com.cringe_studios.christmastreescanning.Homograph;
import com.cringe_studios.christmastreescanning.Point3D;
import com.cringe_studios.christmastreescanning.Scanner;
import com.cringe_studios.christmastreescanning.TwoSidedScanner;
import com.cringe_studios.christmastreescanning.scanning.image_scanning.GrayscaleImageScanner;
import com.cringe_studios.christmastreescanning.scanning.image_scanning.ImageScanner;
@ -24,6 +28,29 @@ public class ExampleTest {
assertEquals(1 + 1, 2);
}
@Test
public void scannerTest() {
try {
BufferedImage LED1Front = ImageIO.read(ExampleTest.class.getResourceAsStream("ScannerTest1_LED1_front.png"));
BufferedImage LED2Front = ImageIO.read(ExampleTest.class.getResourceAsStream("ScannerTest1_LED2_front.png"));
BufferedImage LED3Front = ImageIO.read(ExampleTest.class.getResourceAsStream("ScannerTest1_LED3_front.png"));
BufferedImage LED1Right = ImageIO.read(ExampleTest.class.getResourceAsStream("ScannerTest1_LED1_right.png"));
BufferedImage LED2Right = ImageIO.read(ExampleTest.class.getResourceAsStream("ScannerTest1_LED2_right.png"));
BufferedImage LED3Right = ImageIO.read(ExampleTest.class.getResourceAsStream("ScannerTest1_LED3_right.png"));
Scanner scanner = new TwoSidedScanner(new BufferedImage[] {LED1Front, LED2Front, LED3Front}, new BufferedImage[] {LED1Right, LED2Right, LED3Right});
scanner.setGammaDelta((byte)(0.1 * 255));
Homograph homo = scanner.scan();
homo.merge();
homo.renormalize();
Point3D points[] = homo.getPoints();
} catch (IOException e) {
e.printStackTrace();
}
}
@Test
public void generateVisualTestImages() {

Binary file not shown.

After

Width:  |  Height:  |  Size: 361 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 241 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 207 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 235 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 231 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 249 KiB