Revert the previous two commits
This commit is contained in:
parent
edcea3bd82
commit
04a2d79653
@ -12,28 +12,19 @@ public class FourSidedScanner extends SingleColorScanner {
|
|||||||
private SideScanner behindSideScanner;
|
private SideScanner behindSideScanner;
|
||||||
private SideScanner leftSideScanner;
|
private SideScanner leftSideScanner;
|
||||||
|
|
||||||
BufferedImage frontSideImages[];
|
|
||||||
BufferedImage rightSideImages[];
|
|
||||||
BufferedImage behindSideImages[];
|
|
||||||
BufferedImage leftSideImages[];
|
|
||||||
|
|
||||||
public FourSidedScanner(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
|
//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
|
@Override
|
||||||
public Homograph scan() {
|
public Homograph scan() {
|
||||||
frontSideScanner = new SingleColoredSideScanner(frontSideImages, this.gammaDelta);
|
// TODO Auto-generated method stub
|
||||||
rightSideScanner = new SingleColoredSideScanner(rightSideImages, this.gammaDelta);
|
|
||||||
behindSideScanner = new SingleColoredSideScanner(behindSideImages, this.gammaDelta);
|
|
||||||
leftSideScanner = new SingleColoredSideScanner(leftSideImages, this.gammaDelta);
|
|
||||||
|
|
||||||
frontSideScanner.scan();
|
frontSideScanner.scan();
|
||||||
frontSideScanner.normalizePoints();
|
frontSideScanner.normalizePoints();
|
||||||
Point2D[] frontPoints = frontSideScanner.getPoints();
|
Point2D[] frontPoints = frontSideScanner.getPoints();
|
||||||
@ -50,6 +41,6 @@ public class FourSidedScanner extends SingleColorScanner {
|
|||||||
leftSideScanner.normalizePoints();
|
leftSideScanner.normalizePoints();
|
||||||
Point2D[] leftSidePoints = leftSideScanner.getPoints();
|
Point2D[] leftSidePoints = leftSideScanner.getPoints();
|
||||||
|
|
||||||
return new Homograph4(frontPoints, rightSidePoints, behindSidePoints, leftSidePoints);
|
return new Homograph4(rightSidePoints, rightSidePoints, behindSidePoints, leftSidePoints);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,8 @@
|
|||||||
package com.cringe_studios.christmastreescanning;
|
package com.cringe_studios.christmastreescanning;
|
||||||
|
|
||||||
|
import java.awt.geom.Point2D;
|
||||||
|
|
||||||
public interface Homograph {
|
public interface Homograph {
|
||||||
void normalize(Double baseline, Double minX, Double maxX);
|
|
||||||
default void normalize() {
|
|
||||||
normalize(null, null, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
void merge();
|
void merge();
|
||||||
void renormalize();
|
void renormalize();
|
||||||
Point3D[] getPoints();
|
Point3D[] getPoints();
|
||||||
|
@ -65,10 +65,4 @@ public class Homograph2 implements Homograph{
|
|||||||
public Point3D[] getPoints() {
|
public Point3D[] getPoints() {
|
||||||
return Arrays.stream(homographs).map(i -> i.getPoint()).toArray(Point3D[]::new);
|
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
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -45,10 +45,4 @@ public class Homograph4 implements Homograph{
|
|||||||
public Point3D[] getPoints() {
|
public Point3D[] getPoints() {
|
||||||
return internalHomograph.getPoints();
|
return internalHomograph.getPoints();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void normalize(Double baseline, Double minX, Double maxX) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package com.cringe_studios.christmastreescanning;
|
|||||||
|
|
||||||
public class Point3D {
|
public class Point3D {
|
||||||
public double x; // baseline
|
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 double z; // The height
|
||||||
|
|
||||||
public Point3D(double nx, double ny, double nz) {
|
public Point3D(double nx, double ny, double nz) {
|
||||||
|
@ -26,7 +26,6 @@ public abstract class Scanner {
|
|||||||
// BufferedImage leftSideImagesBlue[];
|
// BufferedImage leftSideImagesBlue[];
|
||||||
|
|
||||||
protected byte gammaDelta = ImageScanner.GAMMA_DELTA_DEFAULT;
|
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 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
|
// 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;
|
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
|
// * @param useDistinctRGBImages if this parameter is true, you have to use the IMAGE_*_RED/_GREEN/_BLUE enum types in the setData method
|
||||||
|
@ -21,8 +21,8 @@ public class TwoSidedScanner extends SingleColorScanner {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Homograph scan() {
|
public Homograph scan() {
|
||||||
frontSideScanner = new SingleColoredSideScanner(frontSideImages, this.gammaDelta);
|
frontSideScanner = new SingleColoredSideScanner(frontSideImages, this.gammaDelta, , , );
|
||||||
rightSideScanner = new SingleColoredSideScanner(rightSideImages, this.gammaDelta);
|
rightSideScanner = new SingleColoredSideScanner(rightSideImages, this.gammaDelta, , , );
|
||||||
|
|
||||||
frontSideScanner.scan();
|
frontSideScanner.scan();
|
||||||
frontSideScanner.normalizePoints();
|
frontSideScanner.normalizePoints();
|
||||||
|
@ -11,16 +11,26 @@ public class MultiColoredSideScanner extends SideScanner{
|
|||||||
private BufferedImage sideImagesBlue[];
|
private BufferedImage sideImagesBlue[];
|
||||||
|
|
||||||
byte gammaDelta = ImageScanner.GAMMA_DELTA_DEFAULT;
|
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;
|
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
|
if(!(imagesRed.length == imagesGreen.length && imagesGreen.length == imagesBlue.length)); // TODO error
|
||||||
this.sideImagesRed = imagesRed;
|
this.sideImagesRed = imagesRed;
|
||||||
this.sideImagesGreen = imagesGreen;
|
this.sideImagesGreen = imagesGreen;
|
||||||
this.sideImagesBlue = imagesBlue;
|
this.sideImagesBlue = imagesBlue;
|
||||||
|
|
||||||
this.gammaDelta = gammaDelta;
|
this.gammaDelta = gammaDelta;
|
||||||
|
this.baseline = baseline;
|
||||||
|
this.minX = minX;
|
||||||
|
this.maxX = maxX;
|
||||||
|
|
||||||
|
this.useDefaultValues = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MultiColoredSideScanner(BufferedImage[] imagesRed, BufferedImage[] imagesGreen, BufferedImage[] imagesBlue) {
|
public MultiColoredSideScanner(BufferedImage[] imagesRed, BufferedImage[] imagesGreen, BufferedImage[] imagesBlue) {
|
||||||
@ -29,6 +39,8 @@ public class MultiColoredSideScanner extends SideScanner{
|
|||||||
this.sideImagesRed = imagesRed;
|
this.sideImagesRed = imagesRed;
|
||||||
this.sideImagesGreen = imagesGreen;
|
this.sideImagesGreen = imagesGreen;
|
||||||
this.sideImagesBlue = imagesBlue;
|
this.sideImagesBlue = imagesBlue;
|
||||||
|
|
||||||
|
this.useDefaultValues = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -12,6 +12,11 @@ public abstract class SideScanner {
|
|||||||
// private BufferedImage sideImagesBlue[];
|
// private BufferedImage sideImagesBlue[];
|
||||||
//
|
//
|
||||||
protected byte gammaDelta = ImageScanner.GAMMA_DELTA_DEFAULT;
|
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;
|
protected Point2D foundPoints[] = null;
|
||||||
//
|
//
|
||||||
|
@ -9,18 +9,30 @@ public class SingleColoredSideScanner extends SideScanner {
|
|||||||
private BufferedImage sideImages[];
|
private BufferedImage sideImages[];
|
||||||
|
|
||||||
byte gammaDelta = ImageScanner.GAMMA_DELTA_DEFAULT;
|
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;
|
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.sideImages = images;
|
||||||
|
|
||||||
this.gammaDelta = gammaDelta;
|
this.gammaDelta = gammaDelta;
|
||||||
|
this.baseline = baseline;
|
||||||
|
this.minX = minX;
|
||||||
|
this.maxX = maxX;
|
||||||
|
|
||||||
|
this.useDefaultValues = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Everything default values
|
// Everything default values
|
||||||
public SingleColoredSideScanner(BufferedImage[] images) {
|
public SingleColoredSideScanner(BufferedImage[] images) {
|
||||||
this.sideImages = images;
|
this.sideImages = images;
|
||||||
|
|
||||||
|
this.useDefaultValues = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -30,8 +42,13 @@ public class SingleColoredSideScanner extends SideScanner {
|
|||||||
foundPoints = new Point2D[imagesLength];
|
foundPoints = new Point2D[imagesLength];
|
||||||
|
|
||||||
for (int i = 0; i < imagesLength; i++) {
|
for (int i = 0; i < imagesLength; i++) {
|
||||||
//TODO
|
if (this.useDefaultValues) {
|
||||||
//foundPoints[i] = ImageScanner.getBrightestSpot(sideImages[i], this.gammaDelta);
|
//TODO
|
||||||
|
//foundPoints[i] = ImageScanner.getBrightestSpot(sideImages[i]);
|
||||||
|
} else {
|
||||||
|
//TODO
|
||||||
|
//foundPoints[i] = ImageScanner.getBrightestSpot(sideImages[i], this.gammaDelta);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,6 @@ public class ExampleTest {
|
|||||||
Scanner scanner = new TwoSidedScanner(new BufferedImage[] {LED1Front, LED2Front, LED3Front}, new BufferedImage[] {LED1Right, LED2Right, LED3Right});
|
Scanner scanner = new TwoSidedScanner(new BufferedImage[] {LED1Front, LED2Front, LED3Front}, new BufferedImage[] {LED1Right, LED2Right, LED3Right});
|
||||||
scanner.setGammaDelta((byte)(0.1 * 255));
|
scanner.setGammaDelta((byte)(0.1 * 255));
|
||||||
Homograph homo = scanner.scan();
|
Homograph homo = scanner.scan();
|
||||||
homo.normalize();
|
|
||||||
homo.merge();
|
homo.merge();
|
||||||
homo.renormalize();
|
homo.renormalize();
|
||||||
Point3D points[] = homo.getPoints();
|
Point3D points[] = homo.getPoints();
|
||||||
|
Loading…
Reference in New Issue
Block a user