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