なんとなく、ふわっと・・

写真と画像処理関係とひとりごとをなんとなく書き溜めていきたい

おおつごもり

2007-12-31 16:48:04 | 写真

よいお年をお迎えください。


@home


[DFA Macro 100mmF2.8]


Comments (2)

とげとげ

2007-12-31 00:12:38 | 写真







妻木、つくば市



[DFA Macro 100mmF2.8]


うーむ、レンズが汚れている・・・

Comment

E

2007-12-31 00:01:53 | rinkaku





Comment

YellowLeaves

2007-12-30 00:14:23 | 写真


吾妻3、つくば市



[DFA Macro 100mmF2.8]



上の写真を suisai フィルタで処理してみた。




Comment

S again

2007-12-30 00:09:11 | rinkaku





Comment

ザルの反転

2007-12-29 00:22:15 | processed

マクロレンズのテストをしたときの台所の金網のザルを InsideOut した。















元画像:




[ InsideOut ]


Comment

Just After Rain 2

2007-12-29 00:14:57 | 写真












吾妻3、つくば市



[DFA Macro 100mmF2.8]


Comment

E

2007-12-29 00:08:04 | rinkaku






Comment

Demon

2007-12-28 00:27:34 | processed

Demon と InsideOut を繰り返した。

元画像(千羽鶴を SpiralDemon したものの一部:既出)




上の画像の Demon




上の画像の InsideOut




上の画像の Demon





上の画像の IsideOut



上の画像の SpiralDemon




[ Demon InsideOut SpiralDemon]


Comment

冬、深々 2

2007-12-28 00:12:47 | 写真












以上、同峰公園、つくば市


[DFA Macro 100mmF2.8]

Comment

M

2007-12-28 00:05:42 | rinkaku




Comment

Non-Linear InsideOut

2007-12-27 22:07:30 | C#(Graphics)

これまでの普通の InsideOut は、境界の半径Rより内側のピクセルについては

r = R - r'

という変形を行ってきた。 これは、外縁と中心を線形に反転させることと等価である。
上の式は

(r / R) = 1 - (r'/R)

と変形できる。 これを線形ではなく指数関数をつかって非線形変形に拡張してみる。

(r / R) = 1 - (r'/R)**n

ここで、n は累乗の指数である。実際に関数を実装するときに使用する逆変換では、

r' = R * Math.Pow( (1 - r/R), 1/n)

となる。実際にやってみよう。


元画像は既存のものを使用した。




n = 0.5




n = 1.0 (これは今までの InsideOut と同じ)




n = 1.5




n = 2.0




n = 3.0



このように、n が1より小さいときは、従来の InsideOut に比べて変換前の中心部分が重視される。
逆に1より大きい場合は、変換前の外縁部分が相対的に拡大される。


今回つくった関数部分を示す。


        public static bool NLInsideOut(ref Bitmap bmp, double cx, double cy,
                                        double radius, double index, Color bkColor)
        {
            if (bmp.PixelFormat != PixelFormat.Format24bppRgb)
                return false;

            int w = bmp.Width;
            int h = bmp.Height;

            int mg = 2; // margin for interpolations

            if ((cx == 0) & (cy == 0)) { cx = (double)w / 2; cy = (double)h / 2; }

            Bitmap tmp = new Bitmap(w + mg * 2, h + mg * 2, bmp.PixelFormat);

            Graphics g = Graphics.FromImage(tmp);
            g.Clear(bkColor);
            g.DrawImageUnscaled(bmp, mg, mg);
            g.Dispose();

            g = Graphics.FromImage(bmp);
            if (bkColor != Color.Transparent) g.Clear(bkColor);
            g.Dispose();

            RectangleF rct = new RectangleF(-1, -1, w + 1, h + 1);

            double r, a, xx, yy;
            double rindex = 1d / index;

            BmpProc24 src = new BmpProc24(tmp);
            BmpProc24 dst = new BmpProc24(bmp);

            for (int y = 0; y < h; y++)
                for (int x = 0; x < w; x++)
                {
                    r = Math.Sqrt((x - cx) * (x - cx) + (y - cy) * (y - cy));

                    if (r > radius) continue;

                    r = radius * Math.Pow((1d - r / radius), rindex);
                    a = Math.Atan2(y - cy, x - cx);                // radian

                    xx = r * Math.Cos(a) + cx;
                    yy = r * Math.Sin(a) + cy;

                    if (rct.Contains(new PointF((float)xx, (float)yy)))
                    {
                        xx = xx + mg;
                        yy = yy + mg;

                        ImgUtils.intBicubic(dst, src, x, y, xx, yy);
                    }
                }

            ImgUtils.CallDispose(dst, src, tmp);

            return true;
        }


Comment

冬、深々

2007-12-27 00:18:24 | 写真


吾妻3、つくば市














以上、吾妻2、つくば市



[DFA Macro 100mmF2.8]


Comments (4)

Y

2007-12-27 00:13:48 | rinkaku




Comment

A

2007-12-27 00:09:19 | rinkaku




[rinkaku crop smoothedge]

Comment