Java tutorial
//package com.java2s; //License from project: Open Source License import android.graphics.Bitmap; import android.graphics.Color; public class Main { /** * Heuristic method to determine if the image looks empty. Works by taking a horisontal row of pixels from he * middle, and looks if they're all pure white. * * @param refinedImage A pre-processed image of the evolution cost. (should be pre-refined to replace all non * text colors with pure white) * @return true if the image is likely only white */ private static boolean isOnlyWhite(Bitmap refinedImage) { int[] pixelArray = new int[refinedImage.getWidth()]; //below code takes one line of pixels in the middle of the pixture from left to right refinedImage.getPixels(pixelArray, 0, refinedImage.getWidth(), 0, refinedImage.getHeight() / 2, refinedImage.getWidth(), 1); for (int pixel : pixelArray) { if (pixel != Color.rgb(255, 255, 255)) { // if pixel is not white return false; } } return true; } }