public void doFilter(INyARRgbRaster i_input, NyARBinRaster i_output)
        {
            //INyARBufferReader in_buffer_reader = i_input.getBufferReader();
            //INyARBufferReader out_buffer_reader = i_output.getBufferReader();
            int in_buf_type = i_input.getBufferType();

            NyARIntSize size = i_output.getSize();
            Debug.Assert(i_output.isEqualBufferType(NyARBufferType.INT2D_BIN_8));
            Debug.Assert(checkInputType(in_buf_type) == true);
            Debug.Assert(i_input.getSize().isEqualSize(size.w * 2, size.h * 2) == true);

            int[][] out_buf = (int[][])i_output.getBuffer();


            switch (i_input.getBufferType())
            {
                case NyARBufferType.BYTE1D_B8G8R8_24:
                case NyARBufferType.BYTE1D_R8G8B8_24:
                    convert24BitRgb((byte[])i_input.getBuffer(), out_buf, size);
                    break;
                case NyARBufferType.BYTE1D_B8G8R8X8_32:
                    convert32BitRgbx((byte[])i_input.getBuffer(), out_buf, size);
                    break;
                case NyARBufferType.WORD1D_R5G6B5_16LE:
                    convert16BitRgb565word((short[])i_input.getBuffer(), out_buf, size);
                    break;
                default:
                    throw new NyARException();
            }
            return;
        }
예제 #2
0
        public void doFilter(INyARRgbRaster i_input, NyARBinRaster i_output)
        {
            //INyARBufferReader in_buffer_reader = i_input.getBufferReader();
            //INyARBufferReader out_buffer_reader = i_output.getBufferReader();
            int in_buf_type = i_input.getBufferType();

            NyARIntSize size = i_output.getSize();

            Debug.Assert(i_output.isEqualBufferType(NyARBufferType.INT2D_BIN_8));
            Debug.Assert(checkInputType(in_buf_type) == true);
            Debug.Assert(i_input.getSize().isEqualSize(size.w * 2, size.h * 2) == true);

            int[][] out_buf = (int[][])i_output.getBuffer();


            switch (i_input.getBufferType())
            {
            case NyARBufferType.BYTE1D_B8G8R8_24:
            case NyARBufferType.BYTE1D_R8G8B8_24:
                convert24BitRgb((byte[])i_input.getBuffer(), out_buf, size);
                break;

            case NyARBufferType.BYTE1D_B8G8R8X8_32:
                convert32BitRgbx((byte[])i_input.getBuffer(), out_buf, size);
                break;

            case NyARBufferType.WORD1D_R5G6B5_16LE:
                convert16BitRgb565word((short[])i_input.getBuffer(), out_buf, size);
                break;

            default:
                throw new NyARException();
            }
            return;
        }
예제 #3
0
        /* DsXRGB32Rasterの内容を保持しているサーフェイスにコピーします。
         */
        public void setRaster(INyARRgbRaster i_sample)
        {
            Debug.Assert(!this._is_dispose);
            int pitch;
            int s_stride = this.m_width * 4;

            using (GraphicsStream gs = this._surface.LockRectangle(LockFlags.None, out pitch))
            {
                try{
                    switch (i_sample.getBufferType())
                    {
                    case NyARBufferType.BYTE1D_B8G8R8X8_32:
                        if (pitch % s_stride == 0)
                        {
                            Marshal.Copy((byte[])i_sample.getBuffer(), 0, (IntPtr)((int)gs.InternalData), this.m_width * 4 * this.m_height);
                        }
                        else
                        {
                            int s_idx = 0;
                            int d_idx = (int)gs.InternalData;
                            for (int i = this.m_height - 1; i >= 0; i--)
                            {
                                //どう考えてもポインタです。
                                Marshal.Copy((byte[])i_sample.getBuffer(), s_idx, (IntPtr)(d_idx), s_stride);
                                s_idx += s_stride;
                                d_idx += pitch;
                            }
                        }
                        break;

                    case NyARBufferType.OBJECT_CS_Bitmap:
                        NyARBitmapRaster ra = (NyARBitmapRaster)(i_sample);
                        BitmapData       bm = ra.lockBitmap();
                        try{
                            //コピー
                            int src = (int)bm.Scan0;
                            int dst = (int)gs.InternalData;
                            for (int r = this.m_height - 1; r >= 0; r--)
                            {
                                NyARD3dUtil.RtlCopyMemory((IntPtr)dst, (IntPtr)src, s_stride);
                                dst += pitch;
                                src += bm.Stride;
                            }
                        }finally{
                            ra.unlockBitmap();
                        }
                        break;

                    default:
                        throw new NyARException();
                    }
                }finally{
                    this._surface.UnlockRectangle();
                }
                return;
            }
        }
예제 #4
0
        /**
         * ImputStreamからARToolKit形式のマーカデータを読み込み、o_codeオブジェクトへ格納します。
         * @param i_stream
         * 読出し元のストリームです。
         * @param o_code
         * 出力先の{@link NyARCode}オブジェクトです。
         * @
         */
        public static void loadFromARToolKitFormFile(Stream i_stream, NyARCode o_code)
        {
            int            width      = o_code.getWidth();
            int            height     = o_code.getHeight();
            INyARRgbRaster tmp_raster = NyARRgbRaster.createInstance(width, height, NyARBufferType.INT1D_X8R8G8B8_32);

            //4個の要素をラスタにセットする。
            try
            {
                using (StreamReader sr = new StreamReader(i_stream)) {
                    int[]    buf  = (int[])tmp_raster.getBuffer();
                    string[] data = sr.ReadToEnd().Split(new Char[] { ' ', '\r', '\n' });
                    //GBRAで一度読みだす。
                    int idx = 0;
                    for (int h = 0; h < 4; h++)
                    {
                        idx = readBlock(data, idx, width, height, buf);
                        //ARCodeにセット(カラー)
                        o_code.getColorData(h).setRaster(tmp_raster);
                        o_code.getBlackWhiteData(h).setRaster(tmp_raster);
                    }
                }
            }
            catch (Exception e)
            {
                throw new NyARRuntimeException(e);
            }
            tmp_raster = null;//ポイ
            return;
        }
예제 #5
0
        /* DsXRGB32Rasterの内容を保持しているテクスチャにコピーします。
         * i_rasterのサイズは、このインスタンスに指定したテクスチャサイズ(コンストラクタ等に指定したサイズ)と同じである必要です。
         * ラスタデータはテクスチャの左上を基点にwidth x heightだけコピーされ、残りの部分は更新されません。
         */
        public void setRaster(INyARRgbRaster i_raster)
        {
            Debug.Assert(!this._is_dispose);
            int pitch;

            using (GraphicsStream texture_rect = this.m_texture.LockRectangle(0, LockFlags.None, out pitch))
            {
                try{
                    int dst = (int)texture_rect.InternalData;
                    switch (i_raster.getBufferType())
                    {
                    case NyARBufferType.BYTE1D_B8G8R8X8_32:
                    {
                        byte[] buf = (byte[])i_raster.getBuffer();
                        //テクスチャのピッチって何?
                        int src_w = this.m_width * 4;
                        int src   = 0;
                        for (int r = this.m_height - 1; r >= 0; r--)
                        {
                            Marshal.Copy(buf, src, (IntPtr)dst, pitch);
                            dst += pitch;
                            src += src_w;
                        }
                    }
                    break;

                    case NyARBufferType.OBJECT_CS_Bitmap:
                        NyARBitmapRaster ra = (NyARBitmapRaster)(i_raster);
                        BitmapData       bm = ra.lockBitmap();
                        try
                        {
                            int src = (int)bm.Scan0;
                            for (int r = this.m_height - 1; r >= 0; r--)
                            {
                                NyARD3dUtil.RtlCopyMemory((IntPtr)dst, (IntPtr)src, pitch);
                                dst += pitch;
                                src += bm.Stride;
                            }
                        }
                        finally
                        {
                            ra.unlockBitmap();
                        }
                        break;

                    default:
                        throw new NyARException();
                    }
                }
                finally
                {
                    //テクスチャをアンロックする
                    this.m_texture.UnlockRectangle(0);
                }
            }
            return;
        }
예제 #6
0
        /* DsXRGB32Rasterの内容を保持しているサーフェイスにコピーします。
         */
        public void CopyFromXRGB32(INyARRgbRaster i_sample)
        {
            Debug.Assert(i_sample.isEqualBufferType(NyARBufferType.BYTE1D_B8G8R8X8_32));
            int            pitch;
            GraphicsStream gs       = this.m_surface.LockRectangle(LockFlags.None, out pitch);
            int            s_stride = this.m_width * 4;

            if (pitch % s_stride == 0)
            {
                Marshal.Copy((byte[])i_sample.getBuffer(), 0, (IntPtr)((int)gs.InternalData), this.m_width * 4 * this.m_height);
            }
            else
            {
                int s_idx = 0;
                int d_idx = (int)gs.InternalData;
                for (int i = this.m_height - 1; i >= 0; i--)
                {
                    //どう考えてもポインタです。
                    Marshal.Copy((byte[])i_sample.getBuffer(), s_idx, (IntPtr)(d_idx), s_stride);
                    s_idx += s_stride;
                    d_idx += pitch;
                }
            }



            /*
             * int cp_size = this.m_width * 4;
             * int s_idx=0;
             * int d_idx = (this.m_height - 1) * cp_size;
             * for(int i=this.m_height-1;i>=0;i--){
             *  //どう考えてもポインタです。
             *  Marshal.Copy((byte[])i_sample.getBufferReader().getBuffer(),s_idx,(IntPtr)((int)gs.InternalData+d_idx),cp_size);
             *  s_idx += cp_size;
             *  d_idx -= cp_size;
             * }
             *
             */

            this.m_surface.UnlockRectangle();

            return;
        }
        /**
         * NyARRasterからパターンデータをセットします。
         * この関数は、データを元に所有するデータ領域を更新します。
         * @param i_buffer
         * @throws NyARException
         */
        public void setRaster(INyARRgbRaster i_raster)
        {
            Debug.Assert(i_raster.getSize().isEqualSize(this._size));
            switch (i_raster.getBufferType())
            {
            case NyARBufferType.INT1D_X8R8G8B8_32:
                this._pow = setRaster_INT1D_X8R8G8B8_32((int[])i_raster.getBuffer(), this._size.w * this._size.h, this._optimize_for_mod, this._data);
                break;

            default:
                this._pow = setRaster_ANY(i_raster.getRgbPixelReader(), this._size, this._size.w * this._size.h, this._data);
                break;
            }
            return;
        }
예제 #8
0
        static void Main(string[] args)
        {
            String img_file    = "../../../../../data/testcase/test.raw";
            String cparam_file = "../../../../../data/testcase/camera_para5.dat";
            String fset3file   = "../../../../../data/testcase/pinball.fset3";
            //カメラパラメータ
            NyARParam param = NyARParam.loadFromARParamFile(File.OpenRead(cparam_file), 640, 480, NyARParam.DISTFACTOR_LT_ARTK5);

            INyARGrayscaleRaster gs = NyARGrayscaleRaster.createInstance(640, 480);
            //試験画像の準備
            {
                INyARRgbRaster rgb = NyARRgbRaster.createInstance(640, 480, NyARBufferType.BYTE1D_B8G8R8X8_32);
                Stream         fs  = File.OpenRead(img_file);
                byte[]         b   = (byte[])rgb.getBuffer();
                fs.Read(b, 0, b.Length);
                INyARRgb2GsFilterRgbAve filter = (INyARRgb2GsFilterRgbAve)rgb.createInterface(typeof(INyARRgb2GsFilterRgbAve));
                filter.convert(gs);
            }
            NyARDoubleMatrix44   tmat = new NyARDoubleMatrix44();
            NyARNftFreakFsetFile f    = NyARNftFreakFsetFile.loadFromfset3File(File.OpenRead(fset3file));
//			KpmHandle kpm=new KpmHandle(new ARParamLT(param));
            Stopwatch             sw     = new Stopwatch();
            FreakKeypointMatching kpm    = new FreakKeypointMatching(param);
            KeyframeMap           keymap = new KeyframeMap(f, 0);

            for (int j = 0; j < 4; j++)
            {
                sw.Reset();
                sw.Start();
                for (int i = 0; i < 20; i++)
                {
                    kpm.updateInputImage(gs);
                    kpm.updateFeatureSet();
                    kpm.kpmMatching(keymap, tmat);
                }
                //FreakKeypointMatching#kMaxNumFeaturesを300にしてテストして。
                sw.Stop();
                System.Console.WriteLine("Total=" + (sw.ElapsedMilliseconds));
                NyARDoubleMatrix44 TEST_PATT = new NyARDoubleMatrix44(new double[] {
                    0.98436354107742652, 0.0066768917838370646, -0.17602226595996517, -191.17967199668533,
                    0.011597578022657571, -0.99956974712564306, 0.026940987645082352, 63.00280574839347,
                    -0.17576664981496215, -0.028561157958401542, -0.98401745160789567, 611.75871553558636,
                    0, 0, 0, 1
                });
                System.Console.WriteLine(TEST_PATT.Equals(tmat));
            }
        }
예제 #9
0
 public void switchRaster(INyARRgbRaster i_raster)
 {
     this._ref_buf  = (short[])i_raster.getBuffer();
     this._ref_size = i_raster.getSize();
 }
        private void multiPixel_INT1D_X8R8G8B8_32(int pk_l, int pk_t, int in_w, int in_h, int i_resolution, double[] cpara, INyARRgbPixelReader i_in_reader, INyARRgbRaster o_out)
        {
            Debug.Assert(o_out.isEqualBufferType(NyARBufferType.INT1D_X8R8G8B8_32));
            int res_pix = i_resolution * i_resolution;

            int[] rgb_tmp  = this.__pickFromRaster_rgb_tmp;
            int[] pat_data = (int[])o_out.getBuffer();

            //ピクセルリーダーを取得
            double cp0 = cpara[0];
            double cp3 = cpara[3];
            double cp6 = cpara[6];
            double cp1 = cpara[1];
            double cp4 = cpara[4];
            double cp7 = cpara[7];
            double cp2 = cpara[2];
            double cp5 = cpara[5];

            int out_w = o_out.getWidth();
            int out_h = o_out.getHeight();
            int p     = (out_w * out_h - 1);

            for (int iy = out_h - 1; iy >= 0; iy--)
            {
                //解像度分の点を取る。
                for (int ix = out_w - 1; ix >= 0; ix--)
                {
                    int r, g, b;
                    r = g = b = 0;
                    int    cy = pk_t + iy * i_resolution;
                    int    cx = pk_l + ix * i_resolution;
                    double cp7_cy_1_cp6_cx_b   = cp7 * cy + 1.0 + cp6 * cx;
                    double cp1_cy_cp2_cp0_cx_b = cp1 * cy + cp2 + cp0 * cx;
                    double cp4_cy_cp5_cp3_cx_b = cp4 * cy + cp5 + cp3 * cx;
                    for (int i2y = i_resolution - 1; i2y >= 0; i2y--)
                    {
                        double cp7_cy_1_cp6_cx   = cp7_cy_1_cp6_cx_b;
                        double cp1_cy_cp2_cp0_cx = cp1_cy_cp2_cp0_cx_b;
                        double cp4_cy_cp5_cp3_cx = cp4_cy_cp5_cp3_cx_b;
                        for (int i2x = i_resolution - 1; i2x >= 0; i2x--)
                        {
                            //1ピクセルを作成
                            double d = 1 / (cp7_cy_1_cp6_cx);
                            int    x = (int)((cp1_cy_cp2_cp0_cx) * d);
                            int    y = (int)((cp4_cy_cp5_cp3_cx) * d);
                            if (x < 0)
                            {
                                x = 0;
                            }
                            else if (x >= in_w)
                            {
                                x = in_w - 1;
                            }
                            if (y < 0)
                            {
                                y = 0;
                            }
                            else if (y >= in_h)
                            {
                                y = in_h - 1;
                            }

                            i_in_reader.getPixel(x, y, rgb_tmp);
                            r += rgb_tmp[0];
                            g += rgb_tmp[1];
                            b += rgb_tmp[2];
                            cp7_cy_1_cp6_cx   += cp6;
                            cp1_cy_cp2_cp0_cx += cp0;
                            cp4_cy_cp5_cp3_cx += cp3;
                        }
                        cp7_cy_1_cp6_cx_b   += cp7;
                        cp1_cy_cp2_cp0_cx_b += cp1;
                        cp4_cy_cp5_cp3_cx_b += cp4;
                    }
                    r          /= res_pix;
                    g          /= res_pix;
                    b          /= res_pix;
                    pat_data[p] = ((r & 0xff) << 16) | ((g & 0xff) << 8) | ((b & 0xff));
                    p--;
                }
            }
            return;
        }
 public void switchRaster(INyARRgbRaster i_raster)
 {
     this._ref_buf = (short[])i_raster.getBuffer();
     this._ref_size = i_raster.getSize();
 }
예제 #12
0
        static void Main(string[] args)
        {
            NyARDoubleMatrix44 DEST_MAT = new NyARDoubleMatrix44(
                new double[] {
                0.9832165682361184, 0.004789697223621061, -0.18237945710280384, -190.59060790299358,
                0.012860184615056927, -0.9989882709616935, 0.04309419210331572, 64.04490277502563,
                -0.18198852802987958, -0.044716355753573425, -0.9822833548209547, 616.6427596804766,
                0, 0, 0, 1
            });
            NyARDoubleMatrix44 SRC_MAT = new NyARDoubleMatrix44(new double[] {
                0.984363556, 0.00667689135, -0.176022261, -191.179672,
                0.0115975942, -0.999569774, 0.0269410834, 63.0028076,
                -0.175766647, -0.0285612550, -0.984017432, 611.758728,
                0, 0, 0, 1
            });

            String img_file = "../../../../../data/testcase/test.raw";
            String cparam   = "../../../../../data/testcase/camera_para5.dat";
            String fsetfile = "../../../../../data/testcase/pinball.fset";
            String isetfile = "../../../../../data/testcase/pinball.iset5";
            //カメラパラメータ
            NyARParam param = NyARParam.loadFromARParamFile(File.OpenRead(cparam), 640, 480, NyARParam.DISTFACTOR_LT_ARTK5);


            INyARGrayscaleRaster gs = NyARGrayscaleRaster.createInstance(640, 480);
            //試験画像の準備
            {
                INyARRgbRaster rgb = NyARRgbRaster.createInstance(640, 480, NyARBufferType.BYTE1D_B8G8R8X8_32);
                Stream         fs  = File.OpenRead(img_file);
                byte[]         b   = (byte[])rgb.getBuffer();
                fs.Read(b, 0, b.Length);
                INyARRgb2GsFilterRgbAve filter = (INyARRgb2GsFilterRgbAve)rgb.createInterface(typeof(INyARRgb2GsFilterRgbAve));
                filter.convert(gs);
            }

            NyARNftFsetFile    fset = NyARNftFsetFile.loadFromFsetFile(File.OpenRead(fsetfile));
            NyARNftIsetFile    iset = NyARNftIsetFile.loadFromIsetFile(File.OpenRead(isetfile));
            NyARSurfaceTracker st   = new NyARSurfaceTracker(param, 16, 0.5);
            NyARSurfaceDataSet sd   = new NyARSurfaceDataSet(iset, fset);
            NyARDoubleMatrix44 sret = new NyARDoubleMatrix44();

            NyARDoublePoint2d[] o_pos2d           = NyARDoublePoint2d.createArray(16);
            NyARDoublePoint3d[] o_pos3d           = NyARDoublePoint3d.createArray(16);
            NyARSurfaceTrackingTransmatUtils tmat = new NyARSurfaceTrackingTransmatUtils(param, 5.0);
            NyARDoubleMatrix44 tret = new NyARDoubleMatrix44();

            for (int j = 0; j < 10; j++)
            {
                Stopwatch s = new Stopwatch();
                s.Reset();
                s.Start();
                for (int i = 0; i < 3000; i++)
                {
                    sret.setValue(SRC_MAT);
                    int nop = st.tracking(gs, sd, sret, o_pos2d, o_pos3d, 16);
                    //Transmatの試験
                    NyARDoublePoint3d off = NyARSurfaceTrackingTransmatUtils.centerOffset(o_pos3d, nop, new NyARDoublePoint3d());
                    NyARSurfaceTrackingTransmatUtils.modifyInputOffset(sret, o_pos3d, nop, off);
                    tmat.surfaceTrackingTransmat(sret, o_pos2d, o_pos3d, nop, tret, new NyARTransMatResultParam());
                    NyARSurfaceTrackingTransmatUtils.restoreOutputOffset(tret, off);
                    System.Console.WriteLine(tret.Equals(DEST_MAT));
                }
                s.Stop();
                System.Console.WriteLine(s.ElapsedMilliseconds);
            }
            return;
        }
예제 #13
0
 /* DsXRGB32Rasterの内容を保持しているサーフェイスにコピーします。
  */
 public void setRaster(INyARRgbRaster i_sample)
 {
     Debug.Assert(!this._is_dispose);
     int pitch;
     int s_stride = this.m_width * 4;
     using (GraphicsStream gs = this._surface.LockRectangle(LockFlags.None, out pitch))
     {
         try{                    
             switch (i_sample.getBufferType())
             {
                 case NyARBufferType.BYTE1D_B8G8R8X8_32:
                     if (pitch % s_stride == 0)
                     {
                         Marshal.Copy((byte[])i_sample.getBuffer(), 0, (IntPtr)((int)gs.InternalData), this.m_width * 4 * this.m_height);
                     }
                     else
                     {
                         int s_idx = 0;
                         int d_idx = (int)gs.InternalData;
                         for (int i = this.m_height - 1; i >= 0; i--)
                         {
                             //どう考えてもポインタです。
                             Marshal.Copy((byte[])i_sample.getBuffer(), s_idx, (IntPtr)(d_idx), s_stride);
                             s_idx += s_stride;
                             d_idx += pitch;
                         }
                     }
                     break;
                 case NyARBufferType.OBJECT_CS_Bitmap:
                     NyARBitmapRaster ra = (NyARBitmapRaster)(i_sample);
                     BitmapData bm = ra.lockBitmap();
                     try{
                         //コピー
                         int src = (int)bm.Scan0;
                         int dst = (int)gs.InternalData;
                         for (int r = this.m_height - 1; r >= 0; r--)
                         {
                             NyARD3dUtil.RtlCopyMemory((IntPtr)dst, (IntPtr)src, s_stride);
                             dst += pitch;
                             src += bm.Stride;
                         }
                     }finally{
                         ra.unlockBitmap();
                     }
                     break;
                 default:
                     throw new NyARException();
             }
         }finally{
             this._surface.UnlockRectangle();
         }
         return;
     }
 }
예제 #14
0
 /* DsXRGB32Rasterの内容を保持しているテクスチャにコピーします。
  * i_rasterのサイズは、このインスタンスに指定したテクスチャサイズ(コンストラクタ等に指定したサイズ)と同じである必要です。
  * ラスタデータはテクスチャの左上を基点にwidth x heightだけコピーされ、残りの部分は更新されません。
  */
 public void setRaster(INyARRgbRaster i_raster)
 {
     Debug.Assert(!this._is_dispose);
     int pitch;
     using(GraphicsStream texture_rect = this.m_texture.LockRectangle(0, LockFlags.None, out pitch))
     {
         try{
             int dst = (int)texture_rect.InternalData;
             switch (i_raster.getBufferType())
             {
                 case NyARBufferType.BYTE1D_B8G8R8X8_32:
                     {
                         byte[] buf = (byte[])i_raster.getBuffer();
                         //テクスチャのピッチって何?
                         int src_w = this.m_width * 4;
                         int src = 0;
                         for (int r = this.m_height - 1; r >= 0; r--)
                         {
                             Marshal.Copy(buf, src, (IntPtr)dst, pitch);
                             dst += pitch;
                             src += src_w;
                         }
                     }
                     break;
                 case NyARBufferType.OBJECT_CS_Bitmap:
                     NyARBitmapRaster ra = (NyARBitmapRaster)(i_raster);
                     BitmapData bm = ra.lockBitmap(); 
                     try
                     {
                         int src = (int)bm.Scan0;
                         for (int r = this.m_height - 1; r >= 0; r--)
                         {
                             NyARD3dUtil.RtlCopyMemory((IntPtr)dst, (IntPtr)src, pitch);
                             dst += pitch;
                             src += bm.Stride;
                         }
                     }
                     finally
                     {
                         ra.unlockBitmap();
                     }
                     break;
                 default:
                     throw new NyARException();
             }
         }
         finally
         {
             //テクスチャをアンロックする
             this.m_texture.UnlockRectangle(0);
         }
     }
     return;
 }
        public void onePixel(int pk_l, int pk_t, double[] cpara, INyARRgbRaster i_in_raster, INyARRgbRaster o_out)
        {
            Debug.Assert(i_in_raster.isEqualBufferType(NyARBufferType.BYTE1D_B8G8R8X8_32));
            //出力形式による分岐
            switch (o_out.getBufferType())
            {
            case NyARBufferType.INT1D_X8R8G8B8_32:
                onePixel_INT1D_X8R8G8B8_32(pk_l, pk_t, i_in_raster.getWidth(), i_in_raster.getHeight(), cpara, (byte[])i_in_raster.getBuffer(), o_out);
                break;

            default:
                onePixel_ANY(pk_l, pk_t, i_in_raster.getWidth(), i_in_raster.getHeight(), cpara, (byte[])i_in_raster.getBuffer(), o_out);
                break;
            }
            return;
        }
        private void onePixel_INT1D_X8R8G8B8_32(int pk_l, int pk_t, int in_w, int in_h, double[] cpara, INyARRgbPixelReader i_in_reader, INyARRgbRaster o_out)
        {
            Debug.Assert(o_out.isEqualBufferType(NyARBufferType.INT1D_X8R8G8B8_32));
            int[] rgb_tmp  = this.__pickFromRaster_rgb_tmp;
            int[] pat_data = (int[])o_out.getBuffer();

            //ピクセルリーダーを取得
            double cp0 = cpara[0];
            double cp3 = cpara[3];
            double cp6 = cpara[6];
            double cp1 = cpara[1];
            double cp4 = cpara[4];
            double cp7 = cpara[7];

            int    out_w      = o_out.getWidth();
            int    out_h      = o_out.getHeight();
            double cp7_cy_1   = cp7 * pk_t + 1.0 + cp6 * pk_l;
            double cp1_cy_cp2 = cp1 * pk_t + cpara[2] + cp0 * pk_l;
            double cp4_cy_cp5 = cp4 * pk_t + cpara[5] + cp3 * pk_l;
            int    p          = 0;

            for (int iy = out_h - 1; iy >= 0; iy--)
            {
                //解像度分の点を取る。
                double cp7_cy_1_cp6_cx   = cp7_cy_1;
                double cp1_cy_cp2_cp0_cx = cp1_cy_cp2;
                double cp4_cy_cp5_cp3_cx = cp4_cy_cp5;

                for (int ix = out_w - 1; ix >= 0; ix--)
                {
                    //1ピクセルを作成
                    double d = 1 / (cp7_cy_1_cp6_cx);
                    int    x = (int)((cp1_cy_cp2_cp0_cx) * d);
                    int    y = (int)((cp4_cy_cp5_cp3_cx) * d);
                    if (x < 0)
                    {
                        x = 0;
                    }
                    else if (x >= in_w)
                    {
                        x = in_w - 1;
                    }
                    if (y < 0)
                    {
                        y = 0;
                    }
                    else if (y >= in_h)
                    {
                        y = in_h - 1;
                    }

                    i_in_reader.getPixel(x, y, rgb_tmp);
                    cp7_cy_1_cp6_cx   += cp6;
                    cp1_cy_cp2_cp0_cx += cp0;
                    cp4_cy_cp5_cp3_cx += cp3;

                    pat_data[p] = (rgb_tmp[0] << 16) | (rgb_tmp[1] << 8) | ((rgb_tmp[2] & 0xff));
                    p++;
                }
                cp7_cy_1   += cp7;
                cp1_cy_cp2 += cp1;
                cp4_cy_cp5 += cp4;
            }
            return;
        }
        private void onePixel_INT1D_X8R8G8B8_32(int pk_l, int pk_t, int in_w, int in_h, double[] cpara, byte[] i_in_buf, INyARRgbRaster o_out)
        {
            Debug.Assert(o_out.isEqualBufferType(NyARBufferType.INT1D_X8R8G8B8_32));
            int[] pat_data = (int[])o_out.getBuffer();
            //ピクセルリーダーを取得
            double cp0 = cpara[0];
            double cp3 = cpara[3];
            double cp6 = cpara[6];
            double cp1 = cpara[1];
            double cp4 = cpara[4];
            double cp7 = cpara[7];

            int    out_w = o_out.getWidth();
            int    out_h = o_out.getHeight();
            double cp7_cy_1 = cp7 * pk_t + 1.0 + cp6 * pk_l;
            double cp1_cy_cp2 = cp1 * pk_t + cpara[2] + cp0 * pk_l;
            double cp4_cy_cp5 = cp4 * pk_t + cpara[5] + cp3 * pk_l;
            int    r, g, b;
            int    p = 0;

            for (int iy = 0; iy < out_h; iy++)
            {
                //解像度分の点を取る。
                double cp7_cy_1_cp6_cx   = cp7_cy_1;
                double cp1_cy_cp2_cp0_cx = cp1_cy_cp2;
                double cp4_cy_cp5_cp3_cx = cp4_cy_cp5;

                for (int ix = 0; ix < out_w; ix++)
                {
                    //1ピクセルを作成
                    double d = 1 / (cp7_cy_1_cp6_cx);
                    int    x = (int)((cp1_cy_cp2_cp0_cx) * d);
                    int    y = (int)((cp4_cy_cp5_cp3_cx) * d);
                    if (x < 0)
                    {
                        x = 0;
                    }
                    else if (x >= in_w)
                    {
                        x = in_w - 1;
                    }
                    if (y < 0)
                    {
                        y = 0;
                    }
                    else if (y >= in_h)
                    {
                        y = in_h - 1;
                    }

                    int bp = (x + y * in_w) * 4;
                    r = (i_in_buf[bp + 2] & 0xff);
                    g = (i_in_buf[bp + 1] & 0xff);
                    b = (i_in_buf[bp + 0] & 0xff);
                    cp7_cy_1_cp6_cx   += cp6;
                    cp1_cy_cp2_cp0_cx += cp0;
                    cp4_cy_cp5_cp3_cx += cp3;
                    pat_data[p]        = (r << 16) | (g << 8) | ((b & 0xff));
                    p++;
                }
                cp7_cy_1   += cp7;
                cp1_cy_cp2 += cp1;
                cp4_cy_cp5 += cp4;
            }
            return;
        }
 public void multiPixel(int pk_l, int pk_t, double[] cpara, int i_resolution, INyARRgbRaster i_in_raster, INyARRgbRaster o_out)
 {
     Debug.Assert(i_in_raster.isEqualBufferType(NyARBufferType.BYTE1D_B8G8R8X8_32));
     //出力形式による分岐(分解能が高い時は大した差が出ないから、ANYだけ。)
     multiPixel_ANY(pk_l, pk_t, i_in_raster.getWidth(), i_in_raster.getHeight(), i_resolution, cpara, (byte[])i_in_raster.getBuffer(), o_out);
     return;
 }