fixed grammar error and changed some code for debugging
This commit is contained in:
parent
d322503403
commit
d227dfbc66
@ -33,7 +33,7 @@ public class ImageScanner {
|
|||||||
|
|
||||||
// The following line might be incorrect; TODO double check and write a test
|
// The following line might be incorrect; TODO double check and write a test
|
||||||
Point2D brightPoints[] = brightSpots.stream()
|
Point2D brightPoints[] = brightSpots.stream()
|
||||||
.map(s -> new Point2D.Double(s.intValue() % grayScaleImage.getWidth(), s.intValue() / grayScaleImage.getWidth()))
|
.map(s -> new Point2D.Double(s.intValue() % grayScaleImage.getWidth(), s.intValue() / grayScaleImage.getWidth())) // https://softwareengineering.stackexchange.com/questions/212808/treating-a-1d-data-structure-as-2d-grid
|
||||||
.toArray(Point2D.Double[]::new);
|
.toArray(Point2D.Double[]::new);
|
||||||
|
|
||||||
Point2D brightestSpot = new PointInterpolator(brightPoints).getCenter();
|
Point2D brightestSpot = new PointInterpolator(brightPoints).getCenter();
|
||||||
@ -57,15 +57,17 @@ public class ImageScanner {
|
|||||||
|
|
||||||
PointInterpolator brightestSpot;
|
PointInterpolator brightestSpot;
|
||||||
|
|
||||||
// Get the center between the two closest points; a better implementation would
|
brightestSpot = new PointInterpolator(brightestRedSpot);
|
||||||
// work with a confidentnes-value
|
|
||||||
if (RGdistance < GBdistance && RGdistance < BRdistance) {
|
// // Get the center between the two closest points; a better implementation would
|
||||||
brightestSpot = new PointInterpolator(brightestRedSpot, brightestGreenSpot);
|
// // work on a confidentnes-value
|
||||||
} else if (GBdistance < RGdistance && GBdistance < BRdistance) {
|
// if (RGdistance < GBdistance && RGdistance < BRdistance) {
|
||||||
brightestSpot = new PointInterpolator(brightestGreenSpot, brightestBlueSpot);
|
// brightestSpot = new PointInterpolator(brightestRedSpot, brightestGreenSpot);
|
||||||
} else {
|
// } else if (GBdistance < RGdistance && GBdistance < BRdistance) {
|
||||||
brightestSpot = new PointInterpolator(brightestBlueSpot, brightestRedSpot);
|
// brightestSpot = new PointInterpolator(brightestGreenSpot, brightestBlueSpot);
|
||||||
}
|
// } else {
|
||||||
|
// brightestSpot = new PointInterpolator(brightestBlueSpot, brightestRedSpot);
|
||||||
|
// }
|
||||||
|
|
||||||
return brightestSpot.getCenter();
|
return brightestSpot.getCenter();
|
||||||
}
|
}
|
||||||
|
@ -10,8 +10,8 @@ public class PointInterpolator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Point2D getCenter() {
|
Point2D getCenter() {
|
||||||
int xSum = 0;
|
double xSum = 0;
|
||||||
int ySum = 0;
|
double ySum = 0;
|
||||||
|
|
||||||
for(int i = 0; i < points.length; i++) {
|
for(int i = 0; i < points.length; i++) {
|
||||||
xSum += points[i].getX();
|
xSum += points[i].getX();
|
||||||
|
Loading…
Reference in New Issue
Block a user