2017-05-09 2 views
0

GPUImageフレームワークを使用して2つの画像を減算しようとしています。正しい方法はGPUImageSubtractBlendFilterを使うことだと思います。私はUIImagesの配列を持っており、両方の画像を引くために次のコードを実行しています。GPUImageSubtractBlendFilter GPUImageフレームワークを使用した2つの画像

GPUImageSubtractBlendFilter *subFilter = [[GPUImageSubtractBlendFilter alloc] init]; 
GPUImagePicture *img1 = [[GPUImagePicture alloc] initWithImage:[imagesArray objectAtIndex:0]]; 
GPUImagePicture *img2 = [[GPUImagePicture alloc] initWithImage:[imagesArray objectAtIndex:1]]; 

//consider modifications to filter possibly? 

[img1 addTarget:subFilter]; 
[img2 addTarget:subFilter]; 

[img1 processImage]; 
[img2 processImage]; 
CGImageRef processedImage = [subFilter newCGImageFromCurrentlyProcessedOutput]; 

私はまた、コンソールで次のエラー出力を取得しています:

libMobileGestalt MobileGestaltSupport.m:153: pid 627 (appName) does not have sandbox access for frZQaeyWLUvLjeuEK43hmg and IS NOT appropriately entitled 
libMobileGestalt MobileGestalt.c:550: no access to InverseDeviceID (see <rdar://problem/11744455>) 
*** Assertion failure in - 
GPUImage-master/framework/Source/GPUImageFramebuffer.m:156 
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Error at CVPixelBufferCreate -6661' 
*** First throw call stack: 
(0x186aa2fd8 0x185504538 0x186aa2eac 0x18753a710 0x1001b519c 0x1001b87dc 0x1001b4e40 0x1001b4858 0x1001b75b4 0x1001b87dc 0x1001b72e8 0x1001d5bd0 0x1001d4898 0x1001d6784 0x1001c5e4c 0x100311a50 0x100311a10 0x10031f2e8 0x100315634 0x100321630 0x10032139c 0x185b631d0 0x185b62d7c) 
libc++abi.dylib: terminating with uncaught exception of type NSException 

私processedImageは皆無であることが判明しています。私はARCを使用しているので、私はリリースを処理していません。もし私が何か間違っていると私に教えてください、あなたがいくつかの例とフィルタの使用に関する情報に私を指すことができれば、それは非常に感謝します!

答えて

0

私のコードは、2枚の画像の出力を達成する前に

[subFilter useNextFrameForImageCapture]; 

がありませんでした。同じ種類の例がここにあります: https://stackoverflow.com/a/30730364/5071756

関連する問題