我想,也都是对的UIImagePickerController当用户使用相机所显示的图像。 当我得到我要处理的图像,并显示代替普通摄像机视图。
但问题是,当我想要得到相机认为,形象只是一个黑色的矩形。
这里是我的代码:
UIView *cameraView = [[[[[[imagePicker.view subviews] objectAtIndex:0]
subviews] objectAtIndex: 0]
subviews] objectAtIndex: 0];
UIGraphicsBeginImageContext( CGSizeMake(320, 427) );
[cameraView.layer renderInContext: UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
imageToDisplay.image = [PixelProcessing processImage: viewImage]; //In this case the image is black
//imageToDisplay.image = viewImage; //In this case the image is black too
//imageToDisplay.image = [UIImage imageNamed: @"icon.png"]; //In this case image is being displayed properly
我究竟做错了什么?
谢谢。