To me, it seems that making computations pixel by pixel is the only
solution...

However, there might be a faster solution than using getPixels : using
a buffer. See copyPixelsToBuffer method in the Bitmap class. A buffer
is read only or write only, and I guess it might use lower level
computations and run faster (but you should test this, because its
just a guess from me). getPixels, getPixel, and copyPixelsToBuffer are
all calling native (C++ ?) methods in the bitmap class, so it's quite
hard to guess which one is faster from just reading the java code.

By the way, once you have the process to read the pixels, it won't be
so easy to determine if a photo is white.. Because I guess it will
never be "plain white", more like "whie grey" with noise etc... But
there should exist some algorithms that will do the job.

Good luck!



On Jul 21, 7:38 am, alucard20004 <alucard20...@gmail.com> wrote:
> (please forgive my imperfect English.)
>
> Hi. I'll get straight to the point.
>
> Please note that I haven't code anything in this project just yet.
> This is only an idea.
>
> In  human language, my goal is to:
>
> 1. Take a picture of a blank white A4 paper.
> 2. Verify (by code) that the picture is "White". (this's why I include
> 'simple' in the topic)
>
> I mean, the program should be able to tell if the user just took the
> picture of "white" paper and not any other colors.
>
> For the code...
> I can guess that the actual process should be:
>
> 1. Use Camera API to take a picture. // this step should be easy
> 2. Convert it to Bitmap. // this step should also be easy
> 3. Verify that it is "White". //*** now I need some help here.
>
> How can I do step 3? I look up the docs and found this is the Bitmap
> class:
>
> getPixels  (int[] pixels, int offset, int stride, int x, int y, int
> width, int height)
>
> I can use this and compare the data pixel-by-pixel but it seems
> expensive.
>
> Could anyone recommend me a more proper way(if there is) to do this
> please?
>
> Thank you in advance.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to