Package com.lightcrafts.mediax.jai

Examples of com.lightcrafts.mediax.jai.Histogram


            // Property is not a Histogram.
            msg.append(getName() + " " +
                       JaiI18N.getString("MatchCDFDescriptor2"));
            return false;
  } else {
      Histogram hist = (Histogram)prop;
      int numBands = hist.getNumBands();

            if (CDF == null) {
                int[] numBins = hist.getNumBins();
                CDF = new float[numBands][];

                for (int b = 0; b < numBands; b++) {
                    CDF[b] = new float[numBins[b]];
                    for (int i = 0; i < numBins[b]; i++)
                        CDF[b][i] = (i + 1)/numBins[b];
                }
            }

      if(CDF.length != numBands) {
                // CDF length does not match Histogram.
          msg.append(getName() + " " +
         JaiI18N.getString("MatchCDFDescriptor3"));
    return false;
      }

      for(int b = 0; b < numBands; b++) {
          if(CDF[b].length != hist.getNumBins(b)) {
                    // Check that CDF length for this band matches Histogram.
        msg.append(getName() + " " +
             JaiI18N.getString("MatchCDFDescriptor4"));
        return false;
    }
View Full Code Here


        return names;
    }

    protected Object createStatistics(String name) {
        if (name.equalsIgnoreCase("histogram")) {
            return new Histogram(numBins, lowValueFP, highValueFP);
        } else {
            return java.awt.Image.UndefinedProperty;
        }
    }
View Full Code Here

    protected void accumulateStatistics(String name,
                                        Raster source,
                                        Object stats) {
        // Get the JAI histogram.
        Histogram histogram = (Histogram)stats;
        int numBands = histogram.getNumBands();
        int[][] histJAI = histogram.getBins();

        // Get the tile bounds.
        Rectangle tileRect = source.getBounds();

        // Get the tile bins.
        int[][] histo;
        if(!reorderBands && tileRect.equals(getBounds())) {
            // Entire image: use the global histogram bins directly.
            histo = histJAI;
        } else {
            // Sub-image: save results for this tile only.
            histo = new int[numBands][];
            for(int i = 0; i < numBands; i++) {
                histo[i] = new int[histogram.getNumBins(i)];
            }
        }

        // Get the mlib image.
        int formatTag = MediaLibAccessor.findCompatibleTag(null, source);
View Full Code Here

        return names;
    }

    protected Object createStatistics(String name) {
        if (name.equalsIgnoreCase("histogram")) {
            return new Histogram(numBins, lowValue, highValue);
        } else {
            return java.awt.Image.UndefinedProperty;
        }
    }
View Full Code Here

    }

    protected void accumulateStatistics(String name,
                                        Raster source,
                                        Object stats) {
        Histogram histogram = (Histogram)stats;
        histogram.countPixels(source, roi, xStart, yStart, xPeriod, yPeriod);
    }
View Full Code Here

        ImageLayout layout = RIFUtil.getImageLayoutHint(renderHints);
       

        // Derive breakpoints from the histogram and specified CDF.
  RenderedImage src = args.getRenderedSource(0);
  Histogram hist = (Histogram)src.getProperty("histogram");
  float[][] CDF = (float[][])args.getObjectParameter(0);
  float[][][] bp = createSpecificationMap(hist, CDF);

  return new PiecewiseOpImage(src, renderHints, layout, bp);
    }
View Full Code Here

TOP

Related Classes of com.lightcrafts.mediax.jai.Histogram

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.