I think I should have mentioned that I already had desaturated the image. So the color comparison is correct.
On Apr 1, 5:55 pm, Kevin Huber <[email protected]> wrote: > You should work on the array of pixel data directly. > This document may be > helpfulhttp://www.3programmers.com/mwells/documents/pdf/Final%20Report.pdf > > I don't think the comparison you are doing if (point < Color.GRAY) is > valid since Bitmap pixels are ARGB data. I would expect to see code > bit shifting out the R G B components. > > -Kevin > > On Apr 1, 4:14 pm, paladin <[email protected]> wrote: > > > > > I am using the following code to flip each pixel in a bitmap to black > > or white: > > > for(int x = 0; x < newBitmap.getWidth(); x++) { > > for(int y = 0; y < newBitmap.getHeight(); y++) { > > int point = newBitmap.getPixel(x, y); > > if(point < Color.GRAY) { > > paint.setColor(Color.BLACK); > > c.drawPoint(x, y, paint); > > } else { > > paint.setColor(Color.WHITE); > > c.drawPoint(x, y, paint); > > } > > } > > } > > > It works, but it is extraordinarily slow for the size image I'm using > > (half the resolution of the camera, 1296x972). I have also tried > > setPixel, and I'm getting about the same performance. Anyone out there > > know of a faster way to do this? -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using "remove me" as the subject.

