0

The code below let me take a picture with my camera and put it in an image view. There will also appear some text in a label.

For example: I have some pictures in assets.xcassets from a couple of friends including myself. When I take a picture from myself, the app should scan all the pictures and say: "The person on this picture is me".

How do I have to compare pictures and let's say are 75% equal as each other?

var imagePicker: UIImagePickerController!

@IBOutlet weak var ImageView: UIImageView!
@IBOutlet weak var lblText: UILabel!

override func viewDidLoad() {
    super.viewDidLoad()

}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}

@IBAction func takeImage(sender: AnyObject) {

    imagePicker = UIImagePickerController()
    imagePicker.delegate = self
    imagePicker.sourceType = .Camera
    presentViewController(imagePicker, animated: true, completion: nil)

}

func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : AnyObject]) {

    imagePicker.dismissViewControllerAnimated(true, completion: nil)
    ImageView.image = info[UIImagePickerControllerOriginalImage] as? UIImage

    lblText.text = "The person on this picture is *name person on picture*"

}

@IBAction func resetImage(sender: AnyObject) {

    ImageView.image = nil
    lblText.text = nil
}
  • In general, this is an **extremely complicated** problem and the subject of lots of research. Imagine the problems caused when the lighting on a person is different between two pictures, when their facial expression changes, when they are a different size in the two pictures, when the camera is rotated between the two pictures, when they are wearing glasses in one and not the other, when yet have had a haircut, when they have aged between the two pictures, when one picture is scratched or damaged... – Mark Setchell Feb 13 '16 at 16:43
  • I knew it would be a big problem to do so, but my app isn't for facial recognition, it's about things. Is it possible to compare like pictures in general with each other? – Jeffrey Pyncket Feb 13 '16 at 16:47
  • You can have a look here... http://stackoverflow.com/a/25204466/2836621 – Mark Setchell Feb 13 '16 at 16:55

0 Answers0