欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

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

1、平滑

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

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)- 平滑、銳化、邊緣檢測

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)- 平滑、銳化、邊緣檢測

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<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)- 平滑、銳化、邊緣檢測

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

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

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

廣告

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

外貿(mào)網(wǎng)站建設(shè)