成人午夜视频全免费观看高清-秋霞福利视频一区二区三区-国产精品久久久久电影小说-亚洲不卡区三一区三区一区

基于Qt的OpenGL可編程管線學(xué)習(xí)(18)-平滑、銳化、邊緣檢測(cè)-創(chuàng)新互聯(lián)

1、平滑

在廬江等地區(qū),都構(gòu)建了全面的區(qū)域性戰(zhàn)略布局,加強(qiáng)發(fā)展的系統(tǒng)性、市場(chǎng)前瞻性、產(chǎn)品創(chuàng)新能力,以專注、極致的服務(wù)理念,為客戶提供成都網(wǎng)站建設(shè)、做網(wǎng)站 網(wǎng)站設(shè)計(jì)制作按需定制網(wǎng)站,公司網(wǎng)站建設(shè),企業(yè)網(wǎng)站建設(shè),品牌網(wǎng)站制作,成都營(yíng)銷網(wǎng)站建設(shè),成都外貿(mào)網(wǎng)站制作,廬江網(wǎng)站建設(shè)費(fèi)用合理。

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<coreSize; y++)
        {
                for(int x=0; x<coreSize; x++)
                {
                        vec4 currentColor=texture2D(U_MainTexture, M_coord+vec2((-1+x)*texelOffset,(-1+y)*texelOffset));
                        color += currentColor * kernel[index++];
                }
        }
        color /= 9.0;

        gl_FragColor = color;
}

效果圖

基于Qt的OpenGL可編程管線學(xué)習(xí)(18)- 平滑、銳化、邊緣檢測(cè)

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<coreSize; y++)
        {
                for(int x=0; x<coreSize; x++)
                {
                        vec4 currentColor=texture2D(U_MainTexture, M_coord+vec2((-1+x)*texelOffset,(-1+y)*texelOffset));
                        color += currentColor * kernel[index++];
                }
        }
        //color /= 9.0;

        gl_FragColor = 4.0 * color + texture2D(U_MainTexture, M_coord);
}

效果圖

基于Qt的OpenGL可編程管線學(xué)習(xí)(18)- 平滑、銳化、邊緣檢測(cè)

3、邊緣檢測(cè)

shader

//  邊緣檢測(cè)
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<coreSize; y++)
        {
                for(int x=0; x<coreSize; x++)
                {
                        vec4 currentColor=texture2D(U_MainTexture, M_coord+vec2((-1+x)*texelOffset,(-1+y)*texelOffset));
                        color += currentColor * kernel[index++];
                }
        }
        //color /= 9.0;

        gl_FragColor = 4.0 * color + texture2D(U_MainTexture, M_coord);
}

效果圖

基于Qt的OpenGL可編程管線學(xué)習(xí)(18)- 平滑、銳化、邊緣檢測(cè)

另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無(wú)理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國(guó)服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場(chǎng)景需求。

當(dāng)前名稱:基于Qt的OpenGL可編程管線學(xué)習(xí)(18)-平滑、銳化、邊緣檢測(cè)-創(chuàng)新互聯(lián)
轉(zhuǎn)載來(lái)于:http://jinyejixie.com/article42/dhdehc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供品牌網(wǎng)站建設(shè)、商城網(wǎng)站、網(wǎng)站設(shè)計(jì)公司、品牌網(wǎng)站設(shè)計(jì)、營(yíng)銷型網(wǎng)站建設(shè)、建站公司

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

外貿(mào)網(wǎng)站建設(shè)
正宁县| 东山县| 行唐县| 新津县| 梓潼县| 赣榆县| 杨浦区| 莒南县| 乐山市| 龙胜| 辛集市| 张家口市| 新蔡县| 阳西县| 思茅市| 临沂市| 桦甸市| 乐山市| 东辽县| 会理县| 土默特右旗| 旺苍县| 土默特右旗| 宜宾市| 杨浦区| 汝阳县| 秦安县| 定兴县| 上高县| 竹溪县| 沙河市| 余姚市| 新安县| 美姑县| 营山县| 淮滨县| 昭平县| 鄂州市| 新余市| 高淳县| 星座|