List of utility methods to do BufferedImage Histogram
int[] | generateBWHistogram(BufferedImage bitmap, int bucketSize) generate BW Histogram int[] histogram = new int[256 / bucketSize]; for (int y = 0; y < bitmap.getHeight(); y++) { for (int x = 0; x < bitmap.getWidth(); x++) { Color c = new Color(bitmap.getRGB(x, y)); int grey = (c.getRed() + c.getBlue() + c.getGreen()) / 3; int index = grey / bucketSize; histogram[index]++; return histogram; |
int[][] | histogram(BufferedImage bufferedImage) histogram int[][] histogram = new int[3][256]; WritableRaster raster = bufferedImage.getRaster(); int pixel[] = new int[4]; for (int y = 0; y < raster.getHeight(); y++) { for (int x = 0; x < raster.getWidth(); x++) { raster.getPixel(x, y, pixel); for (int i = 0; i < 3; i++) { histogram[i][pixel[i]]++; ... |
int[][] | histogram(BufferedImage img, boolean gray) Generates a histogram for each of the R, G and B channels. int[][] result; int width; int height; int x; int y; int[] split; int i; if (gray) { ... |
int[] | imageHistogram(BufferedImage input) image Histogram int[] rhistogram = new int[256]; int[] ghistogram = new int[256]; int[] bhistogram = new int[256]; for (int i = 0; i < rhistogram.length; i++) rhistogram[i] = ghistogram[i] = bhistogram[i] = 0; for (int j = 0; j < input.getHeight(); j++) { for (int i = 0; i < input.getWidth(); i++) { int rgb = input.getRGB(i, j); ... |
int[] | imageHistogram(BufferedImage input) image Histogram int[] histogram = new int[256]; for (int i = 0; i < histogram.length; i++) { histogram[i] = 0; for (int i = 0; i < input.getWidth(); i++) { for (int j = 0; j < input.getHeight(); j++) { int red = new Color(input.getRGB(i, j)).getRed(); histogram[red]++; ... |
int | sectorHistorgramCompare(BufferedImage a, BufferedImage b) Hardcoded to 4 sectors at the moment int result = Integer.MAX_VALUE; int filter = 10; int sqrtSectors = 3; Rectangle[] aSectors = buildSectors(a, sqrtSectors); Rectangle[] bSectors = buildSectors(b, sqrtSectors); int[][] aAverages = buildPixelAverages(a, aSectors); int[][] bAverages = buildPixelAverages(b, bSectors); int totalDelta = 0; ... |