RELATEED CONSULTING
相关咨询
选择下列产品马上在线沟通
服务时间:8:30-17:00
你可能遇到了下面的问题
关闭右侧工具栏

新闻中心

这里有您想知道的互联网营销解决方案
基于Qt的OpenGL可编程管线学习(18)-平滑、锐化、边缘检测

1、平滑

创新互联公司一直在为企业提供服务,多年的磨炼,使我们在创意设计,全网整合营销推广到技术研发拥有了开发经验。我们擅长倾听企业需求,挖掘用户对产品需求服务价值,为企业制作有用的创意设计体验。核心团队拥有超过10年以上行业经验,涵盖创意,策化,开发等专业领域,公司涉及领域有基础互联网服务成都服务器托管成都app开发、手机移动建站、网页设计、网络整合营销。

shader

// 平滑
uniform sampler2D U_MainTexture;
uniform sampler2D U_SubTexture;

varying vec2 M_coord;

void main()
{
        vec4 color = vec4(0.0);
        int coreSize = 3;
        float texelOffset = 1 / 300.0;
        float kernel[9];

        kernel[6] = 1; kernel[7] = 1; kernel[8] = 1;
        kernel[3] = 1; kernel[4] = 1; kernel[5] = 1;
        kernel[0] = 1; kernel[1] = 1; kernel[2] = 1;

        int index = 0;
        for(int y = 0; y

效果图

基于Qt的OpenGL可编程管线学习(18)- 平滑、锐化、边缘检测

2、锐化

shader

// 锐化
uniform sampler2D U_MainTexture;
uniform sampler2D U_SubTexture;

varying vec2 M_coord;

void main()
{
        vec4 color = vec4(0.0);
        int coreSize = 3;
        float texelOffset = 1 / 300.0;
        float kernel[9];

        kernel[6] = 0; kernel[7] = -1; kernel[8] = 0;
        kernel[3] = -1; kernel[4] = 4; kernel[5] = -1;
        kernel[0] = 0; kernel[1] = -1; kernel[2] = 0;

        int index = 0;
        for(int y = 0; y

效果图

基于Qt的OpenGL可编程管线学习(18)- 平滑、锐化、边缘检测

3、边缘检测

shader

//  边缘检测
uniform sampler2D U_MainTexture;
uniform sampler2D U_SubTexture;

varying vec2 M_coord;

void main()
{
        vec4 color = vec4(0.0);
        int coreSize = 3;
        float texelOffset = 1 / 300.0;
        float kernel[9];

        kernel[6] = 0; kernel[7] = 1; kernel[8] = 0;
        kernel[3] = 1; kernel[4] = -4; kernel[5] = 1;
        kernel[0] = 0; kernel[1] = 1; kernel[2] = 0;

        int index = 0;
        for(int y = 0; y

效果图

基于Qt的OpenGL可编程管线学习(18)- 平滑、锐化、边缘检测


网站名称:基于Qt的OpenGL可编程管线学习(18)-平滑、锐化、边缘检测
文章网址:http://scyingshan.cn/article/pjoddi.html