@Override public InterleavedF32 createNew(int imgWidth, int imgHeight) { if (imgWidth == -1 || imgHeight == -1) return new InterleavedF32(); return new InterleavedF32(imgWidth, imgHeight, numBands); }
public ThresholdBlockMinMax_F32(float minimumSpread, ConfigLength requestedBlockWidth, float scale , boolean down , boolean thresholdFromLocalBlocks) { super(minimumSpread,requestedBlockWidth,thresholdFromLocalBlocks,GrayF32.class); stats = new InterleavedF32(1,1,2); this.scale = scale; this.down = down; }
@Override public void initialize(int imageWidth, int imageHeight, int sensorOrientation) { grayF = new GrayF32(imageWidth,imageHeight); transform = new InterleavedF32(imageWidth,imageHeight,2); }
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); }
/** * Converts an NV21 image into a {@link InterleavedF32} RGB image. * * @param data Input: NV21 image data * @param width Input: NV21 image width * @param height Input: NV21 image height * @param output Output: Optional storage for output image. Can be null. */ public static InterleavedF32 nv21ToInterleaved( byte[] data , int width , int height , InterleavedF32 output ) { if( output == null ) { output = new InterleavedF32(width,height,3); } else if( output.width != width || output.height != height ) throw new IllegalArgumentException("output width and height must be "+width+" "+height); else if( output.getNumBands() != 3 ) throw new IllegalArgumentException("three bands expected"); ImplConvertNV21.nv21ToInterleaved_F32(data, output); return output; } }
/** * <p> * Converts an {@link boofcv.struct.image.InterleavedS16} into a {@link boofcv.struct.image.InterleavedF32}. * </p> * * @param input Input image which is being converted. Not modified. * @param output (Optional) The output image. If null a new image is created. Modified. * @return Converted image. */ public static InterleavedF32 convert(InterleavedS16 input, InterleavedF32 output) { if (output == null) { output = new InterleavedF32(input.width, input.height, input.numBands); } else { output.reshape(input.width,input.height,input.numBands); } ImplConvertImage.convert(input, output); return output; }
public static InterleavedF32 yuvToInterleavedRgbF32(ByteBuffer bufferY, ByteBuffer bufferU , ByteBuffer bufferV , int width, int height, int strideY , int strideUV , int stridePixelUV, InterleavedF32 output , byte work[] ) { if( output != null ) { output.reshape(width,height,3); } else { output = new InterleavedF32(width,height,3); } InterleavedF32 _output = output; ProcessorYuv processor = new ProcessorYuvRgb() { int indexOut = 0; @Override public void processRGB( final int r , final int g , final int b ) { _output.data[indexOut++] = r; _output.data[indexOut++] = g; _output.data[indexOut++] = b; } }; processYuv(bufferY,bufferU,bufferV,width,height,strideY,strideUV,stridePixelUV,work,processor); return output; }
/** * <p> * Converts an {@link boofcv.struct.image.InterleavedU16} into a {@link boofcv.struct.image.InterleavedF32}. * </p> * * @param input Input image which is being converted. Not modified. * @param output (Optional) The output image. If null a new image is created. Modified. * @return Converted image. */ public static InterleavedF32 convert(InterleavedU16 input, InterleavedF32 output) { if (output == null) { output = new InterleavedF32(input.width, input.height, input.numBands); } else { output.reshape(input.width,input.height,input.numBands); } ImplConvertImage.convert(input, output); return output; }
/** * <p> * Converts an {@link boofcv.struct.image.InterleavedU8} into a {@link boofcv.struct.image.InterleavedF32}. * </p> * * @param input Input image which is being converted. Not modified. * @param output (Optional) The output image. If null a new image is created. Modified. * @return Converted image. */ public static InterleavedF32 convert(InterleavedU8 input, InterleavedF32 output) { if (output == null) { output = new InterleavedF32(input.width, input.height, input.numBands); } else { output.reshape(input.width,input.height,input.numBands); } ImplConvertImage.convert(input, output); return output; }
/** * <p> * Converts an {@link boofcv.struct.image.InterleavedS8} into a {@link boofcv.struct.image.InterleavedF32}. * </p> * * @param input Input image which is being converted. Not modified. * @param output (Optional) The output image. If null a new image is created. Modified. * @return Converted image. */ public static InterleavedF32 convert(InterleavedS8 input, InterleavedF32 output) { if (output == null) { output = new InterleavedF32(input.width, input.height, input.numBands); } else { output.reshape(input.width,input.height,input.numBands); } ImplConvertImage.convert(input, output); return output; }
/** * <p> * Converts an {@link boofcv.struct.image.InterleavedF64} into a {@link boofcv.struct.image.InterleavedF32}. * </p> * * @param input Input image which is being converted. Not modified. * @param output (Optional) The output image. If null a new image is created. Modified. * @return Converted image. */ public static InterleavedF32 convert(InterleavedF64 input, InterleavedF32 output) { if (output == null) { output = new InterleavedF32(input.width, input.height, input.numBands); } else { output.reshape(input.width,input.height,input.numBands); } ImplConvertImage.convert(input, output); return output; }
/** * <p> * Converts an {@link boofcv.struct.image.InterleavedS32} into a {@link boofcv.struct.image.InterleavedF32}. * </p> * * @param input Input image which is being converted. Not modified. * @param output (Optional) The output image. If null a new image is created. Modified. * @return Converted image. */ public static InterleavedF32 convert(InterleavedS32 input, InterleavedF32 output) { if (output == null) { output = new InterleavedF32(input.width, input.height, input.numBands); } else { output.reshape(input.width,input.height,input.numBands); } ImplConvertImage.convert(input, output); return output; }
/** * <p> * Converts an {@link boofcv.struct.image.InterleavedS64} into a {@link boofcv.struct.image.InterleavedF32}. * </p> * * @param input Input image which is being converted. Not modified. * @param output (Optional) The output image. If null a new image is created. Modified. * @return Converted image. */ public static InterleavedF32 convert(InterleavedS64 input, InterleavedF32 output) { if (output == null) { output = new InterleavedF32(input.width, input.height, input.numBands); } else { output.reshape(input.width,input.height,input.numBands); } ImplConvertImage.convert(input, output); return output; }
/** * Converts a {@link Planar} into the equivalent {@link InterleavedF32} * * @param input (Input) Planar image that is being converted. Not modified. * @param output (Optional) The output image. If null a new image is created. Modified. * @return Converted image. */ public static InterleavedF32 convert( Planar<GrayF32> input , InterleavedF32 output ) { if (output == null) { output = new InterleavedF32(input.width, input.height,input.getNumBands()); } else { output.reshape(input.width,input.height,input.getNumBands()); } ImplConvertImage.convert(input,output); return output; }
/** * Converts a {@link Planar} {@link GrayU8} into the equivalent {@link InterleavedF32} * * @param input (Input) ImageInterleaved that is being converted. Not modified. * @param output (Optional) The output image. If null a new image is created. Modified. * @return Converted image. */ public static InterleavedF32 convertU8F32(Planar<GrayU8> input , InterleavedF32 output ) { if (output == null) { output = new InterleavedF32(input.width,input.height,input.getNumBands()); } else { output.reshape(input.width,input.height,input.getNumBands()); } ImplConvertImage.convertU8F32(input,output); return output; } }
/** * 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 static <T extends ImageInterleaved<T>> T createInterleaved(Class<T> type, int width, int height , int numBands) { type = BoofTesting.convertGenericToSpecificType(type); if (type == InterleavedU8.class) { return (T)new InterleavedU8(width, height,numBands); } else if (type == InterleavedS8.class) { return (T)new InterleavedS8(width, height,numBands); } else if (type == InterleavedU16.class) { return (T)new InterleavedU16(width, height,numBands); } else if (type == InterleavedS16.class) { return (T)new InterleavedS16(width, height,numBands); } else if (type == InterleavedS32.class) { return (T)new InterleavedS32(width, height,numBands); } else if (type == InterleavedS64.class) { return (T)new InterleavedS64(width, height,numBands); } else if (type == InterleavedF32.class) { return (T)new InterleavedF32(width, height,numBands); } else if (type == InterleavedF64.class) { return (T)new InterleavedF64(width, height,numBands); } else if( (Class)type == ImageInterleaved.class ) { // ImageInteger is a generic type, so just create something return (T)new InterleavedS32(width,height,numBands); } throw new RuntimeException("Unknown type: "+type.getSimpleName()); }
/** * 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 transform Used to apply motion model * @param interpType Type of interpolation. BILINEAR recommended for accuracy. NEAREST_NEIGHBOR for speed. . * @param imageType Type of input image. */ public BackgroundMovingGaussian_IL(float learnRate, float threshold, Point2Transform2Model_F32<Motion> transform, InterpolationType interpType, ImageType<T> imageType) { super(learnRate, threshold, transform, imageType); int numBands = imageType.getNumBands(); this.interpolateInput = FactoryInterpolation.createPixelMB(0, 255, InterpolationType.BILINEAR, BorderType.EXTENDED, imageType); background = new InterleavedF32(1,1,2*numBands); this.interpolationBG = FactoryInterpolation.createPixelMB( 0, 255, interpType, BorderType.EXTENDED, ImageType.il(numBands*2, InterleavedF32.class)); this.interpolationBG.setImage(background); inputWrapper = FactoryGImageMultiBand.create(imageType); pixelBG = new float[2*numBands]; pixelInput = new float[numBands]; }
InterleavedF32 storageTL = new InterleavedF32(hw1,hh1,2); storageTL.setTo(transform.subimage(0, 0, hw1, hh1, null)); InterleavedF32 storageTR = new InterleavedF32(hw,hh1,2); storageTR.setTo(transform.subimage(hw1, 0, w, hh1, null)); transform.subimage(0,hh,hw,h, null).setTo(storageTR); } else { InterleavedF32 storageBL = new InterleavedF32(hw,hh1,2); storageBL.setTo(transform.subimage(0, hh, hw, h, null)); InterleavedF32 storageBR = new InterleavedF32(hw1,hh1,2); storageBR.setTo(transform.subimage(hw, hh, w, h, null));