@@ -0,0 +1,2289 @@
+package experimentalcode.erich.data.images;%0A%0Aimport java.awt.Color;%0Aimport java.util.List;%0A%0Aimport de.lmu.ifi.dbs.elki.utilities.optionhandling.IntParameter;%0Aimport de.lmu.ifi.dbs.elki.utilities.optionhandling.OptionID;%0Aimport de.lmu.ifi.dbs.elki.utilities.optionhandling.ParameterException;%0Aimport de.lmu.ifi.dbs.elki.utilities.optionhandling.constraints.IntervalConstraint;%0Aimport de.lmu.ifi.dbs.elki.utilities.optionhandling.constraints.IntervalConstraint.IntervalBoundary;%0A%0Apublic class ComputeHSBColorHistogram extends AbstractComputeColorHistogram %7B%0A  int quant;%0A%0A  /**%0A   * OptionID for %7B@link #BINSPERPLANE_PARAM%7D%0A   */%0A  public static final OptionID BINSPERPLANE_ID = OptionID.getOrCreateOptionID(%22hsbhist.bpp%22, %22Bins per plane for HSV/HSB histogram. This will result in bpp ** 3 bins.%22);%0A%0A  /**%0A   * Parameter that specifies the number of bins (per plane) to use.%0A   * %0A   * %3Cp%3E%0A   * Key: %7B@code -rgbhist.bpp%7D%0A   * %3C/p%3E%0A   */%0A  private final IntParameter BINSPERPLANE_PARAM = new IntParameter(BINSPERPLANE_ID, new IntervalConstraint(2, IntervalBoundary.CLOSE, 256, IntervalBoundary.CLOSE));%0A%0A  public ComputeHSBColorHistogram() %7B%0A    super();%0A    addOption(BINSPERPLANE_PARAM);%0A  %7D%0A%0A  @Override%0A  public List%3CString%3E setParameters(List%3CString%3E args) throws ParameterException %7B%0A    List%3CString%3E remainingParameters = super.setParameters(args);%0A%0A    quant = BINSPERPLANE_PARAM.getValue();%0A%0A    return remainingParameters;%0A  %7D%0A%0A  private final static float%5B%5D hsbbuf = new float%5B3%5D;%0A%0A  @Override%0A  protected int getBinForColor(int rgb) %7B%0A    int r = (rgb & 0xFF0000) %3E%3E 16;%0A    int g = (rgb & 0x00FF00) %3E%3E 8;%0A    int b = (rgb & 0x0000FF);%0A%0A    synchronized(hsbbuf) %7B%0A      float%5B%5D hsbvals = Color.RGBtoHSB(r, g, b, hsbbuf);%0A      // The values returned by RGBtoHSB are all in %5B0:1%5D%0A      int h = (int) Math.floor(quant * hsbvals%5B0%5D);%0A      int s = (int) Math.floor(quant * hsbvals%5B1%5D);%0A      int v = (int) Math.floor(quant * hsbvals%5B2%5D);%0A      // Guard against the value of 1.0%0A      if(h %3E= quant) %7B%0A        h = quant - 1;%0A      %7D%0A      if(s %3E= quant) %7B%0A        s = quant - 1;%0A      %7D%0A      if(v %3E= quant) %7B%0A        v = quant - 1;%0A      %7D%0A      return h * quant * quant + s * quant + v;%0A    %7D%0A  %7D%0A%0A  @Override%0A  protected int getNumBins() %7B%0A    return quant * quant * quant;%0A  %7D%0A%7D%0A

Add histogram class for HSB/HSV colors.