3 Replies Latest reply on Sep 12, 2010 1:37 PM by 843802

    Add two image ERROR!

      Hi! i have some problem with this code:
           public BufferedImage combineYUV2(BufferedImage ydctmark, BufferedImage bi) {
                // Read the two images.
                ParameterBlock pb = new ParameterBlock();
                RenderedImage src1 = (RenderedImage)JAI.create("stream", pb);
                pb = new ParameterBlock();
                RenderedImage src2 = (RenderedImage)JAI.create("stream", pb);
                // Create the ParameterBlock for the operation
                pb = new ParameterBlock();
                // Create the Add operation.
                RenderedImage dst = (RenderedImage)JAI.create("add", pb);
                int w=bi.getWidth();
                int h = bi.getHeight();
                int[] img = new int[w*h]; 
                dst.getData().getPixels(0, 0, w, h, img);
                BufferedImage image = new BufferedImage(w, h, BufferedImage.TYPE_CUSTOM);
                WritableRaster raster = image.getRaster();
                raster.setPixels(0, 0, w, h, img);
                return image;
      and i don't understand why.

      the error is : " Exception in thread "main" java.lang.IllegalArgumentException: operation "Stream" requires 2 parameter object(s).
           at javax.media.jai.JAI.createNS(JAI.java:1091)
           at javax.media.jai.JAI.create(JAI.java:977)
           at javax.media.jai.JAI.create(JAI.java:1399)" ext...

      can some one help me?

      to create this method i read this