ios gpuimage输入和得到原始数据

来源:互联网 发布:南昌金域名都租房 编辑:程序博客网 时间:2024/06/05 18:02
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。
0 0