use of org.ddogleg.struct.DogArray_I32 in project BoofCV by lessthanoptimal.
the class TestEnhanceImageOps method equalizeLocal.
public void equalizeLocal(GrayI input, GrayI found) {
GrayI expected = (GrayI) GeneralizedImageOps.createSingleBand(input.getClass(), input.width, input.height);
GImageMiscOps.fillUniform(input, rand, 0, 9);
GrowArray<DogArray_I32> workArrays = new GrowArray<>(DogArray_I32::new);
for (int radius = 1; radius < 11; radius++) {
BoofTesting.callStaticMethod(ImplEnhanceHistogram.class, "equalizeLocalNaive", input, radius, histogramLength, expected, workArrays);
BoofTesting.callStaticMethod(EnhanceImageOps.class, "equalizeLocal", input, radius, found, histogramLength, workArrays);
BoofTesting.assertEquals(expected, found, 1e-10);
}
}
use of org.ddogleg.struct.DogArray_I32 in project BoofCV by lessthanoptimal.
the class TestImplEnhanceHistogram method equalizeLocalRow.
public void equalizeLocalRow(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);
// check the top row
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, "equalizeLocalRow", input, radius, histogramLength, 0, found, workArrays);
GrayI subExpected = (GrayI) expected.subimage(0, 0, width, radius, null);
GrayI subFound = (GrayI) found.subimage(0, 0, width, radius, null);
// check solution
BoofTesting.assertEquals(subExpected, subFound, 1e-10);
checkZeroOutsideRows(found, 0, radius);
}
// check the bottom row
for (int radius = 1; radius < 6; radius++) {
// fill with zeros so it can be tested using checkBorderZero
GImageMiscOps.fill(found, 0);
int start = input.height - radius;
BoofTesting.callStaticMethod(ImplEnhanceHistogram.class, "equalizeLocalNaive", input, radius, histogramLength, expected, workArrays);
BoofTesting.callStaticMethod(ImplEnhanceHistogram.class, "equalizeLocalRow", input, radius, histogramLength, start, found, workArrays);
GrayI subExpected = (GrayI) expected.subimage(0, start, width, height, null);
GrayI subFound = (GrayI) found.subimage(0, start, width, height, null);
// check solution
BoofTesting.assertEquals(subExpected, subFound, 1e-10);
checkZeroOutsideRows(found, start, height);
}
}
use of org.ddogleg.struct.DogArray_I32 in project BoofCV by lessthanoptimal.
the class TestBinaryThinning method findBlackPixels.
private void findBlackPixels(GrayU8 img) {
DogArray_I32 marked = new DogArray_I32();
BinaryThinning alg = new BinaryThinning();
alg.binary = img;
alg.findOnePixels(marked);
assertEquals(2, marked.size());
assertEquals(img.getIndex(4, 1), marked.get(0));
assertEquals(img.getIndex(2, 3), marked.get(1));
}
use of org.ddogleg.struct.DogArray_I32 in project BoofCV by lessthanoptimal.
the class TestImplCensusTransformInner method sample_IU16.
void sample_IU16(Method m) throws InvocationTargetException, IllegalAccessException {
Class inputType = m.getParameterTypes()[0];
ImageGray input = GeneralizedImageOps.createSingleBand(inputType, w, h);
InterleavedU16 found = new InterleavedU16(w, h, 2);
InterleavedU16 expected = new InterleavedU16(w, h, 2);
fillUniform(input);
DogArray<Point2D_I32> samples5x5 = createSamples(2);
DogArray_I32 indexes = samplesToIndexes(input, samples5x5);
m.invoke(null, input, 2, indexes, found);
CensusNaive.sample(input, samples5x5, expected);
BoofTesting.assertEqualsInner(expected, found, 0, 2, 2, 2, 2, false);
}
use of org.ddogleg.struct.DogArray_I32 in project BoofCV by lessthanoptimal.
the class TestImplCensusTransformInner method samplesToIndexes.
public static DogArray_I32 samplesToIndexes(ImageGray input, DogArray<Point2D_I32> samples) {
DogArray_I32 indexes = new DogArray_I32();
for (int i = 0; i < samples.size; i++) {
Point2D_I32 p = samples.get(i);
indexes.add(p.y * input.stride + p.x);
}
return indexes;
}
Aggregations