Android Question Camera image detection ?

Discussion in 'Android Questions' started by Devv, Apr 7, 2015.

  1. Devv

    Devv Active Member Licensed User

    If i have a drawing picture and i want to find if this image is similar or exact to the camera input

    opencv is not supported for b4a and is complicated (i believe so)

    a simple workaround is that i take a camera pic every 1 second then compare that pic to my drawing picture that is already stored in my device.

    how to achive this ?
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    There is no simple workaround for this. Two images will never be identical.
     
  3. RandomCoder

    RandomCoder Well-Known Member Licensed User

    Let me start by stating that I've not done any image processing with B4A and have no specialist experience in the feild. That said, this seems like an interseting problem and I haven't seen anything here on the Forum that would provide an instant solution. If it was me having to produce something I'd probably start with the RSImageProcessing library... RSImageProcessing Library
    My approach would be to convert both images to greyscale then divide the image into a reasonable number of sections and compare the number of dark pixels (above a preset threshold) in each section of the images. If each section is 'almost' the same then the image can be considered similar, the smaller the differnce, the closer they are to being exactly the same. How does this sound for a reasonably simple approach? Does anyone else have a better solution?
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    Worth a try.
     
  5. JordiCP

    JordiCP Well-Known Member Licensed User

    As there is not (as far as I know) a direct way to do it in B4A, RandomCoder's approach sounds good.

    You must also take into account that camera images may also vary depending on lighting conditions, so the autowhite balance must be off (mostly if the images are from exterior) and also some other camera settings fixed. Also, you could normalize the grayscale result.

    When you say "similar", you must also decide if you accept "displaced" images (the human eye will recognize two images displaced as similar) but your algorithm may not, depending on how you implement it

    A more elaborate try would be with image correlation. It needs math background and a really fast processing so perhaps 1 second is not enough. Don't know if there are fast FFT-2D routines available for B4A

    Also, I would highly reccommend to implement whatever algorithm first in PC and have a set of test images to try until you have "tuned" the threshold parameters needed, and then code it with B4A
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice