catalogue
Zero foundation OpenGL (ES) learning route recommendation: OpenGL (ES) learning directory >> OpenGL ES Basics
Zero foundation OpenGL (ES) learning route recommendation: OpenGL (ES) learning directory >> OpenGL ES transition
Zero foundation OpenGL (ES) learning route recommendation: OpenGL (ES) learning directory >> OpenGL ES special effects
Zero foundation OpenGL (ES) learning route recommendation: OpenGL (ES) learning directory >> OpenGL ES functions
Zero foundation OpenGL (ES) learning route recommendation: OpenGL (ES) learning directory >> OpenGL ES GPUImage use
Zero foundation OpenGL (ES) learning route recommendation: OpenGL (ES) learning directory >> OpenGL ES GLSL programming
1, Introduction
GPUImage There are 125 filters in total, which are divided into four categories
1. Color adjustments: 31 filters, color processing related
2. Image processing: 40 filters, image processing related
3. Blending modes: 29 filters, mixed mode correlation
4. Visual effects: 25 filters, visual effects related
GPUImageXYDerivativeFilter It is related to the visual effect of GPUImage images and is used for XYDerivative edge detection of images. The source code of shader is as follows:
/******************************************************************************************/ //@Author: apes say programming //@Blog (personal blog address): www.codersrc.com //@File:IOS – OpenGL ES GPUImage GPUImageXYDerivativeFilter //@Time:2022/07/02 06:30 //@Motto: no small steps, no small streams, no rivers and seas. The brilliance of program life needs to be accumulated unremittingly! /******************************************************************************************/ #if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE NSString *const kGPUImageGradientFragmentShaderString = SHADER_STRING ( precision highp float; varying vec2 textureCoordinate; varying vec2 leftTextureCoordinate; varying vec2 rightTextureCoordinate; varying vec2 topTextureCoordinate; varying vec2 topLeftTextureCoordinate; varying vec2 topRightTextureCoordinate; varying vec2 bottomTextureCoordinate; varying vec2 bottomLeftTextureCoordinate; varying vec2 bottomRightTextureCoordinate; uniform sampler2D inputImageTexture; uniform float edgeStrength; void main() { float topIntensity = texture2D(inputImageTexture, topTextureCoordinate).r; float topRightIntensity = texture2D(inputImageTexture, topRightTextureCoordinate).r; float topLeftIntensity = texture2D(inputImageTexture, topLeftTextureCoordinate).r; float bottomIntensity = texture2D(inputImageTexture, bottomTextureCoordinate).r; float bottomLeftIntensity = texture2D(inputImageTexture, bottomLeftTextureCoordinate).r; float bottomRightIntensity = texture2D(inputImageTexture, bottomRightTextureCoordinate).r; float leftIntensity = texture2D(inputImageTexture, leftTextureCoordinate).r; float rightIntensity = texture2D(inputImageTexture, rightTextureCoordinate).r; float verticalDerivative = -topLeftIntensity - topIntensity - topRightIntensity + bottomLeftIntensity + bottomIntensity + bottomRightIntensity; float horizontalDerivative = -bottomLeftIntensity - leftIntensity - topLeftIntensity + bottomRightIntensity + rightIntensity + topRightIntensity; verticalDerivative = verticalDerivative * edgeStrength; horizontalDerivative = horizontalDerivative * edgeStrength; // Scaling the X * Y operation so that negative numbers are not clipped in the 0..1 range. This will be expanded in the corner detection filter gl_FragColor = vec4(horizontalDerivative * horizontalDerivative, verticalDerivative * verticalDerivative, ((verticalDerivative * horizontalDerivative) + 1.0) / 2.0, 1.0); } ); #else NSString *const kGPUImageGradientFragmentShaderString = SHADER_STRING ( varying vec2 textureCoordinate; varying vec2 leftTextureCoordinate; varying vec2 rightTextureCoordinate; varying vec2 topTextureCoordinate; varying vec2 topLeftTextureCoordinate; varying vec2 topRightTextureCoordinate; varying vec2 bottomTextureCoordinate; varying vec2 bottomLeftTextureCoordinate; varying vec2 bottomRightTextureCoordinate; uniform sampler2D inputImageTexture; uniform float edgeStrength; void main() { float topIntensity = texture2D(inputImageTexture, topTextureCoordinate).r; float topRightIntensity = texture2D(inputImageTexture, topRightTextureCoordinate).r; float topLeftIntensity = texture2D(inputImageTexture, topLeftTextureCoordinate).r; float bottomIntensity = texture2D(inputImageTexture, bottomTextureCoordinate).r; float bottomLeftIntensity = texture2D(inputImageTexture, bottomLeftTextureCoordinate).r; float bottomRightIntensity = texture2D(inputImageTexture, bottomRightTextureCoordinate).r; float leftIntensity = texture2D(inputImageTexture, leftTextureCoordinate).r; float rightIntensity = texture2D(inputImageTexture, rightTextureCoordinate).r; float verticalDerivative = -topLeftIntensity - topIntensity - topRightIntensity + bottomLeftIntensity + bottomIntensity + bottomRightIntensity; float horizontalDerivative = -bottomLeftIntensity - leftIntensity - topLeftIntensity + bottomRightIntensity + rightIntensity + topRightIntensity; verticalDerivative = verticalDerivative * edgeStrength; horizontalDerivative = horizontalDerivative * edgeStrength; // Scaling the X * Y operation so that negative numbers are not clipped in the 0..1 range. This will be expanded in the corner detection filter gl_FragColor = vec4(horizontalDerivative * horizontalDerivative, verticalDerivative * verticalDerivative, ((verticalDerivative * horizontalDerivative) + 1.0) / 2.0, 1.0); } ); #endif
2, Effect demonstration
use GPUImageXYDerivativeFilter **, * * the original figure is as follows:
use GPUImageXYDerivativeFilter The effect is as follows:
3, Source code download
OpenGL ES Demo download address: IOS OpenGL ES GPUImage image xyderivativeedge detection GPUImageXYDerivativeFilter
4, Guess you like it
- IOS OPenGL ES set image brightness GPUImageBrightnessFilter
- IOS OPenGL ES adjust image exposure GPUImageExposureFilter
- IOS OpenGL ES adjust image contrast gpuimagecontractfilter
- IOS OPenGL ES adjust image saturation GPUImageSaturationFilter
- IOS OPenGL ES adjust image gamma line GPUImageGammaFilter
- IOS OpenGL ES adjust image anti color GPUImageColorInvertFilter
- IOS OpenGL ES adjust image brown GPUImageSepiaFilter
- IOS OpenGL ES adjust image gray GPUImageGrayscaleFilter
- IOS OpenGL ES adjust image RGB channel GPUImageRGBFilter
- IOS OpenGL ES adjust image opacity GPUImageOpacityFilter
- IOS OpenGL ES adjust image shadow GPUImageHighlightShadowFilter
- IOS OpenGL ES adjust image color replace GPUImageFalseColorFilter
- GPUImage - color histogram GPUImageHistogramFilter
- GPUImage – color histogram GPUImageHistogramGenerator
- GPUImage – pixel average color value GPUImageAverageColor
- GPUImage - brightness average GPUImageLuminosity
- IOS OpenGL ES adjust image chroma GPUImageHueFilter
- IOS OpenGL ES specifies color matting GPUImageChromaKeyFilter
- IOS OpenGL ES adjust image white balance / color temperature GPUImageWhiteBalanceFilter
- IOS OpenGL ES setting image lookup filter GPUImageLookupFilter
- IOS OpenGL ES setting image filter GPUImageAmatorkaFilter
- IOS OpenGL ES set image filter GPUImageSoftEleganceFilter
- IOS OpenGL ES set image sharpening GPUImageSharpenFilter
- IOS OpenGL ES drawing cross GPUImageCrosshairGenerator
- IOS OpenGL ES drawing lines GPUImageLineGenerator
- IOS OpenGL ES set image black and white dots GPUImageLocalBinaryPatternFilter
- IOS OpenGL ES set image cartoon effect (black thick line stroke) GPUImageToonFilter
- IOS OpenGL ES sangyuan filter / gouache blur effect GPUImageKuwaharaFilter
- IOS OpenGL ES black and white mosaic effect gpuimagemosaic filter
- IOS OpenGL ES pixelated mosaic effect GPUImagePixellateFilter
- IOS OpenGL ES concentric circle pixelated mosaic effect GPUImagePolarPixel
- IOS OpenGL ES black and white mesh effect gpuimagecrosshatchefilter
- IOS OpenGL ES color loss / Blur effect GPUImageColorPackingFilter
- IOS OpenGL ES image vignettefilter GPUImageVignetteFilter
- IOS OpenGL ES image vortex GPUImageSwirlFilter
- IOS OpenGL ES image fisheye diffusion effect gpuimagebulgedisportionfilter
- IOS OpenGL ES image fisheye movement effect gpuimagebulgedisportionfilter
- IOS OpenGL ES image concave mirror moving effect gpuimagepinchdistorionfilter
- IOS OpenGL ES image concave mirror magnification effect gpuimagepinchdistorionfilter
- IOS OpenGL ES image hatching mirror effect GPUImageStretchDistortionFilter
- IOS OpenGL ES image crystal ball effect GPUImageGlassSphereFilter
- IOS OpenGL ES image spherical refraction GPUImageSphereRefractionFilter
- IOS OpenGL ES image hue separation noise effect GPUImagePosterizeFilter
- IOS OpenGL ES image CGA color filter GPUImageCGAColorspaceFilter
- IOS OpenGL ES image Berlin noise / Lace noise GPUImagePerlinNoiseFilter
- IOS OpenGL ES image highlight edge gpuimage3x3colutionfilter
- IOS OpenGL ES image relief 3d effect GPUImageEmbossFilter
- IOS OpenGL ES image mosaic dot GPUImagePolkaDotFilter
- IOS OpenGL ES image erosion edge black and white blur GPUImageErosionFilter
- IOS OpenGL ES image erosion edge color blur GPUImageRGBErosionFilter
- IOS OpenGL ES image extended edge black and white blur GPUImageDilationFilter
- IOS OpenGL ES image extended edge color blur GPUImageRGBDilationFilter
- IOS OpenGL ES GPUImage black and white tone blur GPUImageOpeningFilter
- IOS OpenGL ES GPUImage color blur GPUImageRGBOpeningFilter
- IOS OpenGL ES GPUImage image black and white tone blur / dark color brighten GPUImageClosingFilter
- IOS OpenGL ES GPUImage image color blur / dark brighten GPUImageRGBClosingFilter
- IOS OpenGL ES GPUImage image Lanczos resampling blur effect GPUImageLanczosResamplingFilter
- IOS OpenGL ES GPUImage image shows the pixels with the highest brightness, and the others are black gpuimagenonmeximumsuppressionfilter
- IOS OpenGL ES GPUImage image shows the pixels with the highest brightness, and the others are black gpuimagethresholdnonmeximumsuppressionfilter
- IOS OpenGL ES GPUImage image Sobel edge detection, similar to comic anti color GPUImageSobelEdgeDetectionFilter
- IOS OpenGL ES GPUImage GPUImageWeakPixelInclusionFilter
- IOS OpenGL ES GPUImage GPUImageDirectionalNonMaximumSuppressionFilter
- IOS OpenGL ES GPUImage image threshold edge detection GPUImageThresholdEdgeDetectionFilter
- IOS OpenGL ES GPUImage image Prewitt edge detection GPUImagePrewittEdgeDetectionFilter
- IOS OpenGL ES GPUImage image xyderivativeedge detection GPUImageXYDerivativeFilter
This article is written by blog - Ape programming Ape programming release!