/** Returns a new, blank ByteProcessor with the specified width and height. */ public ImageProcessor createProcessor(int width, int height) { ImageProcessor ip2; ip2 = new ByteProcessor(width, height, new byte[width*height], getColorModel()); if (baseCM!=null) ip2.setMinAndMax(min, max); ip2.setInterpolationMethod(interpolationMethod); return ip2; }
/** Returns a new, blank ByteProcessor with the specified width and height. */ public ImageProcessor createProcessor(int width, int height) { ImageProcessor ip2; ip2 = new ByteProcessor(width, height, new byte[width*height], getColorModel()); if (baseCM!=null) ip2.setMinAndMax(min, max); ip2.setInterpolationMethod(interpolationMethod); return ip2; }
/** Creates a BinaryProcessor from a ByteProcessor. The ByteProcessor must contain a binary image (pixels values are either 0 or 255). Backgound is assumed to be white. */ public BinaryProcessor(ByteProcessor ip) { super(ip.getWidth(), ip.getHeight(), (byte[])ip.getPixels(), ip.getColorModel()); setRoi(ip.getRoi()); parent = ip; }
/** Creates a BinaryProcessor from a ByteProcessor. The ByteProcessor must contain a binary image (pixels values are either 0 or 255). Backgound is assumed to be white. */ public BinaryProcessor(ByteProcessor ip) { super(ip.getWidth(), ip.getHeight(), (byte[])ip.getPixels(), ip.getColorModel()); setRoi(ip.getRoi()); parent = ip; }
/** A method that circumvents the findMinAndMax when creating a float processor from an existing processor. Ignores color calibrations and does no scaling at all. */ static public final FloatProcessor fastConvertToFloat(final ByteProcessor ip) { final byte[] pix = (byte[])ip.getPixels(); final float[] data = new float[pix.length]; for (int i=0; i<pix.length; i++) data[i] = pix[i]&0xff; final FloatProcessor fp = new FloatProcessorT2(ip.getWidth(), ip.getHeight(), data, ip.getColorModel(), ip.getMin(), ip.getMax()); return fp; } /** A method that circumvents the findMinAndMax when creating a float processor from an existing processor. Ignores color calibrations and does no scaling at all. */
setTransparent(false); ByteProcessor pg = new ByteProcessor(image.getImage()); ColorModel cm = pg.getColorModel(); if (cm instanceof IndexColorModel) indexedPixels = (byte[])(pg.getPixels());
setTransparent(false); ByteProcessor pg = new ByteProcessor(image.getImage()); ColorModel cm = pg.getColorModel(); if (cm instanceof IndexColorModel) indexedPixels = (byte[])(pg.getPixels());
final long[] ima = FastIntegralImage.longIntegralImage((byte[])alpha.getPixels(), w, h); final byte[] balpha = FastIntegralImage.scaleAreaAverage(ima, w + 1, h + 1, tw, th); bpa = new ByteProcessor(tw, th, balpha, alpha.getColorModel()); final long[] imo = FastIntegralImage.longIntegralImage((byte[])outside.getPixels(), w, h); final byte[] boutside = FastIntegralImage.scaleAreaAverage(imo, w + 1, h + 1, tw, th); bpo = new ByteProcessor(tw, th, boutside, alpha.getColorModel());