public static void main(String[] args) { RenderedImage image = JAI.create("fileload", "estacaosp.jpg"); float scale=(float) 0.5; ParameterBlock pb = new ParameterBlock(); pb.addSource(image); pb.add(scale); pb.add(scale); pb.add(1.0F); pb.add(1.0F); pb.add(new InterpolationNearest() );// ;InterpolationBilinear()); image = JAI.create("scale", pb); // Create an instance of DisplayJAI. DisplayJAI srcdj = new DisplayJAI(image); JScrollPane srcScrollPaneImage = new JScrollPane(srcdj); // Use a label to display the image JFrame frame = new JFrame(); frame.getContentPane().add(srcScrollPaneImage, BorderLayout.CENTER); frame.pack(); frame.setVisible(true); }
public ImageWorker translate(float xTrans, float yTrans, Interpolation interp) { ParameterBlock pb = new ParameterBlock(); pb.addSource(image); pb.add(xTrans); pb.add(yTrans); pb.add(interp); // do not use getRenderingHints() with translate, as it cannot deal with layout hints image = JAI.create("Translate", pb, commonHints); return this; }
ParameterBlock pb = new ParameterBlock(); for (RenderedImage band : bands) { pb.addSource(band);
public ImageWorker border( int leftPad, int rightPad, int topPad, int bottomPad, BorderExtender ext) { ParameterBlock pb = new ParameterBlock(); pb.addSource(image); pb.add(leftPad); pb.add(rightPad); pb.add(topPad); pb.add(bottomPad); pb.add(ext); pb.add(nodata); if (isNoDataNeeded()) { if (background != null && background.length > 0) { pb.add(background); } } image = JAI.create("Border", pb, getRenderingHints()); return this; }
paramBlk.addSource(constantImage); paramBlk.add(warp); paramBlk.add(interp);
for (int i = 0; i < images.length; i++) { if (images[i] != null) { pb.addSource(images[i]); srcNum++;
final ParameterBlock paramBlk = new ParameterBlock().addSource(sourceImage); Object property = sourceImage.getProperty("ROI");
pb.addSource(sourceImage); pb.set(classes, 0); pb.set(toJAIExtMethod(method), 1);
public static PlanarImage magnitude(final PlanarImage image) { final ParameterBlock pb = new ParameterBlock(); pb.addSource(image); return JAI.create("magnitude", pb, null); }
@Override protected PlanarImage execute (MultiplyComplexOp operation, final EditableImage image, PlanarImage planarImage) { ParameterBlock pb = new ParameterBlock(); pb.addSource(planarImage); pb.addSource(JAIUtils.getPlanarImage(operation.getOperand())); planarImage = JAI.create("multiplycomplex", pb); JAIUtils.logImage(log, ">>>> MultiplyComplexJAIOp returning", planarImage); return planarImage; } }
@Override protected PlanarImage execute (MultiplyOp operation, final EditableImage image, PlanarImage planarImage) { ParameterBlock pb = new ParameterBlock(); pb.addSource(planarImage); pb.addSource(JAIUtils.getPlanarImage(operation.getOperand())); planarImage = JAI.create("multiply", pb); JAIUtils.logImage(log, ">>>> MultiplyJAIOp returning", planarImage); return planarImage; } }
@Override protected PlanarImage execute (BandMergeOp operation, final EditableImage image, PlanarImage planarImage) { ParameterBlock pb = new ParameterBlock(); pb.addSource(planarImage); pb.addSource(JAIUtils.getPlanarImage(operation.getOperand())); planarImage = JAI.create("bandmerge", pb); JAIUtils.logImage(log, ">>>> BandMergeOp returning", planarImage); return planarImage; } }
@Override protected PlanarImage execute (ConjugateOp operation, final EditableImage image, PlanarImage planarImage) { ParameterBlock pb = new ParameterBlock(); pb.addSource(planarImage); planarImage = JAI.create("conjugate", pb); JAIUtils.logImage(log, ">>>> ConjugateOp returning", planarImage); return planarImage; } }
RenderedOp rop = JAI.create("fileload", file.getAbsolutePath()); ParameterBlock pb = new ParameterBlock(); pb.addSource(rop); pb.add(0.5f); pb.add(0.5f); rop = JAI.create("scale", pb); // For better looking results, but slower: // rop = JAI.create("SubsampleAverage", pb); BufferedImage bufImg = rop.getAsBufferedImage();
/** * Invert an image. * * @param image the image to process * @return the inverted image */ public static BufferedImage invert (BufferedImage image) { return JAI.create("Invert", new ParameterBlock().addSource(image).add(null), null) .getAsBufferedImage(); }
private static PlanarImage idft(final RenderedImage image) { final ParameterBlock pb = new ParameterBlock(); pb.addSource(image); pb.add(DFTDescriptor.SCALING_DIMENSIONS); pb.add(DFTDescriptor.COMPLEX_TO_COMPLEX); return JAI.create("idft", pb, null); }
public static PlanarImage dft(final RenderedImage image) { final ParameterBlock pb = new ParameterBlock(); pb.addSource(image); pb.add(DFTDescriptor.SCALING_NONE); pb.add(DFTDescriptor.REAL_TO_COMPLEX); return JAI.create("dft", pb, null); }
public static double getMean(final RenderedImage image) { final ParameterBlock pb = new ParameterBlock(); pb.addSource(image); pb.add(null); // null ROI means whole image pb.add(1); // check every pixel horizontally pb.add(1); // check every pixel vertically // Perform the mean operation on the source image. final RenderedImage meanImage = JAI.create("mean", pb, null); // Retrieve and report the mean pixel value. final double[] mean = (double[]) meanImage.getProperty("mean"); return mean[0]; }