Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 用相机测量物体的大小_Ios_Objective C_Image Processing - Fatal编程技术网

Ios 用相机测量物体的大小

Ios 用相机测量物体的大小,ios,objective-c,image-processing,Ios,Objective C,Image Processing,我需要做一个从照片上测量物体的方法。。。我的意思是,我可以将物体与卡片上的大小进行比较,得到物体的大小,但我不知道如何比较这个。。。有什么想法吗 这是我拍这张照片的方式 - (IBAction)takePicture:(id)sender { // Create image picker controller UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init]; // Set source

我需要做一个从照片上测量物体的方法。。。我的意思是,我可以将物体与卡片上的大小进行比较,得到物体的大小,但我不知道如何比较这个。。。有什么想法吗

这是我拍这张照片的方式

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

这是一个移植了一些ios的站点。如果可以检测图像和某些参考对象的外边缘(并且知道它们处于相同的深度),则应该能够确定大致的大小


编辑-结果显示该链接没有代码。无论如何,关键是,您需要图像处理来从照片中提取可测量的特征。

您显示的代码是如何调用图像选择器的。这与你的问题有什么关系?是的,我需要拍摄这张图像,并从一个定义的区域获取宽度和高度。如果我理解正确,那么你必须执行一些图像处理,以识别该区域,获取其大小,并将其转换为一些真实世界的测量值。@HermannKlecker是的,但我不知道如何做到这一点。我也不知道。如果我愿意,我会卖掉我在图像处理方面的知名咨询公司。如果我是你,我会从一些边缘检测开始,并根据卡片的形状及其内容,尝试识别图像的矩形(4条边缘-取决于透视图,而不是图像中的矩形)中的哪一条与卡片相对应(如果有的话)。然后从那里开始。