1

I need to do an method which measure the object from a photo... I mean that I can compare the object with the size from a card to get the size from object, but I don't know how to compare this... Any idea?

Here is how I am taking the picture

- (IBAction)takePicture:(id)sender {
// Create image picker controller
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];

// Set source to the camera
imagePicker.sourceType =  UIImagePickerControllerSourceTypeCamera;

// Delegate is self
imagePicker.delegate = self;

// Allow editing of image ?
imagePicker.allowsImageEditing = NO;

// Show image picker
[self presentModalViewController:imagePicker animated:YES];

  }

       - (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo
     {
UIAlertView *alert;

// Unable to save the image
if (error)
    alert = [[UIAlertView alloc] initWithTitle:@"Error"
                                       message:@"Unable to save image to Photo Album."
                                      delegate:self cancelButtonTitle:@"Ok"
                             otherButtonTitles:nil];
else // All is well
    alert = [[UIAlertView alloc] initWithTitle:@"Success"
                                       message:@"Image saved to Photo Album."
                                      delegate:self cancelButtonTitle:@"Ok"
                             otherButtonTitles:nil];
[alert show];
[alert release];
 }
Jason Aller
  • 3,541
  • 28
  • 38
  • 38
Ladessa
  • 985
  • 4
  • 24
  • 50
  • The code you have shown is how you call the image picker. How does that relate to your question? – Hermann Klecker Feb 25 '13 at 15:25
  • yes, I need take this image and get the width and height from a defined area – Ladessa Feb 25 '13 at 15:26
  • 1
    If I understand you correctly then you will have to perform some image processing in order to identify this area, get its size and convert that to some real world measures. – Hermann Klecker Feb 25 '13 at 15:33
  • @HermannKlecker yes, but I don't know how to do this.. – Ladessa Feb 25 '13 at 15:35
  • 2
    Neither do I. And if I would then I would sell my high profiled consultancy on image processing. If I were you I would start with some edge detection and based on the shape of the card and its contents try to identifiy which of the rectangular (4 edges - depending on perspective not nessessarily rectangualr in the image) of the image corresponds with the card - if any. And then go from there. – Hermann Klecker Feb 25 '13 at 15:40
  • Yes, I wanna to base of the card...but I don't know how to check how many cards have space for in this photo – Ladessa Feb 25 '13 at 15:45

1 Answers1

3

Here's a site with some ios ported image processing algorithms. If you can detect the outer edges of the image and some reference object (and know that they are at the same depth), you should be able to approximate size.

EDIT - Turns out there's no code at that link. Here's an SO answer about using OpenCV to do edge detection. Anyway, the point is, you need image processing to pull measurable features from the photo.

Community
  • 1
  • 1
danh
  • 62,181
  • 10
  • 95
  • 136