/** * <p> * Converts an {@link boofcv.struct.image.InterleavedS32} into a {@link boofcv.struct.image.InterleavedU8}. * </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 InterleavedU8 convert(InterleavedS32 input, InterleavedU8 output) { if (output == null) { output = new InterleavedU8(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.InterleavedU8}. * </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 InterleavedU8 convert(InterleavedF64 input, InterleavedU8 output) { if (output == null) { output = new InterleavedU8(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.InterleavedU8}. * </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 InterleavedU8 convert(InterleavedS64 input, InterleavedU8 output) { if (output == null) { output = new InterleavedU8(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.InterleavedF32} into a {@link boofcv.struct.image.InterleavedU8}. * </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 InterleavedU8 convert(InterleavedF32 input, InterleavedU8 output) { if (output == null) { output = new InterleavedU8(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.InterleavedU8}. * </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 InterleavedU8 convert(InterleavedS8 input, InterleavedU8 output) { if (output == null) { output = new InterleavedU8(input.width, input.height, input.numBands); } else { output.reshape(input.width,input.height,input.numBands); } ImplConvertImage.convert(input, output); return output; }
public static InterleavedU8 yuvToInterleavedRgbU8(ByteBuffer bufferY, ByteBuffer bufferU , ByteBuffer bufferV , int width, int height, int strideY , int strideUV , int stridePixelUV, InterleavedU8 output , byte work[] ) { if( output != null ) { output.reshape(width,height,3); } else { output = new InterleavedU8(width,height,3); } InterleavedU8 _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++] = (byte)r; _output.data[indexOut++] = (byte)g; _output.data[indexOut++] = (byte)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.InterleavedU8}. * </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 InterleavedU8 convert(InterleavedU16 input, InterleavedU8 output) { if (output == null) { output = new InterleavedU8(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.InterleavedS16} into a {@link boofcv.struct.image.InterleavedU8}. * </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 InterleavedU8 convert(InterleavedS16 input, InterleavedU8 output) { if (output == null) { output = new InterleavedU8(input.width, input.height, input.numBands); } else { output.reshape(input.width,input.height,input.numBands); } ImplConvertImage.convert(input, output); return output; }
public void process( BufferedImage image , Gaussian3D_F64 model ) { binary.reshape(image.getWidth(),image.getHeight()); colorRGB.reshape(image.getWidth(),image.getHeight()); ConvertBufferedImage.convertFrom(image, colorRGB, true); GaussianColorClassifier.classify(colorRGB,model,12,binary); int color = 0xe394bb; for( int y = 0; y < binary.height; y++ ) { for( int x = 0; x < binary.width; x++ ) { int[] data = new int[1]; binary.get(x,y, data); if( data[0] != 0 ) { image.setRGB(x,y,color); } } } ShowImages.showWindow(image,"Segmented"); }
public static InterleavedU8 yuvToInterleavedYuvU8(ByteBuffer bufferY, ByteBuffer bufferU , ByteBuffer bufferV , int width, int height, int strideY , int strideUV , int stridePixelUV, InterleavedU8 output , byte work[] ) { if( output != null ) { output.reshape(width,height,3); } else { output = new InterleavedU8(width,height,3); } final byte[] data = output.data; ProcessorYuv processor = new ProcessorYuv() { int indexOut = 0; @Override final public void processYUV(final int y, final int u, final int v) { data[indexOut++] = (byte)y; data[indexOut++] = (byte)u; data[indexOut++] = (byte)v; } }; processYuv(bufferY,bufferU,bufferV,width,height,strideY,strideUV,stridePixelUV,work,processor); return output; } }
/** * Converts a {@link Planar} {@link GrayF32} into the equivalent {@link InterleavedU8} * * @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 InterleavedU8 convertF32U8(Planar<GrayF32> input , InterleavedU8 output ) { if (output == null) { output = new InterleavedU8(input.width,input.height,input.getNumBands()); } else { output.reshape(input.width,input.height,input.getNumBands()); } ImplConvertImage.convertF32U8(input,output); return output; }
this.binary = binary; changed.reshape(binary.width,binary.height);
/** * Converts a {@link Planar} into the equivalent {@link InterleavedU8} * * @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 InterleavedU8 convert( Planar<GrayU8> input , InterleavedU8 output ) { if (output == null) { output = new InterleavedU8(input.width, input.height,input.getNumBands()); } else { output.reshape(input.width,input.height,input.getNumBands()); } ImplConvertImage.convert(input,output); return output; }
this.binary = binary; changed.reshape(binary.width,binary.height);