ColorProcessor ip = new ColorProcessor(ImageIO.read(new File("my_image.jpg"))); ip.findEdges(); BufferedImage bimg = ip.getBufferedImage();
final static public ColorProcessor paintMeshes( final Collection< SpringMesh > meshes, final double scale ) { final int width = ( int )( meshes.iterator().next().getWidth() * scale ); final int height = ( int )( meshes.iterator().next().getHeight() * scale ); final ColorProcessor ip = new ColorProcessor( width, height ); final BufferedImage bi = ip.getBufferedImage(); final Graphics2D g = bi.createGraphics(); g.setBackground( Color.WHITE ); g.clearRect( 0, 0, width, height ); g.setTransform( new AffineTransform( scale, 0, 0, scale, 0, 0 ) ); int i = 0; for ( final SpringMesh m : meshes ) { final Shape shape = m.illustrateMesh(); g.setColor( Util.createSaturatedColor( i++, meshes.size() ) ); g.draw( shape ); } return new ColorProcessor( bi ); } /* </visualization> */
final static public ColorProcessor paintMeshes( final Collection< SpringMesh > meshes, final double scale ) { final int width = ( int )( meshes.iterator().next().getWidth() * scale ); final int height = ( int )( meshes.iterator().next().getHeight() * scale ); final ColorProcessor ip = new ColorProcessor( width, height ); final BufferedImage bi = ip.getBufferedImage(); final Graphics2D g = bi.createGraphics(); g.setBackground( Color.WHITE ); g.clearRect( 0, 0, width, height ); g.setTransform( new AffineTransform( scale, 0, 0, scale, 0, 0 ) ); int i = 0; for ( final SpringMesh m : meshes ) { final Shape shape = m.illustrateMesh(); g.setColor( Util.createSaturatedColor( i++, meshes.size() ) ); g.draw( shape ); } return new ColorProcessor( bi ); } /* </visualization> */
/** Returns a copy of this image as an 8-bit or RGB BufferedImage. * @see ij.process.ShortProcessor#get16BitBufferedImage */ public BufferedImage getBufferedImage() { if (isComposite()) return (new ColorProcessor(getImage())).getBufferedImage(); else return ip.getBufferedImage(); }
/** Returns a copy of this image as an 8-bit or RGB BufferedImage. * @see ij.process.ShortProcessor#get16BitBufferedImage */ public BufferedImage getBufferedImage() { if (isComposite()) return (new ColorProcessor(getImage())).getBufferedImage(); else return ip.getBufferedImage(); }