当前位置: 首页>>代码示例>>C#>>正文


C# INyARRaster.getHeight方法代码示例

本文整理汇总了C#中INyARRaster.getHeight方法的典型用法代码示例。如果您正苦于以下问题:C# INyARRaster.getHeight方法的具体用法?C# INyARRaster.getHeight怎么用?C# INyARRaster.getHeight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在INyARRaster的用法示例。


在下文中一共展示了INyARRaster.getHeight方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: multiPixel

        protected override bool multiPixel(int pk_l, int pk_t, double[] cpara, int i_resolution, INyARRaster o_out)
        {
            BitmapData in_bmp = this._ref_raster.lockBitmap();
            int in_w = this._ref_raster.getWidth();
            int in_h = this._ref_raster.getHeight();
            int res_pix = i_resolution * i_resolution;

            //ピクセルリーダーを取得
            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();
            if (o_out is NyARBitmapRaster)
            {
                NyARBitmapRaster bmr=((NyARBitmapRaster)o_out);
                BitmapData bm=bmr.lockBitmap();
                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; }

                                int px = Marshal.ReadInt32(in_bmp.Scan0, (x * 4 + y * in_bmp.Stride));
                                r += (px >> 16) & 0xff;// R
                                g += (px >> 8) & 0xff; // G
                                b += (px) & 0xff;    // B
                                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;
                        }
                        Marshal.WriteInt32(bm.Scan0, ix * 4 + iy * bm.Stride,
                            (0x00ff0000 & ((r / res_pix) << 16)) | (0x0000ff00 & ((g / res_pix) << 8)) | (0x0000ff & (b / res_pix)));
                    }
                }
                bmr.unlockBitmap();
                this._ref_raster.unlockBitmap();
                return true;
            }
            else if (o_out is INyARRgbRaster)
            {
                INyARRgbPixelDriver out_reader = ((INyARRgbRaster)o_out).getRgbPixelDriver();
                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; }

                                int px = Marshal.ReadInt32(in_bmp.Scan0, (x * 4 + y * in_bmp.Stride));
                                r += (px >> 16) & 0xff;// R
//.........这里部分代码省略.........
开发者ID:walidBelfadel,项目名称:MARS_project,代码行数:101,代码来源:NyARBitmapRaster.cs

示例2: onePixel

        protected override bool onePixel(int pk_l, int pk_t, double[] cpara, INyARRaster o_out)
        {
            BitmapData in_bmp = this._ref_raster.lockBitmap();
            int in_w = this._ref_raster.getWidth();
            int in_h = this._ref_raster.getHeight();

             //ピクセルリーダーを取得
            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, p;
            switch (o_out.getBufferType())
            {
                case NyARBufferType.INT1D_X8R8G8B8_32:
                    int[] pat_data = (int[])o_out.getBuffer();
                    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; }

                            //
                            pat_data[p] = Marshal.ReadInt32(in_bmp.Scan0, (x * 4 + y * in_bmp.Stride));
                            //r = (px >> 16) & 0xff;// R
                            //g = (px >> 8) & 0xff; // G
                            //b = (px) & 0xff;    // B
                            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));
                            //pat_data[p] = px;

                            p++;
                        }
                        cp7_cy_1 += cp7;
                        cp1_cy_cp2 += cp1;
                        cp4_cy_cp5 += cp4;
                    }
                    this._ref_raster.unlockBitmap();
                    return true;
                default:
                    if (o_out is NyARBitmapRaster)
                    {
                        NyARBitmapRaster bmr = (NyARBitmapRaster)o_out;
                        BitmapData bm = bmr.lockBitmap();
                        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 pix = Marshal.ReadInt32(in_bmp.Scan0, (x * 4 + y * in_bmp.Stride));
                                Marshal.WriteInt32(bm.Scan0, ix * 4 + iy * bm.Stride, pix);
                                cp7_cy_1_cp6_cx += cp6;
                                cp1_cy_cp2_cp0_cx += cp0;
                                cp4_cy_cp5_cp3_cx += cp3;
                                p++;
                            }
                            cp7_cy_1 += cp7;
                            cp1_cy_cp2 += cp1;
                            cp4_cy_cp5 += cp4;
                        }
                        bmr.unlockBitmap();
                        this._ref_raster.unlockBitmap();
                        return true;
                    }
                    else if (o_out is INyARRgbRaster)
                    {
                        //ANY to RGBx
                        INyARRgbPixelDriver out_reader = ((INyARRgbRaster)o_out).getRgbPixelDriver();
//.........这里部分代码省略.........
开发者ID:walidBelfadel,项目名称:MARS_project,代码行数:101,代码来源:NyARBitmapRaster.cs

示例3: onePixel

        protected override bool onePixel(int pk_l, int pk_t, double[] cpara, INyARRaster o_out)
        {
            Color32[] in_pixs = (Color32[])this._ref_raster.getBuffer();
            int in_w = this._ref_raster.getWidth();
            int in_h = this._ref_raster.getHeight();

            //ピクセルリーダーを取得
            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;
			
			int step,offset;
			//flip Virtical
            switch (o_out.getBufferType())
            {
            case NyARBufferType.INT1D_X8R8G8B8_32:
	            int[] pat_data = (int[])o_out.getBuffer();
                p = 0;
				if(this._is_inv_v){
					offset=in_w*(in_h-1);
					step=-in_w;
				}else{
					offset=0;
					step=in_w;
				}				
                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; }
					
						Color32 pix=in_pixs[x + offset+step*y];
                        //
                        pat_data[p] = ((pix.r << 16) & 0xff)|((pix.g << 8) & 0xff)| pix.b;
                        cp7_cy_1_cp6_cx += cp6;
                        cp1_cy_cp2_cp0_cx += cp0;
                        cp4_cy_cp5_cp3_cx += cp3;
                        p++;
                    }
                    cp7_cy_1 += cp7;
                    cp1_cy_cp2 += cp1;
                    cp4_cy_cp5 += cp4;
                }
                return true;		
            case NyARBufferType.OBJECT_CS_Unity:
				Color32[] out_buf = (Color32[])(((INyARRgbRaster)o_out).getBuffer());
				if(this._is_inv_v==((NyARUnityRaster)o_out).isFlipVirtical()){
					offset=in_w*(in_h-1);
					step=-in_w;
				}else{
					offset=0;
					step=in_w;
				}				
                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;
					int ys=out_h-1-iy;
                    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; }
					
						out_buf[ix+ys*out_w]=in_pixs[x + offset+step*y];
                        //
                        cp7_cy_1_cp6_cx += cp6;
                        cp1_cy_cp2_cp0_cx += cp0;
                        cp4_cy_cp5_cp3_cx += cp3;
                    }
                    cp7_cy_1 += cp7;
                    cp1_cy_cp2 += cp1;
                    cp4_cy_cp5 += cp4;
                }
                return true;
//.........这里部分代码省略.........
开发者ID:Carteor,项目名称:LensesAR-Unity3D,代码行数:101,代码来源:NyARUnityRaster.cs

示例4: multiPixel

        protected override bool multiPixel(int pk_l, int pk_t, double[] cpara, int i_resolution, INyARRaster o_out)
        {
            Color32[] in_pixs = (Color32[])this._ref_raster.getBuffer();
            int in_w = this._ref_raster.getWidth();
            int in_h = this._ref_raster.getHeight();
            int res_pix = i_resolution * i_resolution;

            //ピクセルリーダーを取得
            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 step,offset;
            int out_w = o_out.getWidth();
            int out_h = o_out.getHeight();
            if (o_out is INyARRgbRaster)
            {
                INyARRgbPixelDriver out_reader = ((INyARRgbRaster)o_out).getRgbPixelDriver();
				if(this._is_inv_v){
					offset=in_w*(in_h-1);
					step=-in_w;
				}else{
					offset=0;
					step=in_w;
				}
                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; }
                            	Color32 px = in_pixs[x + offset+step*y];
                                r+= px.r;// R
                                g+= px.g;// G
                                b+= px.b;// B
                                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;
                        }
                        out_reader.setPixel(ix, iy, r / res_pix, g / res_pix, b / res_pix);
                    }
                }
                return true;
            }
            return false;
        }
开发者ID:Carteor,项目名称:LensesAR-Unity3D,代码行数:74,代码来源:NyARUnityRaster.cs

示例5: onePixel

        protected override bool onePixel(int pk_l, int pk_t, double[] cpara, INyARRaster o_out)
        {
            byte[] i_in_buf = (byte[])this._ref_raster.getBuffer();
            int in_w = this._ref_raster.getWidth();
            int in_h = this._ref_raster.getHeight();
            //ピクセルリーダーを取得
            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;
            switch (this._ref_raster.getBufferType())
            {
                case NyARBufferType.INT1D_X8R8G8B8_32:
                    int p = 0;
                    int[] pat_data = (int[])o_out.getBuffer();
                    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) * 3;
                            r = (i_in_buf[bp + 0] & 0xff);
                            g = (i_in_buf[bp + 1] & 0xff);
                            b = (i_in_buf[bp + 2] & 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 true;
                default:
                    if (o_out is INyARRgbRaster)
                    {
                        INyARRgbPixelDriver out_reader = ((INyARRgbRaster)o_out).getRgbPixelDriver();
                        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) * 3;
                                r = (i_in_buf[bp + 0] & 0xff);
                                g = (i_in_buf[bp + 1] & 0xff);
                                b = (i_in_buf[bp + 2] & 0xff);
                                cp7_cy_1_cp6_cx += cp6;
                                cp1_cy_cp2_cp0_cx += cp0;
                                cp4_cy_cp5_cp3_cx += cp3;

                                out_reader.setPixel(ix, iy, r, g, b);
                            }
                            cp7_cy_1 += cp7;
                            cp1_cy_cp2 += cp1;
                            cp4_cy_cp5 += cp4;
                        }
                        return true;
                    }
                    break;
            }
            return false;
        }
开发者ID:ooHIROoo,项目名称:Imagine2016,代码行数:95,代码来源:NyARPerspectiveCopyFactory.cs

示例6: multiPixel

        protected override bool multiPixel(int pk_l, int pk_t, double[] cpara, int i_resolution, INyARRaster o_out)
        {
            int res_pix = i_resolution * i_resolution;

            byte[] i_in_buf = (byte[])this._ref_raster.getBuffer();
            int in_w = this._ref_raster.getWidth();
            int in_h = this._ref_raster.getHeight();

            //ピクセルリーダーを取得
            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();
            if (o_out is INyARRgbRaster)
            {
                INyARRgbPixelDriver out_reader = ((INyARRgbRaster)o_out).getRgbPixelDriver();
                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; }

                                int bp = (x + y * in_w) * 3;
                                r += (i_in_buf[bp + 0] & 0xff);
                                g += (i_in_buf[bp + 1] & 0xff);
                                b += (i_in_buf[bp + 2] & 0xff);
                                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;
                        }
                        out_reader.setPixel(ix, iy, r / res_pix, g / res_pix, b / res_pix);
                    }
                }
                return true;
            }
            return false;
        }
开发者ID:ooHIROoo,项目名称:Imagine2016,代码行数:68,代码来源:NyARPerspectiveCopyFactory.cs

示例7: impl_getContour

        /**
         * ラスタのエントリポイントから辿れる輪郭線を配列に返します。
         * @param i_raster
         * @param i_th
         * 暗点<=th<明点
         * @param i_entry_x
         * @param i_entry_y
         * @param i_array_size
         * @param o_coord_x
         * @param o_coord_y
         * @return
         * 輪郭線の長さを返します。
         * @throws NyARException
         */
        private int impl_getContour(INyARRaster i_raster, int i_th, int i_entry_x, int i_entry_y, int i_array_size, int[] o_coord_x, int[] o_coord_y)
        {
            int[] xdir = _getContour_xdir;// static int xdir[8] = { 0, 1, 1, 1, 0,-1,-1,-1};
            int[] ydir = _getContour_ydir;// static int ydir[8] = {-1,-1, 0, 1, 1, 1, 0,-1};

            int[] i_buf = (int[])i_raster.getBuffer();
            int width = i_raster.getWidth();
            int height = i_raster.getHeight();
            //クリップ領域の上端に接しているポイントを得る。


            int coord_num = 1;
            o_coord_x[0] = i_entry_x;
            o_coord_y[0] = i_entry_y;
            int dir = 5;

            int c = i_entry_x;
            int r = i_entry_y;
            for (; ; )
            {
                dir = (dir + 5) % 8;//dirの正規化
                //ここは頑張ればもっと最適化できると思うよ。
                //4隅以外の境界接地の場合に、境界チェックを省略するとかね。
                if (c >= 1 && c < width - 1 && r >= 1 && r < height - 1)
                {
                    for (; ; )
                    {//gotoのエミュレート用のfor文
                        //境界に接していないとき(暗点判定)
                        if (i_buf[(r + ydir[dir]) * width + (c + xdir[dir])] <= i_th)
                        {
                            break;
                        }
                        dir++;
                        if (i_buf[(r + ydir[dir]) * width + (c + xdir[dir])] <= i_th)
                        {
                            break;
                        }
                        dir++;
                        if (i_buf[(r + ydir[dir]) * width + (c + xdir[dir])] <= i_th)
                        {
                            break;
                        }
                        dir++;
                        if (i_buf[(r + ydir[dir]) * width + (c + xdir[dir])] <= i_th)
                        {
                            break;
                        }
                        dir++;
                        if (i_buf[(r + ydir[dir]) * width + (c + xdir[dir])] <= i_th)
                        {
                            break;
                        }
                        dir++;
                        if (i_buf[(r + ydir[dir]) * width + (c + xdir[dir])] <= i_th)
                        {
                            break;
                        }
                        dir++;
                        if (i_buf[(r + ydir[dir]) * width + (c + xdir[dir])] <= i_th)
                        {
                            break;
                        }
                        dir++;
                        if (i_buf[(r + ydir[dir]) * width + (c + xdir[dir])] <= i_th)
                        {
                            break;
                        }
                        /*
                                            try{
                                                BufferedImage b=new BufferedImage(width,height,ColorSpace.TYPE_RGB);
                                                NyARRasterImageIO.copy(i_raster, b);
                                            ImageIO.write(b,"png",new File("bug.png"));
                                            }catch(Exception e){
						
                                            }*/
                        //8方向全て調べたけどラベルが無いよ?
                        throw new NyARException();
                    }
                }
                else
                {
                    //境界に接しているとき				
                    int i;
                    for (i = 0; i < 8; i++)
                    {
                        int x = c + xdir[dir];
//.........这里部分代码省略.........
开发者ID:flair2005,项目名称:CameraPositioner,代码行数:101,代码来源:NyContourPickup.cs


注:本文中的INyARRaster.getHeight方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。