Search in sources :

Example 6 with GrowArray

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);
    }
}
Also used : GrowArray(pabeles.concurrency.GrowArray) GrayI(boofcv.struct.image.GrayI) DogArray_I32(org.ddogleg.struct.DogArray_I32)

Example 7 with GrowArray

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);
    }
}
Also used : GrowArray(pabeles.concurrency.GrowArray) GrayI(boofcv.struct.image.GrayI) DogArray_I32(org.ddogleg.struct.DogArray_I32)

Aggregations

GrowArray (pabeles.concurrency.GrowArray)7 GrayI (boofcv.struct.image.GrayI)5 DogArray_I32 (org.ddogleg.struct.DogArray_I32)5 GrayF32 (boofcv.struct.image.GrayF32)1 GrayF64 (boofcv.struct.image.GrayF64)1 ImageBase (boofcv.struct.image.ImageBase)1 Method (java.lang.reflect.Method)1 Test (org.junit.jupiter.api.Test)1