Sharpening of GPUImage filter and gpuimage Filter

Source: Internet
Author: User

Sharpening of GPUImage filter and gpuimage Filter

The sharpening tool can be used to quickly focus on blurred edges, improve the clarity or focal length of a specific part of the image, and make the color of a specific area of the image clearer. When applying the sharpen tool, if you select the "sample for all layers" check box in the options bar, you can sharpen the images in all visible layers. But it must be moderate. Sharpening is not omnipotent, and it is easy to make things unreal.

Use the GPUImageSharpenFilter class in GPUImage to sharpen the image.

Segment coloring

 precision highp float;  varying highp vec2 textureCoordinate; varying highp vec2 leftTextureCoordinate; varying highp vec2 rightTextureCoordinate;  varying highp vec2 topTextureCoordinate; varying highp vec2 bottomTextureCoordinate;  varying highp float centerMultiplier; varying highp float edgeMultiplier; uniform sampler2D inputImageTexture;  void main() {     mediump vec3 textureColor = texture2D(inputImageTexture, textureCoordinate).rgb;     mediump vec3 leftTextureColor = texture2D(inputImageTexture, leftTextureCoordinate).rgb;     mediump vec3 rightTextureColor = texture2D(inputImageTexture, rightTextureCoordinate).rgb;     mediump vec3 topTextureColor = texture2D(inputImageTexture, topTextureCoordinate).rgb;     mediump vec3 bottomTextureColor = texture2D(inputImageTexture, bottomTextureCoordinate).rgb;     gl_FragColor = vec4((textureColor * centerMultiplier - (leftTextureColor * edgeMultiplier + rightTextureColor * edgeMultiplier + topTextureColor * edgeMultiplier + bottomTextureColor * edgeMultiplier)), texture2D(inputImageTexture, bottomTextureCoordinate).w); }

 

Specific Application

  

+ (UIImage *)changeValueForSharpenilter:(float)value image:(UIImage *)image{    GPUImageSharpenFilter *filter = [[GPUImageSharpenFilter alloc] init];    filter.sharpness = value;    [filter forceProcessingAtSize:image.size];    GPUImagePicture *pic = [[GPUImagePicture alloc] initWithImage:image];    [pic addTarget:filter];        [pic processImage];    [filter useNextFrameForImageCapture];    return [filter imageFromCurrentFramebuffer];}

 

Effect

  

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.