Sharpening of the Gpuimage filter

Source: Internet
Author: User

The sharpening tool can quickly focus the blurred edges, improve the sharpness or focal length of one part of the image, and make the color of specific areas of the image more vivid. When you apply the Sharpen tool, you can sharpen the image in all visible layers if the sample all layers check box is in the tick bar of the selector. But it must be moderate. Sharpening is not omnipotent, it is easy to make things untrue.

Using the Gpuimagesharpenfilter class in gpuimage to achieve the sharpening effect of the image

Fragment coloring

Precision HIGHPfloat; Varying HIGHP vec2 texturecoordinate; Varying HIGHP vec2 lefttexturecoordinate;  Varying HIGHP vec2 righttexturecoordinate; Varying HIGHP vec2 toptexturecoordinate;  Varying HIGHP vec2 bottomtexturecoordinate; Varying HIGHPfloatcentermultiplier, varying highpfloatedgemultiplier, uniform sampler2d inputimagetexture; voidMain () {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 + TopTex Turecolor * edgemultiplier + bottomtexturecolor *edgemultiplier)), Texture2d (Inputimagetexture, Bottomtexturecoordinate). W); }

Specific applications

  

+ (UIImage *) Changevalueforsharpenilter: (float) value Image: (UIImage *) image{    *filter = [[ Gpuimagesharpenfilter alloc] init];     = value;    [Filter forceProcessingAtSize:image.size];     *pic = [[Gpuimagepicture alloc] initwithimage:image];    [pic Addtarget:filter];        [pic Processimage];    [Filter usenextframeforimagecapture];     return [Filter Imagefromcurrentframebuffer];}

Effect

  

Sharpening of the Gpuimage filter

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.