ios gpuimage输入和得到原始数据

gpuimage中有GPUImageRawDataInput和GPUImageRawDataOutput两个类。


GPUImageRawDataOutput头文件:


#import <Foundation/Foundation.h>
#import "GPUImageContext.h"


struct GPUByteColorVector {
    GLubyte red;
    GLubyte green;
    GLubyte blue;
    GLubyte alpha;
};
typedef struct GPUByteColorVector GPUByteColorVector;


@protocol GPUhttp://blog.csdn.net/?ref=toolbar_logoImageRawDataProcessor;


#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE
@interface GPUImageRawDataOutput : NSObject <GPUImageInput> {
    CGSize imageSize;
    GPUImageRotationMode inputRotation;
    BOOL outputBGRA;
}
#else
@interface GPUImageRawDataOutput : NSObject <GPUImageInput> {
    CGSize imageSize;
    GPUImageRotationMode inputRotation;
    BOOL outputBGRA;
}
#endif


@property(readonly) GLubyte *rawBytesForImage;
@property(nonatomic, copy) void(^newFrameAvailableBlock)(void);
@property(nonatomic) BOOL enabled;


// Initialization and teardown
- (id)initWithImageSize:(CGSize)newImageSize resultsInBGRAFormat:(BOOL)resultsInBGRAFormat;


// Data access
- (GPUByteColorVector)colorAtLocation:(CGPoint)locationInImage;
- (NSUInteger)bytesPerRowInOutput;


- (void)setImageSize:(CGSize)newImageSize;


- (void)lockFramebufferForReading;
- (void)unlockFramebufferAfterReading;


@end


rawBytesForImage就是filter之后的数据了。


GPUImageRawDataInput也提供了processData方法以便使用原始数据做filter。
展开阅读全文

没有更多推荐了,返回首页