void filterIntensity(ImageProcessor ip) { ColorProcessor cp = (ColorProcessor)ip; int width = cp.getWidth(); int height = cp.getHeight(); int size = width*height; byte[] H = new byte[size]; byte[] S = new byte[size]; byte[] B = new byte[size]; cp.getHSB(H, S, B); ImageProcessor ip2 = new ByteProcessor(width, height, B, null); filter(ip2); cp.setHSB(H, S, (byte[])ip2.getPixels()); }
/** Returns an ImageStack with three 8-bit slices, representing hue, saturation and brightness */ public ImageStack getHSBStack() { int width = getWidth(); int height = getHeight(); byte[] H = new byte[width*height]; byte[] S = new byte[width*height]; byte[] B = new byte[width*height]; getHSB(H, S, B); ColorModel cm = getDefaultColorModel(); ImageStack stack = new ImageStack(width, height, cm); stack.addSlice("Hue", H); stack.addSlice("Saturation", S); stack.addSlice("Brightness", B); return stack; }
/** Create or subtract a background, based on the brightness of an RGB image (keeping * the hue of each pixel unchanged) * @param ip The RGB image. On output, it will become the background-subtracted image or * the background (depending on <code>createBackground</code>). * @param radius Radius of the rolling ball creating the background (actually a * paraboloid of rotation with the same curvature) * @param createBackground Whether to create a background, not to subtract it. * @param lightBackground Whether the image has a light background. * @param doPresmooth Whether the image should be smoothened (3x3 mean) before creating * the background. With smoothing, the background will not necessarily * be below the image data. * @param correctCorners Whether the algorithm should try to detect corner particles to avoid * subtracting them as a background. */ public void rollingBallBrightnessBackground(ColorProcessor ip, double radius, boolean createBackground, boolean lightBackground, boolean useParaboloid, boolean doPresmooth, boolean correctCorners) { int width = ip.getWidth(); int height = ip.getHeight(); byte[] H = new byte[width*height]; byte[] S = new byte[width*height]; byte[] B = new byte[width*height]; ip.getHSB(H, S, B); ByteProcessor bp = new ByteProcessor(width, height, B, null); rollingBallBackground(bp, radius, createBackground, lightBackground, useParaboloid, doPresmooth, correctCorners); ip.setHSB(H, S, (byte[])bp.getPixels()); }
/** Returns an ImageStack with three 8-bit slices, representing hue, saturation and brightness */ public ImageStack getHSBStack() { int width = getWidth(); int height = getHeight(); byte[] H = new byte[width*height]; byte[] S = new byte[width*height]; byte[] B = new byte[width*height]; getHSB(H, S, B); ColorModel cm = getDefaultColorModel(); ImageStack stack = new ImageStack(width, height, cm); stack.addSlice("Hue", H); stack.addSlice("Saturation", S); stack.addSlice("Brightness", B); return stack; }
/** Create or subtract a background, based on the brightness of an RGB image (keeping * the hue of each pixel unchanged) * @param ip The RGB image. On output, it will become the background-subtracted image or * the background (depending on <code>createBackground</code>). * @param radius Radius of the rolling ball creating the background (actually a * paraboloid of rotation with the same curvature) * @param createBackground Whether to create a background, not to subtract it. * @param lightBackground Whether the image has a light background. * @param doPresmooth Whether the image should be smoothened (3x3 mean) before creating * the background. With smoothing, the background will not necessarily * be below the image data. * @param correctCorners Whether the algorithm should try to detect corner particles to avoid * subtracting them as a background. */ public void rollingBallBrightnessBackground(ColorProcessor ip, double radius, boolean createBackground, boolean lightBackground, boolean useParaboloid, boolean doPresmooth, boolean correctCorners) { int width = ip.getWidth(); int height = ip.getHeight(); byte[] H = new byte[width*height]; byte[] S = new byte[width*height]; byte[] B = new byte[width*height]; ip.getHSB(H, S, B); ByteProcessor bp = new ByteProcessor(width, height, B, null); rollingBallBackground(bp, radius, createBackground, lightBackground, useParaboloid, doPresmooth, correctCorners); ip.setHSB(H, S, (byte[])bp.getPixels()); }
cp.getRGB(hSource,sSource,bSource); else if(colorSpace==HSB) cp.getHSB(hSource,sSource,bSource); else if(colorSpace==LAB) getLab(cp, hSource,sSource,bSource);
cp.getRGB(hSource,sSource,bSource); else if(colmode==0) cp.getHSB(hSource,sSource,bSource); else if(colmode==2) getLab(cp, hSource,sSource,bSource);
cp.getRGB(hSource,sSource,bSource); else if(colorSpace==HSB) cp.getHSB(hSource,sSource,bSource); else if(colorSpace==LAB) getLab(cp, hSource,sSource,bSource);
cp2.getRGB(hsSource,ssSource,bsSource); else if(colorSpace==HSB) cp2.getHSB(hsSource,ssSource,bsSource); else if(colorSpace==LAB) getLab(cp2, hsSource,ssSource,bsSource);
cp2.getRGB(hsSource,ssSource,bsSource); else if(colorSpace==HSB) cp2.getHSB(hsSource,ssSource,bsSource); else if(colorSpace==LAB) getLab(cp2, hsSource,ssSource,bsSource);
cp2.getRGB(hsSource,ssSource,bsSource); else if(colmode==0) cp2.getHSB(hsSource,ssSource,bsSource); else if(colmode==2) getLab(cp2, hsSource,ssSource,bsSource);