use of boofcv.struct.image.ImageGray in project BoofCV by lessthanoptimal.
the class TestImplGradientToEdgeFeatures method direction2.
public void direction2(Method m) throws InvocationTargetException, IllegalAccessException {
Class derivType = m.getParameterTypes()[0];
ImageGray derivX = GeneralizedImageOps.createSingleBand(derivType, width, height);
ImageGray derivY = GeneralizedImageOps.createSingleBand(derivType, width, height);
GImageMiscOps.fillUniform(derivX, rand, -20, 20);
GImageMiscOps.fillUniform(derivY, rand, -20, 20);
GrayF32 angle = new GrayF32(width, height);
BoofTesting.checkSubImage(this, "direction2", false, m, derivX, derivY, angle);
}
use of boofcv.struct.image.ImageGray in project BoofCV by lessthanoptimal.
the class TestImplGradientToEdgeFeatures method intensityAbs.
public void intensityAbs(Method m) throws InvocationTargetException, IllegalAccessException {
Class derivType = m.getParameterTypes()[0];
ImageGray derivX = GeneralizedImageOps.createSingleBand(derivType, width, height);
ImageGray derivY = GeneralizedImageOps.createSingleBand(derivType, width, height);
GImageMiscOps.fillUniform(derivX, rand, -20, 20);
GImageMiscOps.fillUniform(derivY, rand, -20, 20);
GrayF32 intensity = new GrayF32(width, height);
BoofTesting.checkSubImage(this, "intensityAbs", false, m, derivX, derivY, intensity);
}
use of boofcv.struct.image.ImageGray in project BoofCV by lessthanoptimal.
the class TestImplGradientToEdgeFeatures method direction.
public void direction(Method m) throws InvocationTargetException, IllegalAccessException {
Class derivType = m.getParameterTypes()[0];
ImageGray derivX = GeneralizedImageOps.createSingleBand(derivType, width, height);
ImageGray derivY = GeneralizedImageOps.createSingleBand(derivType, width, height);
GImageMiscOps.fillUniform(derivX, rand, -20, 20);
GImageMiscOps.fillUniform(derivY, rand, -20, 20);
GrayF32 angle = new GrayF32(width, height);
BoofTesting.checkSubImage(this, "direction", false, m, derivX, derivY, angle);
}
use of boofcv.struct.image.ImageGray in project BoofCV by lessthanoptimal.
the class TestGHistogramFeatureOps method histogram_sb.
@Test
public void histogram_sb() {
for (Class type : supported) {
ImageGray image = GeneralizedImageOps.createSingleBand(type, width, height);
GImageMiscOps.fillUniform(image, rand, 0, 200);
TupleDesc_F64 found = new TupleDesc_F64(200);
TupleDesc_F64 expected = new TupleDesc_F64(200);
GHistogramFeatureOps.histogram(image, 0, 200, found);
if (type == GrayF32.class) {
HistogramFeatureOps.histogram((GrayF32) image, 0, 200, expected);
} else {
HistogramFeatureOps.histogram((GrayU8) image, 200, expected);
}
assertEquals(0, DescriptorDistance.euclidean(expected, found), 1e-8);
}
}
use of boofcv.struct.image.ImageGray in project BoofCV by lessthanoptimal.
the class TestGlobalOtsuBinaryFilter method compare.
@Test
public void compare() {
Class[] imageTypes = new Class[] { GrayU8.class, GrayF32.class };
for (Class type : imageTypes) {
ImageGray input = GeneralizedImageOps.createSingleBand(type, 30, 40);
GrayU8 found = new GrayU8(30, 40);
GrayU8 expected = new GrayU8(30, 40);
GImageMiscOps.fillUniform(input, rand, 0, 200);
GlobalOtsuBinaryFilter alg = new GlobalOtsuBinaryFilter(0, 255, true, ImageType.single(type));
alg.process(input, found);
double threshold = GThresholdImageOps.computeOtsu(input, 0, 255);
GThresholdImageOps.threshold(input, expected, threshold, true);
BoofTesting.assertEquals(found, expected, 0);
}
}
Aggregations