• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# INyARRaster类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: setRaster

        /**
         * XRGB[width*height]の配列から、パターンデータを構築。
         * @param i_buffer
         */
        public void setRaster(INyARRaster i_raster)
        {
            //i_buffer[XRGB]→差分[BW]変換			
            int i;
            int ave;//<PV/>
            int rgb;//<PV/>
            int[] linput = this._data;//<PV/>
            int[] buf = (int[])i_raster.getBuffer();

            // input配列のサイズとwhも更新// input=new int[height][width][3];
            int number_of_pixels = this._number_of_pixels;

            //<平均値計算(FORの1/8展開)/>
            ave = 0;
            for (i = number_of_pixels - 1; i >= 0; i--)
            {
                rgb = buf[i];
                ave += ((rgb >> 16) & 0xff) + ((rgb >> 8) & 0xff) + (rgb & 0xff);
            }
            ave = (number_of_pixels * 255 * 3 - ave) / (3 * number_of_pixels);
            //
            int sum = 0, w_sum;

            //<差分値計算/>
            for (i = number_of_pixels - 1; i >= 0; i--)
            {
                rgb = buf[i];
                w_sum = ((255 * 3 - (rgb & 0xff) - ((rgb >> 8) & 0xff) - ((rgb >> 16) & 0xff)) / 3) - ave;
                linput[i] = w_sum;
                sum += w_sum * w_sum;
            }
            double p = Math.Sqrt((double)sum);
            this._pow = p != 0.0 ? p : 0.0000001;
            return;
        }
开发者ID:flair2005,项目名称:CameraPositioner,代码行数:39,代码来源:NyARMatchPattDeviationBlackWhiteData.cs


示例2: doFilter

		    public void doFilter(INyARRaster i_input, INyARRaster i_output,NyARIntSize i_size)
		    {
                Debug.Assert(i_input.isEqualBufferType(NyARBufferType.INT1D_GRAY_8));
                Debug.Assert(i_output.isEqualBufferType(NyARBufferType.INT1D_GRAY_8));
			    int[] in_ptr =(int[])i_input.getBuffer();
			    int[] out_ptr=(int[])i_output.getBuffer();
			    int width=i_size.w;
			    int idx=0;
			    int idx2=width;
			    int fx,fy;
			    int mod_p=(width-2)-(width-2)%4;
			    for(int y=i_size.h-2;y>=0;y--){
				    int p00=in_ptr[idx++];
				    int p10=in_ptr[idx2++];
				    int p01,p11;
				    int x=width-2;
				    for(;x>=mod_p;x--){
					    p01=in_ptr[idx++];p11=in_ptr[idx2++];
					    fx=p11-p00;fy=p10-p01;
    //					out_ptr[idx-2]=255-(((fx<0?-fx:fx)+(fy<0?-fy:fy))>>1);
					    fx=(fx*fx+fy*fy)>>SH;out_ptr[idx-2]=(fx>255?0:255-fx);
					    p00=p01;
					    p10=p11;
				    }
				    for(;x>=0;x-=4){
					    p01=in_ptr[idx++];p11=in_ptr[idx2++];
					    fx=p11-p00;
					    fy=p10-p01;
    //					out_ptr[idx-2]=255-(((fx<0?-fx:fx)+(fy<0?-fy:fy))>>1);
					    fx=(fx*fx+fy*fy)>>SH;out_ptr[idx-2]=(fx>255?0:255-fx);
					    p00=p01;p10=p11;
					    p01=in_ptr[idx++];p11=in_ptr[idx2++];
					    fx=p11-p00;
					    fy=p10-p01;
    //					out_ptr[idx-2]=255-(((fx<0?-fx:fx)+(fy<0?-fy:fy))>>1);
					    fx=(fx*fx+fy*fy)>>SH;out_ptr[idx-2]=(fx>255?0:255-fx);
					    p00=p01;p10=p11;
					    p01=in_ptr[idx++];p11=in_ptr[idx2++];
    					
					    fx=p11-p00;
					    fy=p10-p01;
    //					out_ptr[idx-2]=255-(((fx<0?-fx:fx)+(fy<0?-fy:fy))>>1);
					    fx=(fx*fx+fy*fy)>>SH;out_ptr[idx-2]=(fx>255?0:255-fx);
					    p00=p01;p10=p11;

					    p01=in_ptr[idx++];p11=in_ptr[idx2++];
					    fx=p11-p00;
					    fy=p10-p01;
    //					out_ptr[idx-2]=255-(((fx<0?-fx:fx)+(fy<0?-fy:fy))>>1);
					    fx=(fx*fx+fy*fy)>>SH;out_ptr[idx-2]=(fx>255?0:255-fx);
					    p00=p01;p10=p11;

				    }
				    out_ptr[idx-1]=255;
			    }
			    for(int x=width-1;x>=0;x--){
				    out_ptr[idx++]=255;
			    }
			    return;
		    }
开发者ID:mlakhal,项目名称:CollaborativeAugmentedRealityEnvironment,代码行数:60,代码来源:NegativeSqRoberts.cs


示例3: doFilter

		    public void doFilter(INyARRaster i_input, INyARRaster i_output,NyARIntSize i_size)
		    {
			    Debug.Assert (i_input.isEqualBufferType(NyARBufferType.INT1D_GRAY_8));
			    Debug.Assert (i_output.isEqualBufferType(NyARBufferType.INT1D_GRAY_8));
			    int[] in_ptr =(int[])i_input.getBuffer();
			    int[] out_ptr=(int[])i_output.getBuffer();
			    int width=i_size.w;
			    int height=i_size.h;
			    for(int y=0;y<height-1;y++){
				    int idx=y*width;
				    int p00=in_ptr[idx];
				    int p10=in_ptr[width+idx];
				    int p01,p11;
				    for(int x=0;x<width-1;x++){
					    p01=in_ptr[idx+1];
					    p11=in_ptr[idx+width+1];
					    int fx=p11-p00;
					    int fy=p10-p01;
					    out_ptr[idx]=(int)Math.Sqrt(fx*fx+fy*fy)>>1;
					    p00=p01;
					    p10=p11;
					    idx++;
				    }
			    }
			    return;
		    }
开发者ID:flair2005,项目名称:CameraPositioner,代码行数:26,代码来源:NyARRasterFilter_Roberts.cs


示例4: doFilter

		    public void doFilter(INyARRaster i_input, INyARRaster i_output,NyARIntSize i_size)
		    {
			    Debug.Assert (i_input.isEqualBufferType(NyARBufferType.INT1D_GRAY_8));
			    Debug.Assert (i_output.isEqualBufferType(NyARBufferType.INT1D_GRAY_8));
			    int[] in_ptr =(int[])i_input.getBuffer();
			    int[] out_ptr=(int[])i_output.getBuffer();
			    int width=i_size.w;
			    int height=i_size.h;
			    int col0,col1,col2;
			    int bptr=0;
			    //1行目
			    col1=in_ptr[bptr  ]*2+in_ptr[bptr+width  ];
			    col2=in_ptr[bptr+1]*2+in_ptr[bptr+width+1];
			    out_ptr[bptr]=(col1*2+col2)/9;
			    bptr++;
			    for(int x=0;x<width-2;x++){
				    col0=col1;
				    col1=col2;
				    col2=in_ptr[bptr+1]*2+in_ptr[bptr+width+1];
				    out_ptr[bptr]=(col0+col1*2+col2)/12;
				    bptr++;
			    }			
			    out_ptr[bptr]=(col1+col2)/9;
			    bptr++;
			    //2行目-末行-1

			    for(int y=0;y<height-2;y++){
				    //左端
				    col1=in_ptr[bptr  ]*2+in_ptr[bptr-width  ]+in_ptr[bptr+width  ];
				    col2=in_ptr[bptr+1]*2+in_ptr[bptr-width+1]+in_ptr[bptr+width+1];
				    out_ptr[bptr]=(col1+col2)/12;
				    bptr++;
				    for(int x=0;x<width-2;x++){
					    col0=col1;
					    col1=col2;
					    col2=in_ptr[bptr+1]*2+in_ptr[bptr-width+1]+in_ptr[bptr+width+1];
					    out_ptr[bptr]=(col0+col1*2+col2)/16;
					    bptr++;
				    }
				    //右端
				    out_ptr[bptr]=(col1*2+col2)/12;
				    bptr++;
			    }
			    //末行目
			    col1=in_ptr[bptr  ]*2+in_ptr[bptr-width  ];
			    col2=in_ptr[bptr+1]*2+in_ptr[bptr-width+1];
			    out_ptr[bptr]=(col1+col2)/9;
			    bptr++;
			    for(int x=0;x<width-2;x++){
				    col0=col1;
				    col1=col2;
				    col2=in_ptr[bptr+1]*2+in_ptr[bptr-width+1];
				    out_ptr[bptr]=(col0+col1*2+col2)/12;
				    bptr++;
			    }			
			    out_ptr[bptr]=(col1*2+col2)/9;
			    bptr++;
			    return;
		    }
开发者ID:flair2005,项目名称:CameraPositioner,代码行数:59,代码来源:NyARRasterFilter_GaussianSmooth.cs


示例5: doFilter

 /**
  * 入力ラスタをHSV形式に変換して、出力ラスタへ書込みます。
  * 画素形式は、コンストラクタに指定した形式に合せてください。
  */
 public void doFilter(INyARRgbRaster i_input, INyARRaster i_output)
 {
     Debug.Assert(i_input.getSize().isEqualSize(i_output.getSize()) == true);
     if (!this._do_filter_impl.isSupport(i_input, i_output))
     {
         this._do_filter_impl = this.createFilter(i_input, i_output);
     }
     this._do_filter_impl.doFilter(i_input, i_output, i_input.getSize());
 }
开发者ID:mlakhal,项目名称:CollaborativeAugmentedRealityEnvironment,代码行数:13,代码来源:NyARRasterFilter_Rgb2Hsv.cs


示例6: doFilter

		    public override void doFilter(INyARRaster i_input, INyARRaster i_output,NyARIntSize i_size)
		    {
			   Debug. Assert(		i_input.isEqualBufferType(NyARBufferType.INT1D_GRAY_8));
    			
			    int[] out_buf = (int[]) i_output.getBuffer();
			    int[] in_buf = (int[]) i_input.getBuffer();
			    for(int i=i_size.h*i_size.w-1;i>=0;i--)
			    {
				    out_buf[i]=this._table_ref[in_buf[i]];
			    }
			    return;
		    }
开发者ID:flair2005,项目名称:CameraPositioner,代码行数:12,代码来源:NyARRasterFilter_CustomToneTable.cs


示例7: createFilter

 protected IFilter createFilter(INyARRaster i_in, INyARRaster i_out)
 {
     if (i_in.getBufferType() == NyARBufferType.INT1D_GRAY_8)
     {
         switch (i_out.getBufferType())
         {
             case NyARBufferType.BYTE1D_B8G8R8_24:
                 return new Rgb2HsvFilter_BYTE1D_B8G8R8_24();
             default:
                 break;
         }
     }
     throw new NyARException();
 }
开发者ID:whztt07,项目名称:NyARToolkitCS,代码行数:14,代码来源:NyARRasterFilter_Rgb2Hsv.cs


示例8: doFilter

            public void doFilter(INyARRaster i_input, INyARRaster i_output, NyARIntSize i_size)
            {
                Debug.Assert(i_input.isEqualBufferType(NyARBufferType.INT1D_GRAY_8));
                Debug.Assert(i_output.isEqualBufferType(NyARBufferType.INT1D_GRAY_8));
                int[] in_ptr = (int[])i_input.getBuffer();
                int[] out_ptr = (int[])i_output.getBuffer();


                int number_of_pixel = i_size.h * i_size.w;
                for (int i = 0; i < number_of_pixel; i++)
                {
                    out_ptr[i] = 255 - in_ptr[i];
                }
                return;
            }
开发者ID:flair2005,项目名称:CameraPositioner,代码行数:15,代码来源:NyARRasterFilter_Reverse.cs


示例9: doFilter

		    /**
		     * This function is not optimized.
		     */
		    public void doFilter(INyARRaster i_input, INyARRaster i_output,NyARIntSize i_size)
		    {
                Debug.Assert(i_input.isEqualBufferType(NyARBufferType.BYTE1D_B8G8R8_24));
                Debug.Assert(i_output.isEqualBufferType(NyARBufferType.INT1D_GRAY_8));
    			
			    int[] out_buf = (int[]) i_output.getBuffer();
			    byte[] in_buf = (byte[]) i_input.getBuffer();

			    int bp = 0;
			    for (int y = 0; y < i_size.h; y++){
				    for (int x = 0; x < i_size.w; x++){
					    out_buf[y*i_size.w+x]=(306*(in_buf[bp+2] & 0xff)+601*(in_buf[bp + 1] & 0xff)+117 * (in_buf[bp + 0] & 0xff))>>10;
					    bp += 3;
				    }
			    }
			    return;
		    }
开发者ID:flair2005,项目名称:CameraPositioner,代码行数:20,代码来源:NyARRasterFilter_Rgb2Gs_YCbCr.cs


示例10: doFilter

	    public override void doFilter(INyARRaster i_input, INyARRaster i_output)
	    {
		    //ヒストグラムを得る
		    NyARHistogram hist=this._histogram;
		    this._hist_analyzer.analyzeRaster(i_input,hist);
		    //変換テーブルを作成
		    int hist_total=this._histogram.total_of_data;
		    int min=hist.getMinData();
		    int hist_size=this._histogram.length;
		    int sum=0;
		    for(int i=0;i<hist_size;i++){
			    sum+=hist.data[i];
			    this.table[i]=(int)((sum-min)*(hist_size-1)/((hist_total-min)));
		    }
		    //変換
		    base.doFilter(i_input, i_output);
	    }
开发者ID:flair2005,项目名称:CameraPositioner,代码行数:17,代码来源:NyARRasterFilter_EqualizeHist.cs


示例11: 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


示例12: NyARContourPickup_BIN_GS8

 public NyARContourPickup_BIN_GS8(INyARRaster i_ref_raster)
 {
     this._ref_raster = i_ref_raster;
 }
开发者ID:walidBelfadel,项目名称:MARS_project,代码行数:4,代码来源:NyARContourPickup.cs


示例13: 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


示例14: onePixel

 protected abstract bool onePixel(int pk_l, int pk_t, double[] cpara, INyARRaster o_out);
开发者ID:walidBelfadel,项目名称:MARS_project,代码行数:1,代码来源:NyARPerspectiveCopy_Base.cs


示例15: doThFilter

		    public void doThFilter(INyARRaster i_input, INyARRaster i_output,NyARIntSize i_size,int i_threshold)
		    {
                Debug.Assert(i_output.isEqualBufferType(NyARBufferType.INT1D_BIN_8));
    			
			    int[] out_buf = (int[]) i_output.getBuffer();
			    byte[] in_buf = (byte[]) i_input.getBuffer();
    			
			    int th=i_threshold*3;
			    int bp =(i_size.w*i_size.h-1)*4;
			    int w;
			    int xy;
			    int pix_count   =i_size.h*i_size.w;
			    int pix_mod_part=pix_count-(pix_count%8);
			    for(xy=pix_count-1;xy>=pix_mod_part;xy--){
				    w= ((in_buf[bp+1] & 0xff) + (in_buf[bp + 2] & 0xff) + (in_buf[bp + 3] & 0xff));
				    out_buf[xy]=w<=th?0:1;
				    bp -= 4;
			    }
			    //タイリング
			    for (;xy>=0;) {
				    w= ((in_buf[bp+1] & 0xff) + (in_buf[bp + 2] & 0xff) + (in_buf[bp + 3] & 0xff));
				    out_buf[xy]=w<=th?0:1;
				    bp -= 4;
				    xy--;
				    w= ((in_buf[bp+1] & 0xff) + (in_buf[bp + 2] & 0xff) + (in_buf[bp + 3] & 0xff));
				    out_buf[xy]=w<=th?0:1;
				    bp -= 4;
				    xy--;
				    w= ((in_buf[bp+1] & 0xff) + (in_buf[bp + 2] & 0xff) + (in_buf[bp + 3] & 0xff));
				    out_buf[xy]=w<=th?0:1;
				    bp -= 4;
				    xy--;
				    w= ((in_buf[bp+1] & 0xff) + (in_buf[bp + 2] & 0xff) + (in_buf[bp + 3] & 0xff));
				    out_buf[xy]=w<=th?0:1;
				    bp -= 4;
				    xy--;
				    w= ((in_buf[bp+1] & 0xff) + (in_buf[bp + 2] & 0xff) + (in_buf[bp + 3] & 0xff));
				    out_buf[xy]=w<=th?0:1;
				    bp -= 4;
				    xy--;
				    w= ((in_buf[bp+1] & 0xff) + (in_buf[bp + 2] & 0xff) + (in_buf[bp + 3] & 0xff));
				    out_buf[xy]=w<=th?0:1;
				    bp -= 4;
				    xy--;
				    w= ((in_buf[bp+1] & 0xff) + (in_buf[bp + 2] & 0xff) + (in_buf[bp + 3] & 0xff));
				    out_buf[xy]=w<=th?0:1;
				    bp -= 4;
				    xy--;
				    w= ((in_buf[bp+1] & 0xff) + (in_buf[bp + 2] & 0xff) + (in_buf[bp + 3] & 0xff));
				    out_buf[xy]=w<=th?0:1;
				    bp -= 4;
				    xy--;
			    }
			    return;			
		    }
开发者ID:flair2005,项目名称:CameraPositioner,代码行数:55,代码来源:NyARRasterFilter_ARToolkitThreshold.cs


示例16: NyARHistogramFromRaster_INTGS8

 public NyARHistogramFromRaster_INTGS8(INyARRaster i_raster)
 {
     this._gsr = i_raster;
 }
开发者ID:whztt07,项目名称:NyARToolkitCS,代码行数:4,代码来源:NyARHistogramFromRasterFactory.cs


示例17: 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


示例18: isCompatibleRaster

 public bool isCompatibleRaster(INyARRaster i_raster)
 {
     return i_raster.isEqualBufferType(NyARBufferType.INT1D_GRAY_8);
 }
开发者ID:ooHIROoo,项目名称:Imagine2016,代码行数:4,代码来源:NyARGsPixelDriverFactory.cs


示例19: switchRaster

 public void switchRaster(INyARRaster i_ref_raster)
 {
     this._ref_buf = (int[])i_ref_raster.getBuffer();
     this._ref_size = i_ref_raster.getSize();
 }
开发者ID:ooHIROoo,项目名称:Imagine2016,代码行数:5,代码来源:NyARGsPixelDriverFactory.cs


示例20: 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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# INyARRgbRaster类代码示例发布时间:2022-05-24
下一篇:
C# INyARGrayscaleRaster类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap