2013-02-25 56 views
1

我需要做一个方法来测量照片中的物体......我的意思是我可以将物体与卡的大小进行比较以获得物体的大小,但是我不知道如何比较这...任何想法?用相机测量物体的大小

这里是我正在拍照

- (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]; 
} 
+0

您显示的代码是您如何调用图像选择器。这与你的问题有什么关系? – 2013-02-25 15:25:45

+0

是的,我需要拍摄这张照片并从指定区域获得宽度和高度 – Ladessa 2013-02-25 15:26:59

+1

如果我理解正确,那么您将不得不执行一些图像处理以识别此区域,获取其大小并将其转换为一些真实世界措施。 – 2013-02-25 15:33:40

回答

相关问题