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];
 }
4

1 回答 1

3

这是一个带有一些 ios 移植图像处理算法的站点。如果您可以检测到图像的外边缘和一些参考对象(并且知道它们处于相同的深度),您应该能够近似大小。

编辑 - 原来那个链接没有代码。 Here's an SO answer about using OpenCV to do edge detection。无论如何,重点是,您需要图像处理才能从照片中提取可测量的特征。

于 2013-02-25T15:30:16.697 回答