<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>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                Oilpaint油畫濾鏡 ? ? 圖像油畫效果實際上是將圖像邊緣產生一種朦朧,霧化的效果,同時,將一定的邊緣模糊化,這樣圖像整體上看去像素與像素之間就像霧一樣隨機呈現。 ? ? 算法過程如下: ?假設當前像素為P(x,y),他的隨機位置為Pd(dx,dy),那么算法公式如下: [![](https://box.kancloud.cn/2016-01-05_568b332562d53.png)](http://www.zealpixel.com/data/attachment/portal/201507/19/124640k94d1gpdecvpctte.png) ? ? 其中,K(v)為最大值不大于v的隨機數正數,v為霧化閾值,v值越大,霧化程度越明顯,反之,霧化程度越小,v=0時,圖像無變化效果。 核心代碼如下: ~~~ /// <summary> /// Mosaic filter. /// </summary> /// <param name="src">Source image.</param> /// <param name="blockSize">The size of mosaic effect.</param> /// <returns>Resullt image.</returns> public Bitmap OilpaintFilter(Bitmap src, int intensity) { Bitmap srcBitmap = new Bitmap(src); int w = srcBitmap.Width; int h = srcBitmap.Height; System.Drawing.Imaging.BitmapData srcData = srcBitmap.LockBits(new Rectangle(0, 0, w, h), System.Drawing.Imaging.ImageLockMode.ReadWrite, System.Drawing.Imaging.PixelFormat.Format32bppArgb); IntPtr ptr = srcData.Scan0; int bytes = h * srcData.Stride; byte[] srcValues = new byte[bytes]; System.Runtime.InteropServices.Marshal.Copy(ptr, srcValues, 0, bytes); byte[] tempValues = (byte[])srcValues.Clone(); int stride = srcData.Stride; Random ran = new Random(); int k = 0; int dx = 0; int dy = 0; for (int j = 0; j < h; j++) { for (int i = 0; i < w; i++) { k = ran.Next(intensity); dx = (i + k) >= w ? w - 1 : (i + k); dy = (j + k) >= h ? h - 1 : (j + k); tempValues[i * 4 + j * w * 4] = (byte)srcValues[dx * 4 + dy * w * 4]; tempValues[i * 4 + 1 + j * w * 4] = (byte)srcValues[dx * 4 + 1 + dy * w * 4]; tempValues[i * 4 + 2 + j * w * 4] = (byte)srcValues[dx * 4 + 2 + dy * w * 4]; } } srcValues = (byte[])tempValues.Clone(); System.Runtime.InteropServices.Marshal.Copy(srcValues, 0, ptr, bytes); srcBitmap.UnlockBits(srcData); return srcBitmap; } ~~~ ? ? 圖像油畫濾鏡效果如下: [![](https://box.kancloud.cn/2016-01-05_568b332571496.jpg)](http://www.zealpixel.com/data/attachment/portal/201507/19/124819mlyntu43nlt3rt38.jpg) 原圖 [![](https://box.kancloud.cn/2016-01-05_568b33258b390.png)](http://www.zealpixel.com/data/attachment/portal/201507/19/124820l5tvmt2pggmzbvkb.png) Oilpaint濾鏡效果 最后,放上一個完整的C#版程序Demo下載鏈接:[http://www.zealpixel.com/forum.php?mod=viewthread&tid=52&extra=page%3D1](http://www.zealpixel.com/forum.php?mod=viewthread&tid=52&extra=page%3D1)
                  <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>

                              哎呀哎呀视频在线观看