List of utility methods to do Bitmap Color Get
int | countSE(Bitmap bitmap, int[][] se) count SE int hlen = bitmap.getWidth(), vlen = bitmap.getHeight(); int toReturn = 0; for (int i = vlen - 1; i >= 0; i--) { for (int j = hlen - 1; j >= 0; j--) { if (kernelMatch(j, i, hlen, vlen, bitmap, se)) { toReturn++; return toReturn; |
int | getContactCount(Bitmap bitmap) get Contact Count int toReturn = 0; int hlen = bitmap.getWidth(), vlen = bitmap.getHeight(); for (int i = 0; i < vlen; i++) { for (int j = 0; j < hlen; j++) { if ((bitmap.getPixel(j, i) & 0xff) > 0) { if (j + 1 < hlen && (bitmap.getPixel(j + 1, i) & 0xff) > 0) { toReturn++; ... |
int | getPixelsCount(Bitmap bitmap) get Pixels Count int hlen = bitmap.getWidth(), vlen = bitmap.getHeight(); int toReturn = 0; for (int i = 0; i < vlen; i++) { for (int j = 0; j < hlen; j++) { if ((bitmap.getPixel(j, i) & 0xff) > 0) { toReturn++; return toReturn; |
boolean | kernelMatch(int x, int y, int w, int h, Bitmap bitmap, int[][] se) kernel Match int lenh = se[0].length, lenv = se.length; for (int i = 0; i < lenv; i++) { for (int j = 0; j < lenh; j++) { int pVal = ((bitmap.getPixel((x + j) % w, (y + i) % h) & 0xff) > 0 ? 1 : 0); if (se[i][j] != pVal) { return false; return true; |
int[] | getColorHistogram(Bitmap bitmap) get Color Histogram int width = bitmap.getWidth(); int height = bitmap.getHeight(); int[] areaColor = new int[64]; for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { int pixels = bitmap.getPixel(i, j); int alpha = (pixels >> 24) & 0xFF; int red = (pixels >> 16) & 0xFF; ... |
boolean | isBitmapWhiteAtTopOrBottom(Bitmap largeBitmap) Returns true if 20% of the image's top right corner is white, or 20% of the bottom of the image is white. Trace.beginSection("isBitmapWhiteAtTopOrBottom"); try { final Bitmap smallBitmap = scaleBitmapDown(largeBitmap); final int[] rgbPixels = new int[smallBitmap.getWidth() * smallBitmap.getHeight()]; smallBitmap.getPixels(rgbPixels, 0, smallBitmap.getWidth(), 0, 0, smallBitmap.getWidth(), smallBitmap.getHeight()); int whiteCount = 0; ... |