boofcv.factory.feature.describe.FactoryDescribePointAlgs Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of boofcv-feature Show documentation
Show all versions of boofcv-feature Show documentation
BoofCV is an open source Java library for real-time computer vision and robotics applications.
/*
* Copyright (c) 2011-2018, Peter Abeles. All Rights Reserved.
*
* This file is part of BoofCV (http://boofcv.org).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package boofcv.factory.feature.describe;
import boofcv.abst.feature.describe.ConfigSiftDescribe;
import boofcv.abst.feature.describe.ConfigSurfDescribe;
import boofcv.abst.filter.blur.BlurFilter;
import boofcv.alg.feature.describe.*;
import boofcv.alg.feature.describe.brief.BinaryCompareDefinition_I32;
import boofcv.alg.feature.describe.impl.*;
import boofcv.alg.interpolate.InterpolatePixelS;
import boofcv.core.image.border.BorderType;
import boofcv.factory.interpolate.FactoryInterpolation;
import boofcv.struct.feature.TupleDesc;
import boofcv.struct.image.GrayF32;
import boofcv.struct.image.GrayU8;
import boofcv.struct.image.ImageGray;
import javax.annotation.Nullable;
/**
* Creates algorithms for describing point features.
*
* @author Peter Abeles
*/
@SuppressWarnings({"unchecked"})
public class FactoryDescribePointAlgs {
public static >
DescribePointSurf surfSpeed(@Nullable ConfigSurfDescribe.Speed config, Class imageType) {
if( config == null )
config = new ConfigSurfDescribe.Speed();
config.checkValidity();
return new DescribePointSurf<>(config.widthLargeGrid, config.widthSubRegion, config.widthSample,
config.weightSigma, config.useHaar, imageType);
}
public static >
DescribePointSurfMod surfStability(@Nullable ConfigSurfDescribe.Stability config, Class imageType) {
if( config == null )
config = new ConfigSurfDescribe.Stability();
config.checkValidity();
return new DescribePointSurfMod<>(config.widthLargeGrid, config.widthSubRegion, config.widthSample,
config.overLap, config.sigmaLargeGrid, config.sigmaSubRegion, config.useHaar, imageType);
}
public static >
DescribePointSurfPlanar surfColor(DescribePointSurf describe , int numBands ) {
return new DescribePointSurfPlanar<>(describe, numBands);
}
public static >
DescribePointBrief brief(BinaryCompareDefinition_I32 definition, BlurFilter filterBlur ) {
Class imageType = filterBlur.getInputType().getImageClass();
DescribePointBinaryCompare compare;
if( imageType == GrayF32.class ) {
compare = (DescribePointBinaryCompare )new ImplDescribeBinaryCompare_F32(definition);
} else if( imageType == GrayU8.class ) {
compare = (DescribePointBinaryCompare )new ImplDescribeBinaryCompare_U8(definition);
} else {
throw new IllegalArgumentException("Unknown image type: "+imageType.getSimpleName());
}
return new DescribePointBrief<>(compare, filterBlur);
}
// todo remove filterBlur for all BRIEF change to radius,sigma,type
public static >
DescribePointBriefSO briefso(BinaryCompareDefinition_I32 definition, BlurFilter filterBlur) {
Class imageType = filterBlur.getInputType().getImageClass();
InterpolatePixelS interp = FactoryInterpolation.bilinearPixelS(imageType, BorderType.EXTENDED);
return new DescribePointBriefSO<>(definition, filterBlur, interp);
}
public static >
DescribePointSift sift(@Nullable ConfigSiftDescribe config , Class derivType ) {
if( config == null )
config = new ConfigSiftDescribe();
return new DescribePointSift(config.widthSubregion,config.widthGrid,config.numHistogramBins
,config.sigmaToPixels, config.weightingSigmaFraction,config.maxDescriptorElementValue,derivType);
}
public static , D extends TupleDesc>
DescribePointPixelRegion pixelRegion( int regionWidth , int regionHeight , Class imageType )
{
if( imageType == GrayF32.class ) {
return (DescribePointPixelRegion)new ImplDescribePointPixelRegion_F32(regionWidth,regionHeight);
} else if( imageType == GrayU8.class ) {
return (DescribePointPixelRegion)new ImplDescribePointPixelRegion_U8(regionWidth,regionHeight);
} else {
throw new IllegalArgumentException("Unsupported image type");
}
}
public static >
DescribePointPixelRegionNCC pixelRegionNCC( int regionWidth , int regionHeight , Class imageType )
{
if( imageType == GrayF32.class ) {
return (DescribePointPixelRegionNCC)new ImplDescribePointPixelRegionNCC_F32(regionWidth,regionHeight);
} else if( imageType == GrayU8.class ) {
return (DescribePointPixelRegionNCC)new ImplDescribePointPixelRegionNCC_U8(regionWidth,regionHeight);
} else {
throw new IllegalArgumentException("Unsupported image type");
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy