Reputation: 1003
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];
}
Upvotes: 1
Views: 2653
Reputation: 62686
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.
Upvotes: 3