强大的图像处理库---GPUImage

iOS开发中,想要做图像处理,可以用Core Image,Core Image提供强大的滤镜效果,可以对图像和照相机的视频流做处理。今天介绍的是比Core Image更牛掰的一个开源库GPUImage!GPUImage托管在GitHub上,是一个遵守BSD开源协议的开源库,可以放心大胆的使用!

GPUImage顾名思义是利用GPU来做图像处理的,相比于CPU要快很多,不至于你的图像处理过程很慢,特别是处理很大的图像时,比如高清视频。GPUImage支持iOS4.0以上,当然iOS8已经发布的今天,你应该不会去适配iOS4了吧!GPUImage封装了OpenGL ES2.0,接口设计简单明了,支持ARC,这样就可以不管OpenGL ES的复杂接口而使用它的处理性能啦。并且作者一直在更新,有支持Swift的倾向,还是值得一学的。

要处理的源对像应该是GPUImageOutput的子类对象,比如:

GPUImageVideoCamera(来自摄像头的实时视频)
GPUImageStillCamera(摄像头照的照片)
GPUImagePicture(静态图片)
GPUImageMovie(电影)

源对象加载静态图像,作为OpenGL ES的纹理对象,然后一帧一帧往下处理。滤镜和其他的一些遵守GPUImageInput协议,可以用来处理OpenGL ES的纹理,比如,应用程序想要处理实时视频,把视频处理成深褐色,然后显示到屏幕上,就需要GPUImageVideoCamera -> GPUImageSepiaFilter -> GPUImageView。


下面是GPUImage里面所有的类:

基础类:

#import "GPUImageContext.h"

#import "GPUImageOutput.h"

#import "GPUImageView.h"

#import "GPUImageVideoCamera.h"

#import "GPUImageStillCamera.h"

#import "GPUImageMovie.h"

#import "GPUImagePicture.h"

#import "GPUImageRawDataInput.h"

#import "GPUImageRawDataOutput.h"

#import "GPUImageMovieWriter.h"

#import "GPUImageFilterPipeline.h"

#import "GPUImageTextureOutput.h"

#import "GPUImageFilterGroup.h"

#import "GPUImageTextureInput.h"

#import "GPUImageUIElement.h"

#import "GPUImageBuffer.h"

#import "GPUImageFramebuffer.h"

#import "GPUImageFramebufferCache.h"


滤镜类:

#import "GPUImageFilter.h"

#import "GPUImageTwoInputFilter.h"

#import "GPUImagePixellateFilter.h"

#import "GPUImagePixellatePositionFilter.h"

#import "GPUImageSepiaFilter.h"

#import "GPUImageColorInvertFilter.h"

#import "GPUImageSaturationFilter.h"

#import "GPUImageContrastFilter.h"

#import "GPUImageExposureFilter.h"

#import "GPUImageBrightnessFilter.h"

#import "GPUImageLevelsFilter.h"

#import "GPUImageSharpenFilter.h"

#import "GPUImageGammaFilter.h"

#import "GPUImageSobelEdgeDetectionFilter.h"

#import "GPUImageSketchFilter.h"

#import "GPUImageToonFilter.h"

#import "GPUImageSmoothToonFilter.h"

#import "GPUImageMultiplyBlendFilter.h"

#import "GPUImageDissolveBlendFilter.h"

#import "GPUImageKuwaharaFilter.h"

#import "GPUImageKuwaharaRadius3Filter.h"

#import "GPUImageVignetteFilter.h"

#import "GPUImageGaussianBlurFilter.h"

#import "GPUImageGaussianBlurPositionFilter.h"

#import "GPUImageGaussianSelectiveBlurFilter.h"

#import "GPUImageOverlayBlendFilter.h"

#import "GPUImageDarkenBlendFilter.h"

#import "GPUImageLightenBlendFilter.h"

#import "GPUImageSwirlFilter.h"

#import "GPUImageSourceOverBlendFilter.h"

#import "GPUImageColorBurnBlendFilter.h"

#import "GPUImageColorDodgeBlendFilter.h"

#import "GPUImageScreenBlendFilter.h"

#import "GPUImageExclusionBlendFilter.h"

#import "GPUImageDifferenceBlendFilter.h"

#import "GPUImageSubtractBlendFilter.h"

#import "GPUImageHardLightBlendFilter.h"

#import "GPUImageSoftLightBlendFilter.h"

#import "GPUImageColorBlendFilter.h"

#import "GPUImageHueBlendFilter.h"

#import "GPUImageSaturationBlendFilter.h"

#import "GPUImageLuminosityBlendFilter.h"

#import "GPUImageCropFilter.h"

#import "GPUImageGrayscaleFilter.h"

#import "GPUImageTransformFilter.h"

#import "GPUImageChromaKeyBlendFilter.h"

#import "GPUImageHazeFilter.h"

#import "GPUImageLuminanceThresholdFilter.h"

#import "GPUImagePosterizeFilter.h"

#import "GPUImageBoxBlurFilter.h"

#import "GPUImageAdaptiveThresholdFilter.h"

#import "GPUImageUnsharpMaskFilter.h"

#import "GPUImageBulgeDistortionFilter.h"

#import "GPUImagePinchDistortionFilter.h"

#import "GPUImageCrosshatchFilter.h"

#import "GPUImageCGAColorspaceFilter.h"

#import "GPUImagePolarPixellateFilter.h"

#import "GPUImageStretchDistortionFilter.h"

#import "GPUImagePerlinNoiseFilter.h"

#import "GPUImageJFAVoronoiFilter.h"

#import "GPUImageVoronoiConsumerFilter.h"

#import "GPUImageMosaicFilter.h"

#import "GPUImageTiltShiftFilter.h"

#import "GPUImage3x3ConvolutionFilter.h"

#import "GPUImageEmbossFilter.h"

#import "GPUImageCannyEdgeDetectionFilter.h"

#import "GPUImageThresholdEdgeDetectionFilter.h"

#import "GPUImageMaskFilter.h"

#import "GPUImageHistogramFilter.h"

#import "GPUImageHistogramGenerator.h"

#import "GPUImageHistogramEqualizationFilter.h"

#import "GPUImagePrewittEdgeDetectionFilter.h"

#import "GPUImageXYDerivativeFilter.h"

#import "GPUImageHarrisCornerDetectionFilter.h"

#import "GPUImageAlphaBlendFilter.h"

#import "GPUImageNormalBlendFilter.h"

#import "GPUImageNonMaximumSuppressionFilter.h"

#import "GPUImageRGBFilter.h"

#import "GPUImageMedianFilter.h"

#import "GPUImageBilateralFilter.h"

#import "GPUImageCrosshairGenerator.h"

#import "GPUImageToneCurveFilter.h"

#import "GPUImageNobleCornerDetectionFilter.h"

#import "GPUImageShiTomasiFeatureDetectionFilter.h"

#import "GPUImageErosionFilter.h"

#import "GPUImageRGBErosionFilter.h"

#import "GPUImageDilationFilter.h"

#import "GPUImageRGBDilationFilter.h"

#import "GPUImageOpeningFilter.h"

#import "GPUImageRGBOpeningFilter.h"

#import "GPUImageClosingFilter.h"

#import "GPUImageRGBClosingFilter.h"

#import "GPUImageColorPackingFilter.h"

#import "GPUImageSphereRefractionFilter.h"

#import "GPUImageMonochromeFilter.h"

#import "GPUImageOpacityFilter.h"

#import "GPUImageHighlightShadowFilter.h"

#import "GPUImageFalseColorFilter.h"

#import "GPUImageHSBFilter.h"

#import "GPUImageHueFilter.h"

#import "GPUImageGlassSphereFilter.h"

#import "GPUImageLookupFilter.h"

#import "GPUImageAmatorkaFilter.h"

#import "GPUImageMissEtikateFilter.h"

#import "GPUImageSoftEleganceFilter.h"

#import "GPUImageAddBlendFilter.h"

#import "GPUImageDivideBlendFilter.h"

#import "GPUImagePolkaDotFilter.h"

#import "GPUImageLocalBinaryPatternFilter.h"

#import "GPUImageLanczosResamplingFilter.h"

#import "GPUImageAverageColor.h"

#import "GPUImageSolidColorGenerator.h"

#import "GPUImageLuminosity.h"

#import "GPUImageAverageLuminanceThresholdFilter.h"

#import "GPUImageWhiteBalanceFilter.h"

#import "GPUImageChromaKeyFilter.h"

#import "GPUImageLowPassFilter.h"

#import "GPUImageHighPassFilter.h"

#import "GPUImageMotionDetector.h"

#import "GPUImageHalftoneFilter.h"

#import "GPUImageThresholdedNonMaximumSuppressionFilter.h"

#import "GPUImageHoughTransformLineDetector.h"

#import "GPUImageParallelCoordinateLineTransformFilter.h"

#import "GPUImageThresholdSketchFilter.h"

#import "GPUImageLineGenerator.h"

#import "GPUImageLinearBurnBlendFilter.h"

#import "GPUImageGaussianBlurPositionFilter.h"

#import "GPUImagePixellatePositionFilter.h"

#import "GPUImageTwoInputCrossTextureSamplingFilter.h"

#import "GPUImagePoissonBlendFilter.h"

#import "GPUImageMotionBlurFilter.h"

#import "GPUImageZoomBlurFilter.h"

#import "GPUImageLaplacianFilter.h"

#import "GPUImageiOSBlurFilter.h"

#import "GPUImageLuminanceRangeFilter.h"


引入GPUImage到你的工程里面也跟其他的第三方不一样,没有CocoaPod可以用,只能手动引入,有两种方法:

1、可以把源文件全部拖到你的工程里边,这样你就可以看见.h和.m文件了,这样做的话,你需要手动添加GPUImage需要的库:

CoreMedia
CoreVideo
OpenGL ES
AVFoundation
QuartzCore

2、如果你不想看见.m文件可以把它编译成静态库,加入到你的工程,就像加入系统自带的那些框架一样:


选择Add Other...找到你编译的静态库就可以啦,这样你就不用手动添加GPUImage需要的那些库啦。编译静态库的方法是:

打开终端--->cd 你下载的GPUImage包----->sh build.sh

这样你就可以编译成功啦,你也可以修改要编译的目标SDK,用文本编辑器打开build.sh就可以修改啦。编译好的文件在build问价夹里。


在需要用到GPUImage的文件里,加入头文件:

#import <GPUImage/GPUImage.h>,如果不是编译成静态库,就这样引用:#import "GPUImage.h"。


接下来你就可以使用啦,使用的方法我还没有深究,可以参考http://code.tutsplus.com/tutorials/build-a-photo-app-with-gpuimage--mobile-12223

就写到这吧!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值