Package javax.media.jai

Examples of javax.media.jai.Histogram


        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

            // 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

        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

/* 182 */     return names;
/*     */   }
/*     */
/*     */   protected Object createStatistics(String name) {
/* 186 */     if (name.equalsIgnoreCase("histogram")) {
/* 187 */       return new Histogram(this.numBins, this.lowValueFP, this.highValueFP);
/*     */     }
/* 189 */     return java.awt.Image.UndefinedProperty;
/*     */   }
View Full Code Here

/* 189 */     return java.awt.Image.UndefinedProperty;
/*     */   }
/*     */
/*     */   protected void accumulateStatistics(String name, Raster source, Object stats)
/*     */   {
/* 197 */     Histogram histogram = (Histogram)stats;
/* 198 */     int numBands = histogram.getNumBands();
/* 199 */     int[][] histJAI = histogram.getBins();
/*     */
/* 202 */     Rectangle tileRect = source.getBounds();
/*     */     int[][] histo;
/*     */     int[][] histo;
/* 206 */     if ((!this.reorderBands) && (tileRect.equals(getBounds())))
/*     */     {
/* 208 */       histo = histJAI;
/*     */     }
/*     */     else {
/* 211 */       histo = new int[numBands][];
/* 212 */       for (int i = 0; i < numBands; i++) {
/* 213 */         histo[i] = new int[histogram.getNumBins(i)];
/*     */       }
/*     */
/*     */     }
/*     */
/* 218 */     int formatTag = MediaLibAccessor.findCompatibleTag(null, source);
View Full Code Here

/*     */     {
/* 149 */       msg.append(getName() + " " + JaiI18N.getString("MatchCDFDescriptor2"));
/*     */
/* 151 */       return false;
/*     */     }
/* 153 */     Histogram hist = (Histogram)prop;
/* 154 */     int numBands = hist.getNumBands();
/*     */
/* 156 */     if (CDF == null) {
/* 157 */       int[] numBins = hist.getNumBins();
/* 158 */       CDF = new float[numBands][];
/*     */
/* 160 */       for (int b = 0; b < numBands; b++) {
/* 161 */         CDF[b] = new float[numBins[b]];
/* 162 */         for (int i = 0; i < numBins[b]; i++) {
/* 163 */           CDF[b][i] = ((i + 1) / numBins[b]);
/*     */         }
/*     */       }
/*     */     }
/* 167 */     if (CDF.length != numBands)
/*     */     {
/* 169 */       msg.append(getName() + " " + JaiI18N.getString("MatchCDFDescriptor3"));
/*     */
/* 171 */       return false;
/*     */     }
/*     */
/* 174 */     for (int b = 0; b < numBands; b++) {
/* 175 */       if (CDF[b].length != hist.getNumBins(b))
/*     */       {
/* 177 */         msg.append(getName() + " " + JaiI18N.getString("MatchCDFDescriptor4"));
/*     */
/* 179 */         return false;
/*     */       }
View Full Code Here

/*     */   public RenderedImage create(ParameterBlock args, RenderingHints renderHints)
/*     */   {
/* 142 */     ImageLayout layout = RIFUtil.getImageLayoutHint(renderHints);
/*     */
/* 146 */     RenderedImage src = args.getRenderedSource(0);
/* 147 */     Histogram hist = (Histogram)src.getProperty("histogram");
/* 148 */     float[][] CDF = (float[][])args.getObjectParameter(0);
/* 149 */     float[][][] bp = createSpecificationMap(hist, CDF);
/*     */
/* 151 */     return new PiecewiseOpImage(src, renderHints, layout, bp);
/*     */   }
View Full Code Here

/*  99 */     return names;
/*     */   }
/*     */
/*     */   protected Object createStatistics(String name) {
/* 103 */     if (name.equalsIgnoreCase("histogram")) {
/* 104 */       return new Histogram(this.numBins, this.lowValue, this.highValue);
/*     */     }
/* 106 */     return Image.UndefinedProperty;
/*     */   }
View Full Code Here

/* 106 */     return Image.UndefinedProperty;
/*     */   }
/*     */
/*     */   protected void accumulateStatistics(String name, Raster source, Object stats)
/*     */   {
/* 113 */     Histogram histogram = (Histogram)stats;
/* 114 */     histogram.countPixels(source, this.roi, this.xStart, this.yStart, this.xPeriod, this.yPeriod);
/*     */   }
View Full Code Here

TOP

Related Classes of javax.media.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.