use of pabeles.concurrency.GrowArray in project BoofCV by lessthanoptimal.
the class TestImplEnhanceHistogram method equalizeLocalInner.
public void equalizeLocalInner(GrayI input, GrayI found) {
GrayI expected = GeneralizedImageOps.createSingleBand(input.getClass(), input.width, input.height);
GrowArray<DogArray_I32> workArrays = new GrowArray<>(DogArray_I32::new);
GImageMiscOps.fillUniform(input, rand, 0, 9);
for (int radius = 1; radius < 6; radius++) {
// fill with zeros so it can be tested using checkBorderZero
GImageMiscOps.fill(found, 0);
BoofTesting.callStaticMethod(ImplEnhanceHistogram.class, "equalizeLocalNaive", input, radius, histogramLength, expected, workArrays);
BoofTesting.callStaticMethod(ImplEnhanceHistogram.class, "equalizeLocalInner", input, radius, histogramLength, found, workArrays);
BoofTesting.assertEqualsInner(expected, found, 1e-10, radius, radius, false);
BoofTesting.checkBorderZero(found, radius);
}
}
use of pabeles.concurrency.GrowArray in project BoofCV by lessthanoptimal.
the class TestImplEnhanceHistogram method equalizeLocalCol.
public void equalizeLocalCol(GrayI input, GrayI found) {
GrayI expected = GeneralizedImageOps.createSingleBand(input.getClass(), input.width, input.height);
GrowArray<DogArray_I32> workArrays = new GrowArray<>(DogArray_I32::new);
GImageMiscOps.fillUniform(input, rand, 1, 9);
// check the left column
for (int radius = 1; radius < 6; radius++) {
// fill with zeros so it can be tested using checkBorderZero
GImageMiscOps.fill(found, 0);
BoofTesting.callStaticMethod(ImplEnhanceHistogram.class, "equalizeLocalNaive", input, radius, histogramLength, expected, workArrays);
BoofTesting.callStaticMethod(ImplEnhanceHistogram.class, "equalizeLocalCol", input, radius, histogramLength, 0, found, workArrays);
GrayI subExpected = (GrayI) expected.subimage(0, radius, radius, height - radius - 1, null);
GrayI subFound = (GrayI) found.subimage(0, radius, radius, height - radius - 1, null);
// check solution
BoofTesting.assertEquals(subExpected, subFound, 1e-10);
checkZeroOutsideColumns(found, 0, radius, radius);
}
// check the right column
for (int radius = 1; radius < 6; radius++) {
// fill with zeros so it can be tested using checkBorderZero
GImageMiscOps.fill(found, 0);
int start = input.width - radius;
BoofTesting.callStaticMethod(ImplEnhanceHistogram.class, "equalizeLocalNaive", input, radius, histogramLength, expected, workArrays);
BoofTesting.callStaticMethod(ImplEnhanceHistogram.class, "equalizeLocalCol", input, radius, histogramLength, start, found, workArrays);
GrayI subExpected = (GrayI) expected.subimage(start, radius, width, height - radius - 1, null);
GrayI subFound = (GrayI) found.subimage(start, radius, width, height - radius - 1, null);
// check solution
BoofTesting.assertEquals(subExpected, subFound, 1e-10);
checkZeroOutsideColumns(found, start, width, radius);
}
}
Aggregations