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];
}
您顯示的代碼是您如何調用圖像選擇器。這與你的問題有什麼關係? – 2013-02-25 15:25:45
是的,我需要拍攝這張照片並從指定區域獲得寬度和高度 – Ladessa 2013-02-25 15:26:59
如果我理解正確,那麼您將不得不執行一些圖像處理以識別此區域,獲取其大小並將其轉換爲一些真實世界措施。 – 2013-02-25 15:33:40