public static BufferedImage getStitchImageDevig( final int stitch, final int scale, final int color) throws IOException { File file = new File( String.format( "%s/stitch-image-devig/%d/%d/%d.png", Cache.CACHE.getAbsolutePath(), stitch, scale, color)); if (file.exists()) return ImageIO.read(file); StitchStackProperties stack = getStitchStackProperties(); BufferedImage[] images = new BufferedImage[stack.getImageSetProperties(stitch).getNumImages()]; for (int image = 0; image != images.length; ++image) images[image] = MetalTools.toImage(getColorComponentDevig(stitch, image, color), 128); BufferedImage result = Sharpness.render( scale, stack, stitch, color + color / 2, images, color == 1 ? 1 : 0.5, Sharpness.computeEdges(stitch, color, 0, true)); file.getParentFile().mkdirs(); ImageIO.write(result, "png", file); return result; }
public static BufferedImage getGreenImage(final int stitch, final int image) throws IOException { File file = new File(Cache.CACHE.getCanonicalPath() + "/images-green/" + stitch + "/" + image + ".png"); if (file.exists()) return ImageIO.read(file); BufferedImage result = MetalTools.toImage(getInterpolatedImage(stitch, image), 128); Tools.ensurePath(file.getAbsolutePath()); ImageIO.write(result, "png", file); return result; }
public static void writeExp(float[][] image, String name) throws IOException { Tools.writePNG(MetalTools.toImage(exp(image), 128), name); }