GPUImage简单说明

一、介绍

GPUImage是Brad Larson在github托管的一个开源项目,项目实现了图片滤镜、摄像头实时滤镜,该项目的优点不但在于滤镜很多,而且处理效果是基于GPU的,比使用CPU性能更高。

二、类库

1.输入源

在Sources文件夹下包含了GPUImageVideoCamera相机视频输入源,GPUImageStillCamera相机图像输入源,GPUImagePicture静态图片输入源,GPUImageMovie视频输入源。

2.通道

GPUImageFilterPipeline将输入源利用滤镜组投射到输出界面上。

3.滤镜

3.1调整颜色的滤镜

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

GPUImageBrightnessFilter//亮度

GPUImageExposureFilter//曝光

GPUImageContrastFilter//对比度

GPUImageSaturationFilter//饱和度

GPUImageGammaFilter//伽马线

GPUImageLevelsFilter

GPUImageColorMatrixFilter

GPUImageRGBFilter

GPUImageHueFilter

GPUImageToneCurveFilter

GPUImageHighlightShadowFilter

GPUImageLookupFilter

GPUImageAmatorkaFilter

GPUImageMissEtikateFilter

GPUImageSoftEleganceFilter

GPUImageColorInvertFilter

GPUImageGrayscaleFilter

GPUImageMonochromeFilter

GPUImageFalseColorFilter

GPUImageHazeFilter

GPUImageSepiaFilter

GPUImageOpacityFilter

GPUImageSolidColorGenerator

GPUImageLuminanceThresholdFilter

GPUImageAdaptiveThresholdFilter

GPUImageAverageLuminanceThresholdFilter

GPUImageHistogramFilter

GPUImageHistogramGenerator

GPUImageAverageColor

GPUImageLuminosity

GPUImageChromaKeyFilter

3.2图像处理

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

GPUImageTransformFilter//变化

GPUImageCropFilter//

GPUImageLanczosResamplingFilter

GPUImageSharpenFilter

GPUImageUnsharpMaskFilter

GPUImageFastBlurFilter

GPUImageSingleComponentFastBlurFilter

GPUImageGaussianBlurFilter

GPUImageSingleComponentGaussianBlurFilter

GPUImageGaussianSelectiveBlurFilter

GPUImageGaussianBlurPositionFilter

GPUImageMedianFilter

GPUImageBilateralFilter

GPUImageTiltShiftFilter

GPUImageBoxBlurFilter

GPUImage3x3ConvolutionFilter

GPUImageSobelEdgeDetectionFilter

GPUImageThresholdEdgeDetectionFilter

GPUImageCannyEdgeDetectionFilter

GPUImageHarrisCornerDetectionFilter

GPUImageNobleCornerDetectionFilter

GPUImageShiTomasiCornerDetectionFilter

GPUImageNonMaximumSuppressionFilter

GPUImageXYDerivativeFilter

GPUImageCrosshairGenerator

GPUImageDilationFilter

GPUImageRGBDilationFilter

GPUImageErosionFilter

GPUImageRGBErosionFilter

GPUImageOpeningFilter

GPUImageRGBOpeningFilter

GPUImageClosingFilter

GPUImageRGBClosingFilter

GPUImageLocalBinaryPatternFilter

GPUImageLowPassFilter

GPUImageHighPassFilter

GPUImageMotionDetector

GPUImageHoughTransformLineDetector

GPUImageLineGenerator

GPUImageMotionBlurFilter

GPUImageZoomBlurFilter

3.3混合模式

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

GPUImageChromaKeyBlendFilter

GPUImageDissolveBlendFilter

GPUImageMultiplyBlendFilter

GPUImageAddBlendFilter

GPUImageSubtractBlendFilter

GPUImageDivideBlendFilter

GPUImageOverlayBlendFilter

GPUImageDarkenBlendFilter

GPUImageLightenBlendFilter

GPUImageColorBurnBlendFilter

GPUImageColorDodgeBlendFilter

GPUImageScreenBlendFilter

GPUImageExclusionBlendFilter

GPUImageDifferenceBlendFilter

GPUImageHardLightBlendFilter

GPUImageSoftLightBlendFilter

GPUImageAlphaBlendFilter

GPUImageSourceOverBlendFilter

GPUImageColorBurnBlendFilter

GPUImageColorDodgeBlendFilter

GPUImageNormalBlendFilter

GPUImageColorBlendFilter

GPUImageHueBlendFilter

GPUImageSaturationBlendFilter

GPUImageLuminosityBlendFilter

GPUImageLinearBurnBlendFilter

GPUImagePoissonBlendFilter

GPUImageMaskFilter

3.4视觉效果

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

GPUImagePixellateFilter

GPUImagePolarPixellateFilter

GPUImagePolkaDotFilter

GPUImageHalftoneFilter

GPUImageCrosshatchFilter

GPUImageSketchFilter

GPUImageThresholdSketchFilter

GPUImageToonFilter

GPUImageSmoothToonFilter

GPUImageEmbossFilter

GPUImagePosterizeFilter

GPUImageSwirlFilter

GPUImageBulgeDistortionFilter

GPUImagePinchDistortionFilter

GPUImageStretchDistortionFilter

GPUImageSphereRefractionFilter

GPUImageGlassSphereFilter

GPUImageVignetteFilter

GPUImageKuwaharaFilter

GPUImageKuwaharaRadius3Filter

GPUImagePerlinNoiseFilter

GPUImageCGAColorspaceFilter

GPUImageMosaicFilter

GPUImageJFAVoronoiFilter

GPUImageVoronoiConsumerFilter

3.5.输出

在Outputs文件夹下,GPUImageView常用输出view,GPUImageMovieWriter视频重编码。

三、使用

1.将GPUImage工程拖到需要图像滤镜处理的工程中,导入框架

  • CoreMedia
  • CoreVideo
  • OpenGLES
  • AVFoundation
  • QuartzCore

2.在使用GPUImage的类中,引入#import “GPUImage.h”

3.创建一个输入源。如:

1

GPUImagePicture *staticPicture = [[GPUImagePicture alloc] initWithImage:stillImagesmoothlyScaleOutput:YES];

4.创建滤镜。如:

1

GPUImageFalseColorFilter *filter = [[GPUImageFalseColorFilter alloc] init];

5.创建输出界面。如:

1

GPUImageView *filteredVideoView = [[GPUImageView alloc] initWithFrame:CGRectMake(0.0, 0.0, viewWidth, viewHeight)];

也可将自己现成的view,作为输出界面,强制类型转换(GPUImageView*)self.view。
6.创建通道。如:

1

GPUImageFilterPipeline *pipeline = [[GPUImageFilterPipeline alloc]initWithOrderedFilters:arrayTempinput:staticPictureoutput:(GPUImageView*)self.view];

7.图片图像处理

1

2

[staticPicture processImage];

[videoCamera startCameraCapture];

四、下载

github下载

注:后面会把每个滤镜的基本功能注释码上

 

你可能感兴趣的:(image)