<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                LOMO Filter LOMO是一種概念,即強調感受、機緣,弱化攝影技巧,不確定性和隨意性是LOMO最大特點。LOMO源于Lomography,LOMO相機,它原先是蘇聯的產物,由列寧格勒光學與機械聯盟于1980年制造出品,是一臺為了大眾需求而制造的傻瓜相機。常見的lomo照片構圖沒有章法,色彩濃郁,焦點不實,曝光不準,晃動糊片也很普遍。 LOMO的風格多種多樣,本文簡單介紹一種風格。 具體算法實現如下: 1,原圖A與原圖使用“柔光”圖層混合,得到圖B,公式如下: ~~~ private int ModeSmoothLight(int basePixel, int mixPixel) { int res = 0; res = mixPixel > 128 ? ((int)((float)basePixel + ((float)mixPixel + (float)mixPixel - 255.0f) * ((Math.Sqrt((float)basePixel / 255.0f)) * 255.0f - (float)basePixel) / 255.0f)) : ((int)((float)basePixel + ((float)mixPixel + (float)mixPixel - 255.0f) * ((float)basePixel - (float)basePixel * (float)basePixel / 255.0f) / 255.0f)); return Math.Min(255, Math.Max(0, res)); } ~~~ 2,B與一種自己設定的風格色(比如藍色:R-200,G-37,B-11)進行“排除”圖層混合,設定40%透明度,得到圖C,具體公式如下: ~~~ private int ModeExclude(int basePixel, int mixPixel) { int res = 0; res = (mixPixel + basePixel) - mixPixel * basePixel / 128; return Math.Min(255, Math.Max(0, res)); } ~~~ 3,選則一種暗角模板,與C進行“疊加”圖層混合,得到最終的LOMO效果,當然,如果不喜歡暗角效果,此步驟可以忽略; 核心代碼如下: ~~~ private Bitmap LOMOFilterProcess(Bitmap src) { Bitmap srcBitmap = new Bitmap(src); Bitmap dst = new Bitmap(src); int w = dst.Width; int h = dst.Height; BitmapData dstData = dst.LockBits(new Rectangle(0, 0, w, h), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb); BitmapData srcData = srcBitmap.LockBits(new Rectangle(0, 0, w, h), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb); byte* pSrc = (byte*)srcData.Scan0; byte* pDst = (byte*)dstData.Scan0; int offset = dstData.Stride - w * 4; int r,g,b; for (int j = 0; j < h; j++) { for (int i = 0; i < w; i++) { b = ModeSmoothLight(pSrc[0], pDst[0]); g = ModeSmoothLight(pSrc[1], pDst[1]); r = ModeSmoothLight(pSrc[2], pDst[2]); b = ModeExclude(b, 80); g = ModeExclude(g, 15); r = ModeExclude(r, 5); pDst[0] = (byte)b; pDst[1] = (byte)g; pDst[2] = (byte)r; pDst[3] = (byte)255; pSrc += 4; pDst += 4; } pSrc += offset; pDst += offset; } dst.UnlockBits(dstData); srcBitmap.UnlockBits(srcData); return dst; } ~~~ 效果圖如下: [![](https://box.kancloud.cn/2016-01-05_568b3323c8c1d.jpg)](http://www.zealpixel.com/data/attachment/portal/201507/27/231029cr8met1uou7m1smm.jpg) 原圖 ![](https://box.kancloud.cn/2016-01-05_568b3323df028.png) LOMO Filter效果圖 最后,放上一個完整C#程序DEMO的下載鏈接:[http://www.zealpixel.com/thread-66-1-1.html](http://www.zealpixel.com/thread-66-1-1.html)
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看