Search code examples
iphoneobjective-ciosxcodeiphone-5

Compare an image shot using camera with one in my app


I want to find out if there's a way to implement the certain algorithm for my iPhone and iPad app:

  • The user shoots a photo using the camera interface inside my app
  • The photo is then compared with one of the photos I have inside an app
  • And the photo that looks most alike is displayed

How do you do that? Any ideas? Thanks in advance!


Solution

  • Take a look at AVFoundation and AVCam in Apple library .AVCam sample code demonstrates how to use the AV Foundation capture APIs for recording movies and taking still images.

    and this tutorial tells how to use Open CV to compare images and here is a key method you should get start with

    - (int)difference((int)topPixel,(int)bottomPixel)
    {
        return abs(topPixel-bottomPixel);
    }
    

    and the last part about displaying the result, i hope it must be quite easy for you..