title: Faster way to extract histogram from an image
body: <p>I'm looking for a faster way to extract histogram data from an image.
  I'm currently using this piece of code that needs about 1200ms for a 6mpx JPEG image:</p>
  
  <pre><code>        ImageReader imageReader = (ImageReader) iter.next();
          imageReader.setInput(is);
          BufferedImage image = imageReader.read(0);
          int height = image.getHeight();
          int width = image.getWidth();
          Raster raster = image.getRaster();
          int[][] bins = new int[3][256];
  
          for (int i = 0; i &lt; width; i++) 
              for (int j = 0; j &lt; height; j++) {
                  bins[0][raster.getSample(i, j, 0)]++;
                  bins[1][raster.getSample(i, j, 1)]++;
                  bins[2][raster.getSample(i, j, 2)]++;
  
              }
  </code></pre>
  
  <p>Do you have any suggestions?</p>