Android: Convert Grayscale to Binary Image
i hava done with get grayscale value, but i don't know how to use function to convert the grayscale to be binary image. Please help me, here my function code: public Bitmap toBinary(Bitmap bmpOriginal) { int width, height, threshold; height = bmpOriginal.getHeight(); width = bmpOriginal.getWidth(); threshold = 127; final Bitmap bmpBinary = null; for(int x = 0; x < width; ++x) { for(int y = 0; y < height; ++y) { // get one pixel color int pixel = bmpOriginal.getPixel(x, y); //get grayscale value int gray = (int)(pixel & 0xFF); //get binary value if(gray < threshold){ bmpBinary.setPixel(x, y, 0)