美文网首页
GPUImage翻译五:内置滤镜 (视觉效果Visual eff

GPUImage翻译五:内置滤镜 (视觉效果Visual eff

作者: 开发者老岳 | 来源:发表于2018-08-15 18:06 被阅读74次

视觉效果 (Visual effects)

  • GPUImagePixellateFilter: Applies a pixellation effect on an image or video

    • fractionalWidthOfAPixel: How large the pixels are, as a fraction of the width and height of the image (0.0 - 1.0, default 0.05)
  • GPUImagePolarPixellateFilter: Applies a pixellation effect on an image or video, based on polar coordinates instead of Cartesian ones

    • center: The center about which to apply the pixellation, defaulting to (0.5, 0.5)
    • pixelSize: The fractional pixel size, split into width and height components. The default is (0.05, 0.05)
  • GPUImagePolkaDotFilter: Breaks an image up into colored dots within a regular grid

    • fractionalWidthOfAPixel: How large the dots are, as a fraction of the width and height of the image (0.0 - 1.0, default 0.05)
    • dotScaling: What fraction of each grid space is taken up by a dot, from 0.0 to 1.0 with a default of 0.9.
  • GPUImageHalftoneFilter: Applies a halftone effect to an image, like news print

    • fractionalWidthOfAPixel: How large the halftone dots are, as a fraction of the width and height of the image (0.0 - 1.0, default 0.05)
  • GPUImageCrosshatchFilter: This converts an image into a black-and-white crosshatch pattern

    • crossHatchSpacing: The fractional width of the image to use as the spacing for the crosshatch. The default is 0.03.
    • lineWidth: A relative width for the crosshatch lines. The default is 0.003.
  • GPUImageSketchFilter: Converts video to look like a sketch. This is just the Sobel edge detection filter with the colors inverted

    • texelWidth:
    • texelHeight: These parameters affect the visibility of the detected edges
    • edgeStrength: Adjusts the dynamic range of the filter. Higher values lead to stronger edges, but can saturate the intensity colorspace. Default is 1.0.
  • GPUImageThresholdSketchFilter: Same as the sketch filter, only the edges are thresholded instead of being grayscale

    • texelWidth:
    • texelHeight: These parameters affect the visibility of the detected edges
    • edgeStrength: Adjusts the dynamic range of the filter. Higher values lead to stronger edges, but can saturate the intensity colorspace. Default is 1.0.
    • threshold: Any edge above this threshold will be black, and anything below white. Ranges from 0.0 to 1.0, with 0.8 as the default
  • GPUImageToonFilter: This uses Sobel edge detection to place a black border around objects, and then it quantizes the colors present in the image to give a cartoon-like quality to the image.

    • texelWidth:
    • texelHeight: These parameters affect the visibility of the detected edges
    • threshold: The sensitivity of the edge detection, with lower values being more sensitive. Ranges from 0.0 to 1.0, with 0.2 as the default
    • quantizationLevels: The number of color levels to represent in the final image. Default is 10.0
  • GPUImageSmoothToonFilter: This uses a similar process as the GPUImageToonFilter, only it precedes the toon effect with a Gaussian blur to smooth out noise.

    • texelWidth:
    • texelHeight: These parameters affect the visibility of the detected edges
    • blurRadiusInPixels: The radius of the underlying Gaussian blur. The default is 2.0.
    • threshold: The sensitivity of the edge detection, with lower values being more sensitive. Ranges from 0.0 to 1.0, with 0.2 as the default
    • quantizationLevels: The number of color levels to represent in the final image. Default is 10.0
  • GPUImageEmbossFilter: Applies an embossing effect on the image

    • intensity: The strength of the embossing, from 0.0 to 4.0, with 1.0 as the normal level
  • GPUImagePosterizeFilter: This reduces the color dynamic range into the number of steps specified, leading to a cartoon-like simple shading of the image.

    • colorLevels: The number of color levels to reduce the image space to. This ranges from 1 to 256, with a default of 10.
  • GPUImageSwirlFilter: Creates a swirl distortion on the image

    • radius: The radius from the center to apply the distortion, with a default of 0.5
    • center: The center of the image (in normalized coordinates from 0 - 1.0) about which to twist, with a default of (0.5, 0.5)
    • angle: The amount of twist to apply to the image, with a default of 1.0
  • GPUImageBulgeDistortionFilter: Creates a bulge distortion on the image

    • radius: The radius from the center to apply the distortion, with a default of 0.25
    • center: The center of the image (in normalized coordinates from 0 - 1.0) about which to distort, with a default of (0.5, 0.5)
    • scale: The amount of distortion to apply, from -1.0 to 1.0, with a default of 0.5
  • GPUImagePinchDistortionFilter: Creates a pinch distortion of the image

    • radius: The radius from the center to apply the distortion, with a default of 1.0
    • center: The center of the image (in normalized coordinates from 0 - 1.0) about which to distort, with a default of (0.5, 0.5)
    • scale: The amount of distortion to apply, from -2.0 to 2.0, with a default of 1.0
  • GPUImageStretchDistortionFilter: Creates a stretch distortion of the image

    • center: The center of the image (in normalized coordinates from 0 - 1.0) about which to distort, with a default of (0.5, 0.5)
  • GPUImageSphereRefractionFilter: Simulates the refraction through a glass sphere

    • center: The center about which to apply the distortion, with a default of (0.5, 0.5)
    • radius: The radius of the distortion, ranging from 0.0 to 1.0, with a default of 0.25
    • refractiveIndex: The index of refraction for the sphere, with a default of 0.71
  • GPUImageGlassSphereFilter: Same as the GPUImageSphereRefractionFilter, only the image is not inverted and there's a little bit of frosting at the edges of the glass

    • center: The center about which to apply the distortion, with a default of (0.5, 0.5)
    • radius: The radius of the distortion, ranging from 0.0 to 1.0, with a default of 0.25
    • refractiveIndex: The index of refraction for the sphere, with a default of 0.71
  • GPUImageVignetteFilter: Performs a vignetting effect, fading out the image at the edges

    • vignetteCenter: The center for the vignette in tex coords (CGPoint), with a default of 0.5, 0.5
    • vignetteColor: The color to use for the vignette (GPUVector3), with a default of black
    • vignetteStart: The normalized distance from the center where the vignette effect starts, with a default of 0.5
    • vignetteEnd: The normalized distance from the center where the vignette effect ends, with a default of 0.75
  • GPUImageKuwaharaFilter: Kuwahara image abstraction, drawn from the work of Kyprianidis, et. al. in their publication "Anisotropic Kuwahara Filtering on the GPU" within the GPU Pro collection. This produces an oil-painting-like image, but it is extremely computationally expensive, so it can take seconds to render a frame on an iPad 2. This might be best used for still images.

    • radius: In integer specifying the number of pixels out from the center pixel to test when applying the filter, with a default of 4. A higher value creates a more abstracted image, but at the cost of much greater processing time.
  • GPUImageKuwaharaRadius3Filter: A modified version of the Kuwahara filter, optimized to work over just a radius of three pixels

  • GPUImagePerlinNoiseFilter: Generates an image full of Perlin noise

    • colorStart:
    • colorFinish: The color range for the noise being generated
    • scale: The scaling of the noise being generated
  • GPUImageCGAColorspaceFilter: Simulates the colorspace of a CGA monitor

  • GPUImageMosaicFilter: This filter takes an input tileset, the tiles must ascend in luminance. It looks at the input image and replaces each display tile with an input tile according to the luminance of that tile. The idea was to replicate the ASCII video filters seen in other apps, but the tileset can be anything.

    • inputTileSize:
    • numTiles:
    • displayTileSize:
    • colorOn:
  • GPUImageJFAVoronoiFilter: Generates a Voronoi map, for use in a later stage.

    • sizeInPixels: Size of the individual elements
  • GPUImageVoronoiConsumerFilter: Takes in the Voronoi map, and uses that to filter an incoming image.

    • sizeInPixels: Size of the individual elements

You can also easily write your own custom filters using the C-like OpenGL Shading Language, as described above.

相关文章

网友评论

      本文标题:GPUImage翻译五:内置滤镜 (视觉效果Visual eff

      本文链接:https://www.haomeiwen.com/subject/gmowbftx.html