@Override public void initialize(int imageWidth, int imageHeight, int sensorOrientation) { pixelToRegion = new GrayS32(imageWidth,imageHeight); background = new Planar<>(GrayU8.class, imageWidth, imageHeight, 3); }
@Override public void initialize(int imageWidth, int imageHeight, int sensorOrientation) { binary = new GrayU8(imageWidth,imageHeight); filtered1 = new GrayU8(imageWidth,imageHeight); contourOutput = new GrayS32(imageWidth,imageHeight); paint.setStyle(Paint.Style.STROKE); paint.setStrokeWidth(3f*cameraToDisplayDensity); paint.setColor(Color.RED); }
@Override public void initialize(int imageWidth, int imageHeight, int sensorOrientation) { ImageDimension d = UtilWavelet.transformDimension(imageWidth, imageHeight, waveletTran.getLevels() ); transform = new GrayS32(d.width,d.height); }
/** * <p> * Converts an {@link boofcv.struct.image.GrayS8} into a {@link boofcv.struct.image.GrayS32}. * </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 GrayS32 convert(GrayS8 input, GrayS32 output) { if (output == null) { output = new GrayS32(input.width, input.height); } else { output.reshape(input.width,input.height); } ImplConvertImage.convert(input, output); return output; }
/** * <p> * Converts an {@link boofcv.struct.image.GrayU16} into a {@link boofcv.struct.image.GrayS32}. * </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 GrayS32 convert(GrayU16 input, GrayS32 output) { if (output == null) { output = new GrayS32(input.width, input.height); } else { output.reshape(input.width,input.height); } ImplConvertImage.convert(input, output); return output; }
/** * <p> * Converts an {@link boofcv.struct.image.GrayF64} into a {@link boofcv.struct.image.GrayS32}. * </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 GrayS32 convert(GrayF64 input, GrayS32 output) { if (output == null) { output = new GrayS32(input.width, input.height); } else { output.reshape(input.width,input.height); } ImplConvertImage.convert(input, output); return output; }
/** * Converts a {@link Planar} into a {@link ImageGray} by computing the average value of each pixel * across all the bands. * * @param input Input Planar image that is being converted. Not modified. * @param output (Optional) The single band output image. If null a new image is created. Modified. * @return Converted image. */ public static GrayS32 average( Planar<GrayS32> input , GrayS32 output ) { if (output == null) { output = new GrayS32(input.width, input.height); } else { output.reshape(input.width,input.height); } ImplConvertPlanarToGray.average(input, output); return output; }
/** * <p> * Converts an {@link boofcv.struct.image.GrayF32} into a {@link boofcv.struct.image.GrayS32}. * </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 GrayS32 convert(GrayF32 input, GrayS32 output) { if (output == null) { output = new GrayS32(input.width, input.height); } else { output.reshape(input.width,input.height); } ImplConvertImage.convert(input, output); return output; }
/** * Converts a {@link InterleavedS32} into a {@link GrayS32} by computing the average value of each pixel * across all the bands. * * @param input (Input) The ImageInterleaved that is being converted. Not modified. * @param output (Optional) The single band output image. If null a new image is created. Modified. * @return Converted image. */ public static GrayS32 average( InterleavedS32 input , GrayS32 output ) { if (output == null) { output = new GrayS32(input.width, input.height); } else { output.reshape(input.width,input.height); } ConvertInterleavedToSingle.average(input, output); return output; }
/** * <p> * Converts an {@link boofcv.struct.image.GrayU8} into a {@link boofcv.struct.image.GrayS32}. * </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 GrayS32 convert(GrayU8 input, GrayS32 output) { if (output == null) { output = new GrayS32(input.width, input.height); } else { output.reshape(input.width,input.height); } ImplConvertImage.convert(input, output); return output; }
/** * <p> * Converts an {@link boofcv.struct.image.GrayS16} into a {@link boofcv.struct.image.GrayS32}. * </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 GrayS32 convert(GrayS16 input, GrayS32 output) { if (output == null) { output = new GrayS32(input.width, input.height); } else { output.reshape(input.width,input.height); } ImplConvertImage.convert(input, output); return output; }
/** * <p> * Converts an {@link boofcv.struct.image.GrayS64} into a {@link boofcv.struct.image.GrayS32}. * </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 GrayS32 convert(GrayS64 input, GrayS32 output) { if (output == null) { output = new GrayS32(input.width, input.height); } else { output.reshape(input.width,input.height); } ImplConvertImage.convert(input, output); return output; }
public static GrayS32 convertToImage(Kernel2D_S32 kernel ) { int w = kernel.getWidth(); GrayS32 ret = new GrayS32(w,w); for( int i = 0; i < w; i++ ) { for( int j = 0; j < w; j++ ) { ret.set(j,i,kernel.get(j,i)); } } return ret; }
public static <T extends ImageGray<T>> T createSingleBand(Class<T> type, int width, int height) { type = BoofTesting.convertGenericToSpecificType(type); if (type == GrayU8.class) { return (T)new GrayU8(width, height); } else if (type == GrayS8.class) { return (T)new GrayS8(width, height); } else if (type == GrayS16.class) { return (T)new GrayS16(width, height); } else if (type == GrayU16.class) { return (T)new GrayU16(width, height); } else if (type == GrayS32.class) { return (T)new GrayS32(width, height); } else if (type == GrayS64.class) { return (T)new GrayS64(width, height); } else if (type == GrayF32.class) { return (T)new GrayF32(width, height); } else if (type == GrayF64.class) { return (T)new GrayF64(width, height); } else if( (Class)type == GrayI.class ) { // ImageInteger is a generic type, so just create something return (T)new GrayS32(width,height); } throw new RuntimeException("Unknown type: "+type.getSimpleName()); }
/** * Constructor which specifies the input image type. * * @param imageType Either {@link GrayU8} or {@link GrayF32} */ public TldVarianceFilter( Class<T> imageType ) { // declare integral images. if(GeneralizedImageOps.isFloatingPoint(imageType) ) { integral = new GrayF32(1,1); integralSq = new GrayF64(1,1); } else { integral = new GrayS32(1,1); integralSq = new GrayS64(1,1); } }
public static <T extends ImageGray<T>> T create(Class<T> type , int width , int height ) { if( type == GrayU8.class) { return (T)new GrayU8(width,height); } else if( type == GrayS8.class) { return (T)new GrayS8(width,height); } else if( type == GrayU16.class) { return (T)new GrayU16(width,height); } else if( type == GrayS16.class) { return (T)new GrayS16(width,height); } else if( type == GrayS32.class) { return (T)new GrayS32(width,height); } else if( type == GrayF32.class) { return (T)new GrayF32(width,height); } else{ throw new IllegalArgumentException("Unknown image type: "+type); } } }
output = new GrayS32(input.width,input.height); } else { InputSanityCheck.checkSameShape(input,output);
@Override public GrayS32 transform(T original, GrayS32 transformed) { if( transformed == null ) { ImageDimension d = UtilWavelet.transformDimension(original,numLevels); transformed = new GrayS32(d.width,d.height); } temp.reshape(transformed.width,transformed.height); copyInput.reshape(original.width,original.height); if( original.getDataType().getDataType() == int.class ) { copyInput.setTo((GrayS32)original); } else { GConvertImage.convert(original, copyInput); } WaveletTransformOps.transformN(desc, copyInput,transformed,temp,numLevels); return transformed; }
public DemoBinaryBlobLabelOpsApp(Class<T> imageType) { super(3); this.imageType = imageType; addAlgorithm(0,"Erode-4", FactoryBinaryImageOps.erode4()); addAlgorithm(0,"Erode-8", FactoryBinaryImageOps.erode8()); addAlgorithm(0,"Dilate-4", FactoryBinaryImageOps.dilate4()); addAlgorithm(0,"Dilate-8", FactoryBinaryImageOps.dilate8()); addAlgorithm(0,"Remove Noise", FactoryBinaryImageOps.removePointNoise()); addAlgorithm(1,"Erode-4", FactoryBinaryImageOps.erode4()); addAlgorithm(1,"Erode-8", FactoryBinaryImageOps.erode8()); addAlgorithm(1,"Dilate-4", FactoryBinaryImageOps.dilate4()); addAlgorithm(1,"Dilate-8", FactoryBinaryImageOps.dilate8()); addAlgorithm(1,"Remove Noise", FactoryBinaryImageOps.removePointNoise()); addAlgorithm(2, "Label-4", 4); addAlgorithm(2, "Label-8", 8); JPanel body = new JPanel(); body.setLayout(new BorderLayout()); body.add(createControlPanel(),BorderLayout.NORTH); body.add(gui,BorderLayout.CENTER); imageInput = GeneralizedImageOps.createSingleBand(imageType, 1, 1); imageBinary = new GrayU8(1,1); imageOutput1 = new GrayU8(1,1); imageOutput2 = new GrayU8(1,1); imageLabeled = new GrayS32(1,1); selectedVisualize = imageLabeled; setMainGUI(body); }