use of boofcv.abst.filter.derivative.ImageGradient in project BoofCV by lessthanoptimal.
the class GeneralGradientSparse method compareToFullImage_Border.
@Test
public void compareToFullImage_Border() {
ImageBorder border = FactoryImageBorder.single(imageType, BorderType.EXTENDED);
ImageGradient gradient = createGradient();
gradient.setBorderType(BorderType.EXTENDED);
gradient.process(image, derivX, derivY);
SparseImageGradient alg = createAlg(border);
alg.setImage(image);
for (int i = 0; i < image.height; i++) {
for (int j = 0; j < image.width; j++) {
assertTrue(j + " " + i, image.isInBounds(j, i));
GradientValue g = alg.compute(j, i);
double expectedX = GeneralizedImageOps.get(derivX, j, i);
double expectedY = GeneralizedImageOps.get(derivY, j, i);
assertEquals(expectedX, g.getX(), 1e-4f);
assertEquals(expectedY, g.getY(), 1e-4f);
}
}
}
use of boofcv.abst.filter.derivative.ImageGradient in project BoofCV by lessthanoptimal.
the class TestSfot_to_TrackObjectQuad method create.
@Override
public TrackerObjectQuad<GrayU8> create(ImageType<GrayU8> imageType) {
Class ct = ImageDataType.typeToSingleClass(imageType.getDataType());
Class dt = GImageDerivativeOps.getDerivativeType(ct);
ImageGradient gradient = FactoryDerivative.sobel(ct, dt);
SfotConfig config = new SfotConfig();
SparseFlowObjectTracker tracker = new SparseFlowObjectTracker(config, ct, dt, gradient);
return new Sfot_to_TrackObjectQuad(tracker, ct);
}
use of boofcv.abst.filter.derivative.ImageGradient in project BoofCV by lessthanoptimal.
the class FactoryOrientation method convertImage.
/**
* Adds wrappers around implementations of {@link RegionOrientation} such that they can be used
* as a {@link OrientationImage}.
*
* @param algorithm Algorithm which takes in a different type of input.
* @param imageType Type of input image it will process
* @return Wrapped version which can process images as its raw input.
*/
public static <T extends ImageGray<T>> OrientationImage<T> convertImage(RegionOrientation algorithm, Class<T> imageType) {
if (algorithm instanceof OrientationGradient) {
Class derivType = ((OrientationGradient) algorithm).getImageType();
ImageGradient gradient = FactoryDerivative.sobel(imageType, derivType);
return new OrientationGradientToImage((OrientationGradient) algorithm, gradient, imageType, derivType);
} else if (algorithm instanceof OrientationIntegral) {
Class integralType = GIntegralImageOps.getIntegralType(imageType);
return new OrientationIntegralToImage((OrientationIntegral) algorithm, imageType, integralType);
} else {
throw new IllegalArgumentException("Unknown orientation algorithm type");
}
}
Aggregations