@Override public int getNumBands() { return imageType.getNumBands(); }
public SegmentMeanShiftSearchColor(int maxIterations, float convergenceTol, InterpolatePixelMB<T> interpolate, int radiusX , int radiusY , float maxColorDistance , boolean fast, ImageType<T> imageType) { super(maxIterations,convergenceTol,radiusX,radiusY,maxColorDistance,fast); this.interpolate = interpolate; this.pixelColor = new float[ imageType.getNumBands() ]; this.meanColor = new float[ imageType.getNumBands() ]; this.sumColor = new float[ imageType.getNumBands() ]; this.imageType = imageType; final int numBands = imageType.getNumBands(); modeColor = new ColorQueue_F32(numBands); }
@Override public void setImage(InterleavedS16 image) { super.setImage(image); int N = image.getImageType().getNumBands(); if( pixel.length != N ) pixel = new int[ N ]; }
@Override public void setImage(InterleavedU8 image) { super.setImage(image); int N = image.getImageType().getNumBands(); if( pixel.length != N ) pixel = new int[ N ]; }
public BackgroundStationaryBasic_IL(float learnRate, float threshold, ImageType<T> imageType) { super(learnRate, threshold, imageType); int numBands = imageType.getNumBands(); background = new InterleavedF32(1, 1, numBands); inputWrapper = FactoryGImageMultiBand.create(imageType); }
public BackgroundStationaryBasic_PL(float learnRate, float threshold, ImageType<Planar<T>> imageType) { super(learnRate, threshold, imageType); int numBands = imageType.getNumBands(); background = new Planar<>(GrayF32.class,1,1,numBands); inputWrapper = FactoryGImageMultiBand.create(imageType); inputPixels = new float[numBands]; }
@Override public void setImage(InterleavedU16 image) { super.setImage(image); int N = image.getImageType().getNumBands(); if( pixel.length != N ) pixel = new int[ N ]; }
@Override public void setImage(InterleavedS32 image) { super.setImage(image); int N = image.getImageType().getNumBands(); if( pixel.length != N ) pixel = new int[ N ]; }
public static <T extends ImageMultiBand> PixelLikelihood<T> likelihoodHueSatHistIndependent( double maxPixelValue , int numHistogramBins , ImageType<T> imageType ) { if( imageType.getFamily() != ImageType.Family.PLANAR) throw new IllegalArgumentException("Only Planar images supported currently"); if( imageType.getNumBands() != 3 ) throw new IllegalArgumentException("Input image type must have 3 bands."); if( imageType.getDataType() == ImageDataType.U8 ) { return (PixelLikelihood)new LikelihoodHueSatHistInd_PL_U8((int)maxPixelValue,numHistogramBins); } else { throw new RuntimeException("Band type not yet supported "+imageType.getDataType()); } }
public static <T extends ImageMultiBand> PixelLikelihood<T> likelihoodHueSatHistCoupled( double maxPixelValue , int numHistogramBins , ImageType<T> imageType ) { if( imageType.getFamily() != ImageType.Family.PLANAR) throw new IllegalArgumentException("Only Planar images supported currently"); if( imageType.getNumBands() != 3 ) throw new IllegalArgumentException("Input image type must have 3 bands."); if( imageType.getDataType() == ImageDataType.U8 ) { return (PixelLikelihood)new LikelihoodHueSatHistCoupled_PL_U8((int)maxPixelValue,numHistogramBins); } else { throw new RuntimeException("Band type not yet supported "+imageType.getDataType()); } }
public static <In extends ImageBase<In>, Out extends ImageBase<Out>> ConvolveDown<In,Out> convolve(Kernel1D kernel, BorderType border , boolean isHorizontal , int skip , ImageType<In> inputType , ImageType<Out> outputType ) { switch( inputType.getFamily() ) { case PLANAR: return convolvePL(kernel, border, isHorizontal, skip, inputType.getNumBands(), inputType.getImageClass(), outputType.getImageClass()); case GRAY: return convolveSB(kernel, border, isHorizontal, skip, inputType.getImageClass(), outputType.getImageClass()); case INTERLEAVED: throw new IllegalArgumentException("Interleaved images are not yet supported"); } throw new IllegalArgumentException("Unknown image type"); }
public static <In extends ImageBase<In>, Out extends ImageBase<Out>> ConvolveDown<In,Out> convolve(Kernel2D kernel, BorderType border , int skip , ImageType<In> inputType , ImageType<Out> outputType ) { switch( inputType.getFamily() ) { case PLANAR: return convolvePL(kernel, border, skip, inputType.getNumBands(), inputType.getImageClass(), outputType.getImageClass()); case GRAY: return convolveSB(kernel, border, skip, inputType.getImageClass(), outputType.getImageClass()); case INTERLEAVED: throw new IllegalArgumentException("Interleaved images are not yet supported"); } throw new IllegalArgumentException("Unknown image type"); }
public static <T extends ImageBase> TrackerMeanShiftComaniciu2003<T> meanShiftComaniciu2003(ConfigComaniciu2003 config, ImageType<T> imageType ) { if( config == null ) config = new ConfigComaniciu2003(); InterpolatePixelMB<T> interp = FactoryInterpolation.createPixelMB(0,config.maxPixelValue, config.interpolation, BorderType.EXTENDED,imageType); LocalWeightedHistogramRotRect<T> hist = new LocalWeightedHistogramRotRect<>(config.numSamples, config.numSigmas, config.numHistogramBins, imageType.getNumBands(), config.maxPixelValue, interp); return new TrackerMeanShiftComaniciu2003<>( config.updateHistogram, config.meanShiftMaxIterations, config.meanShiftMinimumChange, config.scaleWeight, config.minimumSizeRatio, config.scaleChange, hist); } }
/** * Color variant of the SURF descriptor which has been designed for stability. * * @see DescribePointSurfPlanar * * @param config SURF configuration. Pass in null for default options. * @param imageType Type of input image. * @return SURF color description extractor */ public static <T extends ImageBase, II extends ImageGray> DescribeRegionPoint<T,BrightFeature> surfColorStable(ConfigSurfDescribe.Stability config, ImageType<T> imageType) { Class bandType = imageType.getImageClass(); Class<II> integralType = GIntegralImageOps.getIntegralType(bandType); DescribePointSurf<II> alg = FactoryDescribePointAlgs.surfStability( config, integralType); if( imageType.getFamily() == ImageType.Family.PLANAR) { DescribePointSurfPlanar<II> color = FactoryDescribePointAlgs.surfColor( alg,imageType.getNumBands()); return new SurfPlanar_to_DescribeRegionPoint(color,bandType,integralType); } else { throw new IllegalArgumentException("Unknown image type"); } }
/** * Color variant of the SURF descriptor which has been designed for speed and sacrifices some stability. * * @see DescribePointSurfPlanar * * @param config SURF configuration. Pass in null for default options. * @param imageType Type of input image. * @return SURF color description extractor */ public static <T extends ImageMultiBand, II extends ImageGray> DescribeRegionPoint<T,BrightFeature> surfColorFast(ConfigSurfDescribe.Speed config , ImageType<T> imageType) { Class bandType = imageType.getImageClass(); Class<II> integralType = GIntegralImageOps.getIntegralType(bandType); DescribePointSurf<II> alg = FactoryDescribePointAlgs.surfSpeed( config, integralType); if( imageType.getFamily() == ImageType.Family.PLANAR) { DescribePointSurfPlanar<II> color = FactoryDescribePointAlgs.surfColor( alg,imageType.getNumBands()); return new SurfPlanar_to_DescribeRegionPoint(color,bandType,integralType); } else { throw new IllegalArgumentException("Unknown image type"); } }
/** * Configurations background removal. * * @param learnRate Specifies how quickly the background is updated. 0 = static 1.0 = instant. Try 0.05 * @param threshold Threshold for background. Consult a chi-square table for reasonably values. * 10 to 16 for 1 to 3 bands. * @param imageType Type of input image. */ public BackgroundStationaryGaussian_PL(float learnRate, float threshold, ImageType<Planar<T>> imageType) { super(learnRate, threshold, imageType); int numBands = imageType.getNumBands(); background = new Planar<>(GrayF32.class,1,1,2*numBands); bgWrapper = FactoryGImageMultiBand.create(background.getImageType()); bgWrapper.wrap(background); inputWrapper = FactoryGImageMultiBand.create(imageType); inputPixel = new float[numBands]; }
public static <I extends ImageBase<I>, D extends ImageBase<D>> ImageType<D> getDerivativeType( ImageType<I> imageType ) { switch( imageType.getFamily() ) { case GRAY: return ImageType.single(getDerivativeType(imageType.getImageClass())); case PLANAR: { int numBands = imageType.getNumBands(); return ImageType.pl(numBands, getDerivativeType(imageType.getImageClass())); } case INTERLEAVED: int numBands = imageType.getNumBands(); switch ( imageType.getDataType() ) { case F32: return (ImageType)ImageType.il(numBands, ImageDataType.F32); case F64: return (ImageType)ImageType.il(numBands, ImageDataType.F64); case U8: return (ImageType)ImageType.il(numBands, ImageDataType.S16); case U16: return (ImageType)ImageType.il(numBands, ImageDataType.S32); } } throw new IllegalArgumentException("Unknown image type"); }
/** * Configurations background removal. * * @param learnRate Specifies how quickly the background is updated. 0 = static 1.0 = instant. Try 0.05 * @param threshold Threshold for background. Consult a chi-square table for reasonably values. * 10 to 16 for 1 to 3 bands. * @param imageType Type of input image. */ public BackgroundStationaryGaussian_IL(float learnRate, float threshold, ImageType<T> imageType) { super(learnRate, threshold, imageType); int numBands = imageType.getNumBands(); background = new InterleavedF32(1,1,2*numBands); bgWrapper = FactoryGImageMultiBand.create(background.getImageType()); bgWrapper.wrap(background); inputWrapper = FactoryGImageMultiBand.create(imageType); inputPixel = new float[numBands]; bgPixel = new float[numBands*2]; }
public BackgroundMovingBasic_IL(float learnRate, float threshold, Point2Transform2Model_F32<Motion> transform, InterpolationType interpType, ImageType<T> imageType) { super(learnRate, threshold,transform, imageType); this.interpolationInput = FactoryInterpolation.createPixelMB(0, 255, interpType,BorderType.EXTENDED,imageType); int numBands = imageType.getNumBands(); background = new InterleavedF32(1,1,numBands); this.interpolationBG = FactoryInterpolation.createPixelMB( 0, 255, interpType, BorderType.EXTENDED, ImageType.il(numBands, InterleavedF32.class)); this.interpolationBG.setImage(background); pixelInput = new float[numBands]; pixelBack = new float[numBands]; inputWrapper = FactoryGImageMultiBand.create(imageType); }
public BackgroundMovingBasic_PL(float learnRate, float threshold, Point2Transform2Model_F32<Motion> transform, InterpolationType interpType, ImageType<Planar<T>> imageType) { super(learnRate, threshold,transform, imageType); this.interpolationInput = FactoryInterpolation.createPixelMB(0, 255, interpType,BorderType.EXTENDED,imageType); int numBands = imageType.getNumBands(); background = new Planar<>(GrayF32.class,1,1,numBands); this.interpolationBG = FactoryInterpolation.createPixelMB( 0, 255, interpType, BorderType.EXTENDED, ImageType.pl(numBands, GrayF32.class)); this.interpolationBG.setImage(background); pixelInput = new float[numBands]; pixelBack = new float[numBands]; backgroundWrapper = FactoryGImageMultiBand.create(ImageType.pl(numBands, GrayF32.class)); backgroundWrapper.wrap(background); inputWrapper = FactoryGImageMultiBand.create(imageType); }