Search in sources :

Example 1 with ConfigDenseHoG

use of boofcv.factory.feature.dense.ConfigDenseHoG in project BoofCV by lessthanoptimal.

the class ExampleDenseImageFeatures method LowLevelHOG.

public static void LowLevelHOG(GrayF32 input) {
    DescribeDenseHogFastAlg<GrayF32> describer = FactoryDescribeImageDenseAlg.hogFast(new ConfigDenseHoG(), ImageType.single(GrayF32.class));
    // The low level API gives you access to more information about the image. You can explicitly traverse it
    // by rows and columns, and access the histogram for a region. The histogram has an easy to understand
    // physical meaning.
    describer.setInput(input);
    describer.process();
    // Let's print a few parameters just because we can. They can be modified using the configuration class passed in
    System.out.println("\n------------------- HOG Low Level");
    System.out.println("HOG pixels per cell " + describer.getPixelsPerCell());
    System.out.println("HOG region width " + describer.getRegionWidthPixelX());
    System.out.println("HOG region height " + describer.getRegionWidthPixelY());
    System.out.println("HOG bins " + describer.getOrientationBins());
    for (int i = 0; i < describer.getCellRows(); i++) {
        for (int j = 0; j < describer.getCellCols(); j++) {
            DescribeDenseHogFastAlg.Cell c = describer.getCell(i, j);
        // this is where you could do processing on an individual cell
        }
    }
}
Also used : GrayF32(boofcv.struct.image.GrayF32) ConfigDenseHoG(boofcv.factory.feature.dense.ConfigDenseHoG) DescribeDenseHogFastAlg(boofcv.alg.feature.dense.DescribeDenseHogFastAlg)

Example 2 with ConfigDenseHoG

use of boofcv.factory.feature.dense.ConfigDenseHoG in project BoofCV by lessthanoptimal.

the class ExampleDenseImageFeatures method HighLevel.

// Here's an example of how to use the high level interface. There are a variety of algorithms to choose from
// For much larger images you might need to shrink the image down or change the cell size to get good results.
public static void HighLevel(GrayF32 input) {
    System.out.println("\n------------------- Dense High Level");
    DescribeImageDense<GrayF32, TupleDesc_F64> describer = FactoryDescribeImageDense.hog(new ConfigDenseHoG(), input.getImageType());
    // sift(new ConfigDenseSift(),GrayF32.class);
    // surfFast(new ConfigDenseSurfFast(),GrayF32.class);
    // process the image and compute the dense image features
    describer.process(input);
    // print out part of the first few features
    System.out.println("Total Features = " + describer.getLocations().size());
    for (int i = 0; i < 5; i++) {
        Point2D_I32 p = describer.getLocations().get(i);
        TupleDesc_F64 d = describer.getDescriptions().get(i);
        System.out.printf("%3d %3d = [ %f %f %f %f\n", p.x, p.y, d.value[0], d.value[1], d.value[2], d.value[3]);
    // You would process the feature descriptor here
    }
}
Also used : GrayF32(boofcv.struct.image.GrayF32) TupleDesc_F64(boofcv.struct.feature.TupleDesc_F64) ConfigDenseHoG(boofcv.factory.feature.dense.ConfigDenseHoG) Point2D_I32(georegression.struct.point.Point2D_I32)

Example 3 with ConfigDenseHoG

use of boofcv.factory.feature.dense.ConfigDenseHoG in project BoofCV by lessthanoptimal.

the class VisualizeImageHogCellApp method createHoG.

private void createHoG(ImageType<T> imageType) {
    ConfigDenseHoG config = new ConfigDenseHoG();
    config.pixelsPerCell = control.cellWidth;
    config.orientationBins = control.histogram;
    hog = FactoryDescribeImageDenseAlg.hogFast(config, imageType);
}
Also used : ConfigDenseHoG(boofcv.factory.feature.dense.ConfigDenseHoG)

Example 4 with ConfigDenseHoG

use of boofcv.factory.feature.dense.ConfigDenseHoG in project BoofCV by lessthanoptimal.

the class TestDescribeImageDenseHoG method checkSampleLocations.

/**
 * Checks to see if valid locations are returned.  Very simple test.  Can't test descriptor correctness since
 * there isn't a sparse HOG yet.
 */
@Test
public void checkSampleLocations() {
    ConfigDenseHoG config = new ConfigDenseHoG();
    config.fastVariant = true;
    check(config);
    config.fastVariant = false;
    check(config);
}
Also used : ConfigDenseHoG(boofcv.factory.feature.dense.ConfigDenseHoG) Test(org.junit.Test)

Aggregations

ConfigDenseHoG (boofcv.factory.feature.dense.ConfigDenseHoG)4 GrayF32 (boofcv.struct.image.GrayF32)2 DescribeDenseHogFastAlg (boofcv.alg.feature.dense.DescribeDenseHogFastAlg)1 TupleDesc_F64 (boofcv.struct.feature.TupleDesc_F64)1 Point2D_I32 (georegression.struct.point.Point2D_I32)1 Test (org.junit.Test)1