星空网 > 软件开发 > 操作系统

GPUImage滤镜之锐化

  应用锐化工具可以快速聚焦模糊边缘,提高图像中某一部位的清晰度或者焦距程度,使图像特定区域的色彩更加鲜明。 在应用锐化工具时,若勾选器选项栏中的“对所有图层取样”复选框,则可对所有可见图层中的图像进行锐化。但一定要适度。锐化不是万能的,很容易使东西不真实。

  在GPUImage中使用GPUImageSharpenFilter类来实现图像的锐化效果

  片段着色

 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); }

 

   具体应用

  

+ (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];}

 

  效果

GPUImage滤镜之锐化  GPUImage滤镜之锐化

 




原标题:GPUImage滤镜之锐化

关键词:

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

金鱼理论:https://www.goluckyvip.com/tag/13680.html
韩国新规:https://www.goluckyvip.com/tag/13681.html
化学品进口:https://www.goluckyvip.com/tag/13682.html
韩国搜索引擎:https://www.goluckyvip.com/tag/13683.html
韩国SEO:https://www.goluckyvip.com/tag/13684.html
韩国网站大全:https://www.goluckyvip.com/tag/13685.html
在古巴做游轮 古巴旅游项目:https://www.vstour.cn/a/363194.html
西藏旅游攻略自驾游需要多少天 去西藏旅游自驾游要多久时间:https://www.vstour.cn/a/363195.html
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流