更新:参考#19285042并向苹果提交错误报告
非常奇怪的错误,没有在网上找到任何东西.它说"BSXPCMessage收到错误消息:连接中断"
我只是在做一些基本的过滤器应用程序.如果我将UIImageView.image重新分配给另一个UIImage,则只会出现错误消息.如果我只是注释掉那行,我就不会得到错误.因此,当我将过滤后的图像分配给UIImageView时,如果您能够想到出现此消息的原因,那将非常有用.
如果您能为此错误提出任何原因,我将不胜感激.
#import "FilterTestsViewController.h"
@interface FilterTestsViewController ()
@end
@implementation FilterTestsViewController
UIImage* _originalImage;
UIImage* _filterImage;
UIImageView* _uiImageView;
- (void)viewDidLoad
{
[super viewDidLoad];
[self initialize];
//flip image by 180*
}
-(void)initialize
{
_originalImage = [UIImage imageNamed:@"ja.jpg"]; //creates image from file, this will result in a nil CIImage but a valid CGImage;
[self createFilterImage];
_uiImageView = [[UIImageView alloc] initWithImage:_filterImage]; //creates a UIImageView with the UIImage
[self.view addSubview:_uiImageView]; //adds the UIImageView to view;
}
-(void)createFilterImage
{
NSString* filterName = @"CIFalseColor";
CIImage* ciImage …Run Code Online (Sandbox Code Playgroud) 看起来这应该比我发现它更简单.
我AVFoundation在标准委托方法中有一个框架:
- (void)captureOutput:(AVCaptureOutput *)captureOutput
didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
fromConnection:(AVCaptureConnection *)connection
Run Code Online (Sandbox Code Playgroud)
我想在哪里使用Accelerate.Framework.将帧转换为灰度.
框架中有一系列转换方法,包括vImageConvert_RGBA8888toPlanar8(),看起来它可能是我想看到的,但是,我找不到任何如何使用它们的示例!
到目前为止,我有代码:
- (void)captureOutput:(AVCaptureOutput *)captureOutput
didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
fromConnection:(AVCaptureConnection *)connection
{
@autoreleasepool {
CVImageBufferRef imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer);
/*Lock the image buffer*/
CVPixelBufferLockBaseAddress(imageBuffer,0);
/*Get information about the image*/
uint8_t *baseAddress = (uint8_t *)CVPixelBufferGetBaseAddress(imageBuffer);
size_t width = CVPixelBufferGetWidth(imageBuffer);
size_t height = CVPixelBufferGetHeight(imageBuffer);
size_t stride = CVPixelBufferGetBytesPerRow(imageBuffer);
// vImage In
Pixel_8 *bitmap = (Pixel_8 *)malloc(width * height * sizeof(Pixel_8));
const vImage_Buffer inImage = { bitmap, height, width, stride };
//How …Run Code Online (Sandbox Code Playgroud) iphone image-processing objective-c accelerate-framework vimage