use of boofcv.struct.image.GrayU8 in project BoofCV by lessthanoptimal.
the class TestInputSanityCheck method checkShape_three.
@Test
public void checkShape_three() {
GrayU8 a = new GrayU8(imgWidth, imgHeight);
GrayU8 b = new GrayU8(imgWidth, imgHeight);
GrayU8 c = new GrayU8(imgWidth, imgHeight);
// InputSanityCheck test
InputSanityCheck.checkSameShape(a, b, c);
// negative test
try {
b = new GrayU8(imgWidth + 1, imgHeight);
InputSanityCheck.checkSameShape(a, b, c);
fail("Didn't throw an exception");
} catch (IllegalArgumentException e) {
}
try {
b = new GrayU8(imgWidth, imgHeight + 1);
InputSanityCheck.checkSameShape(a, b, c);
fail("Didn't throw an exception");
} catch (IllegalArgumentException e) {
}
b = new GrayU8(imgWidth, imgHeight);
try {
c = new GrayU8(imgWidth + 1, imgHeight);
InputSanityCheck.checkSameShape(a, b, c);
fail("Didn't throw an exception");
} catch (IllegalArgumentException e) {
}
try {
c = new GrayU8(imgWidth, imgHeight + 1);
InputSanityCheck.checkSameShape(a, b, c);
fail("Didn't throw an exception");
} catch (IllegalArgumentException e) {
}
}
use of boofcv.struct.image.GrayU8 in project BoofCV by lessthanoptimal.
the class TestInputSanityCheck method checkShape_two.
@Test
public void checkShape_two() {
GrayU8 a = new GrayU8(imgWidth, imgHeight);
GrayU8 b = new GrayU8(imgWidth, imgHeight);
// InputSanityCheck test
InputSanityCheck.checkSameShape(a, b);
// negative test
try {
b = new GrayU8(imgWidth + 1, imgHeight);
InputSanityCheck.checkSameShape(a, b);
fail("Didn't throw an exception");
} catch (IllegalArgumentException e) {
}
try {
b = new GrayU8(imgWidth, imgHeight + 1);
InputSanityCheck.checkSameShape(a, b);
fail("Didn't throw an exception");
} catch (IllegalArgumentException e) {
}
}
use of boofcv.struct.image.GrayU8 in project BoofCV by lessthanoptimal.
the class DetectLineHoughFootSubimage method processSubimage.
private void processSubimage(int x0, int y0, int x1, int y1, List<LineParametric2D_F32> found) {
D derivX = (D) this.derivX.subimage(x0, y0, x1, y1);
D derivY = (D) this.derivY.subimage(x0, y0, x1, y1);
GrayU8 binary = this.binary.subimage(x0, y0, x1, y1);
alg.transform(derivX, derivY, binary);
FastQueue<LineParametric2D_F32> lines = alg.extractLines();
float[] intensity = alg.getFoundIntensity();
for (int i = 0; i < lines.size; i++) {
// convert from the sub-image coordinate system to original image coordinate system
LineParametric2D_F32 l = lines.get(i).copy();
l.p.x += x0;
l.p.y += y0;
found.add(l);
post.add(l, intensity[i]);
}
}
use of boofcv.struct.image.GrayU8 in project BoofCV by lessthanoptimal.
the class FhEdgeWeights4_PLU8 method check.
private void check(int x, int y, int[] color0, int indexA, Planar<GrayU8> input, FastQueue<Edge> edges) {
if (!input.isInBounds(x, y))
return;
int indexSrc = input.startIndex + y * input.stride + x;
int indexB = +y * input.width + x;
float weight = 0;
for (int i = 0; i < numBands; i++) {
GrayU8 band = input.getBand(i);
int color = band.data[indexSrc] & 0xFF;
int diff = color0[i] - color;
weight += diff * diff;
}
Edge e1 = edges.grow();
e1.sortValue = (float) Math.sqrt(weight);
e1.indexA = indexA;
e1.indexB = indexB;
}
use of boofcv.struct.image.GrayU8 in project BoofCV by lessthanoptimal.
the class FhEdgeWeights8_PLU8 method checkAround.
private void checkAround(int x, int y, Planar<GrayU8> input, FastQueue<Edge> edges) {
int indexSrc = input.startIndex + y * input.stride + x;
int indexA = y * input.width + x;
for (int i = 0; i < numBands; i++) {
GrayU8 band = input.getBand(i);
pixelColor[i] = band.data[indexSrc] & 0xFF;
}
check(x + 1, y, pixelColor, indexA, input, edges);
check(x, y + 1, pixelColor, indexA, input, edges);
check(x + 1, y + 1, pixelColor, indexA, input, edges);
check(x - 1, y + 1, pixelColor, indexA, input, edges);
}
Aggregations