Esempio n. 1
0
  private void process(ColorProcessor ip) {
    double[] feature = new double[binX * binY * binZ];
    int processedPixels = 0;

    ImageProcessor mask = ip.getMask();

    int numpixels = ip.getPixelCount();
    float[] hsbvals = new float[3]; // Conversion buffer
    for (int i = 0; i < numpixels; i++) {
      if (mask == null || mask.get(i) != 0) {
        if (type == TYPE.HSB) {
          feature[getBinForHSB(ip.get(i), hsbvals)]++;
        } else if (type == TYPE.RGB) {
          feature[getBinForRGB(ip.get(i))]++;
        }
        processedPixels++;
      }
    }

    Arrays2.div(feature, processedPixels);
    addData(feature);
  }
  public int[] setSphereColors(SphericalMaxProjection smp, ColorProcessor ip) {
    Point2f polar = new Point2f();
    Point2D.Double out = new Point2D.Double();
    int[] colors = new int[smp.getSphere().nVertices];
    int idx = 0;
    for (Point3f v : smp.getSphere().getVertices()) {
      smp.getPolar(v, polar);
      projection.transformRadians(polar.x, polar.y, out);
      int x = (int) out.x - minx;
      int y = maxy - (int) out.y;

      colors[idx++] = ip.get(x, y);
    }
    return colors;
  }