Revert the previous two commits

This commit is contained in:
MrLetsplay 2023-11-28 16:28:46 +01:00
parent edcea3bd82
commit 04a2d79653
Signed by: mr
SSH Key Fingerprint: SHA256:92jBH80vpXyaZHjaIl47pjRq+Yt7XGTArqQg1V7hSqg
11 changed files with 49 additions and 50 deletions

View File

@ -12,28 +12,19 @@ public class FourSidedScanner extends SingleColorScanner {
private SideScanner behindSideScanner;
private SideScanner leftSideScanner;
BufferedImage frontSideImages[];
BufferedImage rightSideImages[];
BufferedImage behindSideImages[];
BufferedImage leftSideImages[];
public FourSidedScanner(BufferedImage frontSideImages[], BufferedImage rightSideImages[], BufferedImage behindSideImages[], BufferedImage leftSideImages[]) {
this.frontSideImages = frontSideImages;
this.rightSideImages = rightSideImages;
this.behindSideImages = behindSideImages;
this.leftSideImages = leftSideImages;
//TODO
frontSideScanner = new SingleColoredSideScanner(frontSideImages, this.gammaDelta, , , );
rightSideScanner = new SingleColoredSideScanner(rightSideImages, this.gammaDelta, , , );
behindSideScanner = new SingleColoredSideScanner(behindSideScanner, this.gammaDelta, , , );
leftSideScanner = new SingleColoredSideScanner(leftSideScanner, this.gammaDelta, , , );
}
@Override
public Homograph scan() {
frontSideScanner = new SingleColoredSideScanner(frontSideImages, this.gammaDelta);
rightSideScanner = new SingleColoredSideScanner(rightSideImages, this.gammaDelta);
behindSideScanner = new SingleColoredSideScanner(behindSideImages, this.gammaDelta);
leftSideScanner = new SingleColoredSideScanner(leftSideImages, this.gammaDelta);
// TODO Auto-generated method stub
frontSideScanner.scan();
frontSideScanner.normalizePoints();
Point2D[] frontPoints = frontSideScanner.getPoints();
@ -50,6 +41,6 @@ public class FourSidedScanner extends SingleColorScanner {
leftSideScanner.normalizePoints();
Point2D[] leftSidePoints = leftSideScanner.getPoints();
return new Homograph4(frontPoints, rightSidePoints, behindSidePoints, leftSidePoints);
return new Homograph4(rightSidePoints, rightSidePoints, behindSidePoints, leftSidePoints);
}
}

View File

@ -1,11 +1,8 @@
package com.cringe_studios.christmastreescanning;
import java.awt.geom.Point2D;
public interface Homograph {
void normalize(Double baseline, Double minX, Double maxX);
default void normalize() {
normalize(null, null, null);
}
void merge();
void renormalize();
Point3D[] getPoints();

View File

@ -65,10 +65,4 @@ public class Homograph2 implements Homograph{
public Point3D[] getPoints() {
return Arrays.stream(homographs).map(i -> i.getPoint()).toArray(Point3D[]::new);
}
@Override
public void normalize(Double baseline, Double minX, Double maxX) {
// TODO Auto-generated method stub
}
}

View File

@ -45,10 +45,4 @@ public class Homograph4 implements Homograph{
public Point3D[] getPoints() {
return internalHomograph.getPoints();
}
@Override
public void normalize(Double baseline, Double minX, Double maxX) {
// TODO Auto-generated method stub
}
}

View File

@ -2,7 +2,7 @@ package com.cringe_studios.christmastreescanning;
public class Point3D {
public double x; // baseline
public double y; // going into the image
public double y; // coming out of the image
public double z; // The height
public Point3D(double nx, double ny, double nz) {

View File

@ -26,7 +26,6 @@ public abstract class Scanner {
// BufferedImage leftSideImagesBlue[];
protected byte gammaDelta = ImageScanner.GAMMA_DELTA_DEFAULT;
protected boolean toMultipleGrayscaleImages = false;
// Boolean distinctColorChannels = null; // use the non-primitive datatype, so the user has to set the state
// Boolean sideCount = null; // use the non-primitive datatype, so the user has to set the state
@ -198,15 +197,6 @@ public abstract Homograph scan();
this.gammaDelta = gammaDelta;
}
/**
* Set, wether an image should be converted to multiple grayscale images (per color channel), or to a single grayscale image
* Default: false
* @param toMultipleGrayscaleImages
*/
public void setMultipleGrayScaleImages(boolean toMultipleGrayscaleImages) {
this.toMultipleGrayscaleImages = toMultipleGrayscaleImages;
}
// /**
// *
// * @param useDistinctRGBImages if this parameter is true, you have to use the IMAGE_*_RED/_GREEN/_BLUE enum types in the setData method

View File

@ -21,8 +21,8 @@ public class TwoSidedScanner extends SingleColorScanner {
@Override
public Homograph scan() {
frontSideScanner = new SingleColoredSideScanner(frontSideImages, this.gammaDelta);
rightSideScanner = new SingleColoredSideScanner(rightSideImages, this.gammaDelta);
frontSideScanner = new SingleColoredSideScanner(frontSideImages, this.gammaDelta, , , );
rightSideScanner = new SingleColoredSideScanner(rightSideImages, this.gammaDelta, , , );
frontSideScanner.scan();
frontSideScanner.normalizePoints();

View File

@ -11,16 +11,26 @@ public class MultiColoredSideScanner extends SideScanner{
private BufferedImage sideImagesBlue[];
byte gammaDelta = ImageScanner.GAMMA_DELTA_DEFAULT;
double baseline = 0.0;
double minX = Double.NEGATIVE_INFINITY;
double maxX = Double.POSITIVE_INFINITY;
boolean useDefaultValues;
Point2D foundPoints[] = null;
public MultiColoredSideScanner(BufferedImage[] imagesRed, BufferedImage[] imagesGreen, BufferedImage[] imagesBlue, byte gammaDelta) {
public MultiColoredSideScanner(BufferedImage[] imagesRed, BufferedImage[] imagesGreen, BufferedImage[] imagesBlue, byte gammaDelta, double baseline, double minX, double maxX) {
if(!(imagesRed.length == imagesGreen.length && imagesGreen.length == imagesBlue.length)); // TODO error
this.sideImagesRed = imagesRed;
this.sideImagesGreen = imagesGreen;
this.sideImagesBlue = imagesBlue;
this.gammaDelta = gammaDelta;
this.baseline = baseline;
this.minX = minX;
this.maxX = maxX;
this.useDefaultValues = false;
}
public MultiColoredSideScanner(BufferedImage[] imagesRed, BufferedImage[] imagesGreen, BufferedImage[] imagesBlue) {
@ -29,6 +39,8 @@ public class MultiColoredSideScanner extends SideScanner{
this.sideImagesRed = imagesRed;
this.sideImagesGreen = imagesGreen;
this.sideImagesBlue = imagesBlue;
this.useDefaultValues = true;
}
@Override

View File

@ -12,6 +12,11 @@ public abstract class SideScanner {
// private BufferedImage sideImagesBlue[];
//
protected byte gammaDelta = ImageScanner.GAMMA_DELTA_DEFAULT;
protected double baseline = 0.0;
protected double minX = Double.NEGATIVE_INFINITY;
protected double maxX = Double.POSITIVE_INFINITY;
protected boolean useDefaultValues;
protected Point2D foundPoints[] = null;
//

View File

@ -9,18 +9,30 @@ public class SingleColoredSideScanner extends SideScanner {
private BufferedImage sideImages[];
byte gammaDelta = ImageScanner.GAMMA_DELTA_DEFAULT;
double baseline = 0.0;
double minX = Double.NEGATIVE_INFINITY;
double maxX = Double.POSITIVE_INFINITY;
boolean useDefaultValues;
Point2D foundPoints[] = null;
public SingleColoredSideScanner(BufferedImage[] images, byte gammaDelta) {
public SingleColoredSideScanner(BufferedImage[] images, byte gammaDelta, double baseline, double minX, double maxX) {
this.sideImages = images;
this.gammaDelta = gammaDelta;
this.baseline = baseline;
this.minX = minX;
this.maxX = maxX;
this.useDefaultValues = false;
}
// Everything default values
public SingleColoredSideScanner(BufferedImage[] images) {
this.sideImages = images;
this.useDefaultValues = true;
}
@Override
@ -30,8 +42,13 @@ public class SingleColoredSideScanner extends SideScanner {
foundPoints = new Point2D[imagesLength];
for (int i = 0; i < imagesLength; i++) {
//TODO
//foundPoints[i] = ImageScanner.getBrightestSpot(sideImages[i], this.gammaDelta);
if (this.useDefaultValues) {
//TODO
//foundPoints[i] = ImageScanner.getBrightestSpot(sideImages[i]);
} else {
//TODO
//foundPoints[i] = ImageScanner.getBrightestSpot(sideImages[i], this.gammaDelta);
}
}
}

View File

@ -41,7 +41,6 @@ public class ExampleTest {
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.normalize();
homo.merge();
homo.renormalize();
Point3D points[] = homo.getPoints();