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


C# INyARRaster.isEqualBufferType方法代码示例

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


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

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

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

示例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;
			    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

示例4: 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)
					    ||	i_input.isEqualBufferType(NyARBufferType.BYTE1D_R8G8B8_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] = ((in_buf[bp] & 0xff) * (in_buf[bp + 1] & 0xff) * (in_buf[bp + 2] & 0xff)) >> 16;
					    bp += 3;
				    }
			    }
			    return;
		    }
开发者ID:flair2005,项目名称:CameraPositioner,代码行数:21,代码来源:NyARRasterFilter_Rgb2Gs_RgbCube.cs

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

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

示例7: doThFilter

            public void doThFilter(INyARRaster i_input, INyARRaster i_output, NyARIntSize i_size)
            {
                Debug.Assert(i_output.isEqualBufferType(NyARBufferType.INT1D_BIN_8));

                int[] out_buf = (int[])i_output.getBuffer();
                byte[] in_buf = (byte[])i_input.getBuffer();

                byte[] grey = new byte[i_size.w * i_size.h];
                ulong[] integralImg = new ulong[i_size.w * i_size.h];

                ulong sum = 0;
                float T = 0.15f;
                double s = i_size.w / 8;
                int x1, x2, y1, y2;
                int index, s2 = (int)(s / 2);
                int count = 0;

                // greyscale
                for (int i = 0, j = 0; i < in_buf.Length; )
                {
                    grey[j++] = (byte)
                        ((in_buf[i + 1] & 0xff) * 0.11 + // b
                        (in_buf[i + 2] & 0xff) * 0.59 + // g
                        (in_buf[i + 3] & 0xff) * 0.3); // r
                    i += 4; // skip alpha
                }

                // integral image
                for (int i = 0; i < i_size.w; i++)
                {
                    sum = 0; // cumulative row sum
                    for (int j = 0; j < i_size.h; j++)
                    {
                        index = j * i_size.w + i;
                        sum += grey[index];
                        if (i == 0)
                            integralImg[index] = (ulong)sum;
                        else
                            integralImg[index] = integralImg[index - 1] + (ulong)sum;
                    }
                }

                for (int i = 0; i < i_size.w; i++)
                {
                    for (int j = 0; j < i_size.h; j++)
                    {
                        index = j * i_size.w + i;

                        // set the SxS region
                        x1 = i - s2; x2 = i + s2;
                        y1 = j - s2; y2 = j + s2;

                        // check the border
                        if (x1 < 0) x1 = 0;
                        if (x2 >= i_size.w) x2 = i_size.w - 1;
                        if (y1 < 0) y1 = 0;
                        if (y2 >= i_size.h) y2 = i_size.h - 1;

                        count = (x2 - x1) * (y2 - y1);

                        sum = integralImg[y2 * i_size.w + x2] -
                              integralImg[y1 * i_size.w + x2] -
                              integralImg[y2 * i_size.w + x1] +
                              integralImg[y1 * i_size.w + x1];

                        if ((long)(grey[index] * count) < (long)(sum * (1.0 - T)))
                            out_buf[index] = 0;
                        else
                            out_buf[index] = 1;
                    }
                }

                return;
            }
开发者ID:amoldeshpande,项目名称:slartoolkit,代码行数:74,代码来源:NyARRasterFilter_AdaptiveThreshold.cs

示例8: isCompatibleRaster

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

示例9: 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();
			    short[] in_buf = (short[]) i_input.getBuffer();
    			
			    int th=i_threshold*3;
			    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 =(int)in_buf[xy];
                    w = ((w & 0xf800) >> 8) + ((w & 0x07e0) >> 3) + ((w & 0x001f) << 3);
                    out_buf[xy] = w <= th ? 0 : 1;
			    }
			    //タイリング
			    for (;xy>=0;) {
                    w =(int)in_buf[xy];
                    w = ((w & 0xf800) >> 8) + ((w & 0x07e0) >> 3) + ((w & 0x001f) << 3);
                    out_buf[xy] = w <= th ? 0 : 1;
				    xy--;
                    w =(int)in_buf[xy];
                    w = ((w & 0xf800) >> 8) + ((w & 0x07e0) >> 3) + ((w & 0x001f) << 3);
                    out_buf[xy] = w <= th ? 0 : 1;
				    xy--;
                    w =(int)in_buf[xy];
                    w = ((w & 0xf800) >> 8) + ((w & 0x07e0) >> 3) + ((w & 0x001f) << 3);
                    out_buf[xy] = w <= th ? 0 : 1;
				    xy--;
                    w =(int)in_buf[xy];
                    w = ((w & 0xf800) >> 8) + ((w & 0x07e0) >> 3) + ((w & 0x001f) << 3);
                    out_buf[xy] = w <= th ? 0 : 1;
				    xy--;
                    w =(int)in_buf[xy];
                    w = ((w & 0xf800) >> 8) + ((w & 0x07e0) >> 3) + ((w & 0x001f) << 3);
                    out_buf[xy] = w <= th ? 0 : 1;
				    xy--;
                    w =(int)in_buf[xy];
                    w = ((w & 0xf800) >> 8) + ((w & 0x07e0) >> 3) + ((w & 0x001f) << 3);
                    out_buf[xy] = w <= th ? 0 : 1;
				    xy--;
                    w =(int)in_buf[xy];
                    w = ((w & 0xf800) >> 8) + ((w & 0x07e0) >> 3) + ((w & 0x001f) << 3);
                    out_buf[xy] = w <= th ? 0 : 1;
				    xy--;
                    w =(int)in_buf[xy];
                    w = ((w & 0xf800) >> 8) + ((w & 0x07e0) >> 3) + ((w & 0x001f) << 3);
                    out_buf[xy] = w <= th ? 0 : 1;
				    xy--;
			    }
		    }		
开发者ID:flair2005,项目名称:CameraPositioner,代码行数:54,代码来源:NyARRasterFilter_ARToolkitThreshold.cs

示例10: createHistogram

		    public int createHistogram(INyARRaster i_reader,NyARIntSize i_size, int[] o_histogram,int i_skip)
		    {
	            Debug.Assert(i_reader.isEqualBufferType(NyARBufferType.BYTE1D_X8R8G8B8_32));
	            byte[] input = (byte[])i_reader.getBuffer();
	            int pix_count = i_size.w;
	            int pix_mod_part = pix_count - (pix_count % 8);
	       	    for (int y = i_size.h - 1; y >= 0; y -=i_skip)
	            {
	                int pt = y * i_size.w * 4;
	                int x, v;
	                for (x = pix_count - 1; x >= pix_mod_part; x--)
	                {
	                    v = ((input[pt + 1] & 0xff) + (input[pt + 2] & 0xff) + (input[pt + 3] & 0xff)) / 3;
	                    o_histogram[v]++;
	                    pt += 4;
	                }
	                //タイリング
	                for (; x >= 0; x -= 8)
	                {
	                    v = ((input[pt + 1] & 0xff) + (input[pt + 2] & 0xff) + (input[pt + 3] & 0xff)) / 3;
	                    o_histogram[v]++;
	                    v = ((input[pt + 5] & 0xff) + (input[pt + 6] & 0xff) + (input[pt + 7] & 0xff)) / 3;
	                    o_histogram[v]++;
	                    v = ((input[pt + 9] & 0xff) + (input[pt + 10] & 0xff) + (input[pt + 11] & 0xff)) / 3;
	                    o_histogram[v]++;
	                    v = ((input[pt + 13] & 0xff) + (input[pt + 14] & 0xff) + (input[pt + 15] & 0xff)) / 3;
	                    o_histogram[v]++;
	                    v = ((input[pt + 17] & 0xff) + (input[pt + 18] & 0xff) + (input[pt + 19] & 0xff)) / 3;
	                    o_histogram[v]++;
	                    v = ((input[pt + 21] & 0xff) + (input[pt + 22] & 0xff) + (input[pt + 23] & 0xff)) / 3;
	                    o_histogram[v]++;
	                    v = ((input[pt + 25] & 0xff) + (input[pt + 26] & 0xff) + (input[pt + 27] & 0xff)) / 3;
	                    o_histogram[v]++;
	                    v = ((input[pt + 29] & 0xff) + (input[pt + 30] & 0xff) + (input[pt + 31] & 0xff)) / 3;
	                    o_histogram[v]++;
	                    pt += 4 * 8;
	                }
	            }
	       	    return i_size.w*i_size.h;
	        }
开发者ID:flair2005,项目名称:CameraPositioner,代码行数:40,代码来源:NyARRasterAnalyzer_Histogram.cs

示例11: NyARRgb2GsFilterRgbAve_BYTE1D_B8G8R8X8_32

 public NyARRgb2GsFilterRgbAve_BYTE1D_B8G8R8X8_32(INyARRaster i_ref_raster)
 {
     Debug.Assert(i_ref_raster.isEqualBufferType(NyARBufferType.BYTE1D_B8G8R8X8_32));
     this._ref_raster = i_ref_raster;
 }
开发者ID:mlakhal,项目名称:CollaborativeAugmentedRealityEnvironment,代码行数:5,代码来源:NyARRgb2GsFilterFactory.cs

示例12: setRaster

        /**
         * NyARRasterからパターンデータをセットします。
         * この関数は、データを元に所有するデータ領域を更新します。
         * @param i_buffer
         */
        public void setRaster(INyARRaster i_raster)
        {
            //画素フォーマット、サイズ制限
            Debug.Assert(i_raster.isEqualBufferType(NyARBufferType.INT1D_X8R8G8B8_32));
            Debug.Assert(i_raster.getSize().isEqualSize(i_raster.getSize()));

            int[] buf = (int[])i_raster.getBuffer();
            //i_buffer[XRGB]→差分[R,G,B]変換			
            int i;
            int ave;//<PV/>
            int rgb;//<PV/>
            int[] linput = this._data;//<PV/>

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

            //<平均値計算(FORの1/8展開)>
            ave = 0;
            for (i = number_of_pixels - 1; i >= for_mod; i--)
            {
                rgb = buf[i]; ave += ((rgb >> 16) & 0xff) + ((rgb >> 8) & 0xff) + (rgb & 0xff);
            }
            for (; i >= 0; )
            {
                rgb = buf[i]; ave += ((rgb >> 16) & 0xff) + ((rgb >> 8) & 0xff) + (rgb & 0xff); i--;
                rgb = buf[i]; ave += ((rgb >> 16) & 0xff) + ((rgb >> 8) & 0xff) + (rgb & 0xff); i--;
                rgb = buf[i]; ave += ((rgb >> 16) & 0xff) + ((rgb >> 8) & 0xff) + (rgb & 0xff); i--;
                rgb = buf[i]; ave += ((rgb >> 16) & 0xff) + ((rgb >> 8) & 0xff) + (rgb & 0xff); i--;
                rgb = buf[i]; ave += ((rgb >> 16) & 0xff) + ((rgb >> 8) & 0xff) + (rgb & 0xff); i--;
                rgb = buf[i]; ave += ((rgb >> 16) & 0xff) + ((rgb >> 8) & 0xff) + (rgb & 0xff); i--;
                rgb = buf[i]; ave += ((rgb >> 16) & 0xff) + ((rgb >> 8) & 0xff) + (rgb & 0xff); i--;
                rgb = buf[i]; ave += ((rgb >> 16) & 0xff) + ((rgb >> 8) & 0xff) + (rgb & 0xff); i--;
            }
            //<平均値計算(FORの1/8展開)/>
            ave = number_of_pixels * 255 * 3 - ave;
            ave = 255 - (ave / (number_of_pixels * 3));//(255-R)-ave を分解するための事前計算

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

示例13: doFilter

        public void doFilter(INyARRaster i_input, INyARRaster i_output, NyARIntSize i_size)
        {
            Debug.Assert(i_input.isEqualBufferType(NyARBufferType.INT1D_X7H9S8V8_32));

            int[] out_buf = (int[])i_output.getBuffer();
            byte[] in_buf = (byte[])i_input.getBuffer();
            int s;
            for (int i = i_size.h * i_size.w - 1; i >= 0; i--)
            {
                int r = (in_buf[i * 3 + 2] & 0xff);
                int g = (in_buf[i * 3 + 1] & 0xff);
                int b = (in_buf[i * 3 + 0] & 0xff);
                int cmax, cmin;
                //最大値と最小値を計算
                if (r > g)
                {
                    cmax = r;
                    cmin = g;
                }
                else
                {
                    cmax = g;
                    cmin = r;
                }
                if (b > cmax)
                {
                    cmax = b;
                }
                if (b < cmin)
                {
                    cmin = b;
                }
                int h;
                if (cmax == 0)
                {
                    s = 0;
                    h = 0;
                }
                else
                {
                    s = (cmax - cmin) * 255 / cmax;
                    int cdes = cmax - cmin;
                    //H成分を計算
                    if (cdes != 0)
                    {
                        if (cmax == r)
                        {
                            h = (g - b) * 60 / cdes;
                        }
                        else if (cmax == g)
                        {
                            h = (b - r) * 60 / cdes + 2 * 60;
                        }
                        else
                        {
                            h = (r - g) * 60 / cdes + 4 * 60;
                        }
                    }
                    else
                    {
                        h = 0;
                    }
                }
                if (h < 0)
                {
                    h += 360;
                }
                //hsv変換(h9s8v8)
                out_buf[i] = (0x1ff0000 & (h << 16)) | (0x00ff00 & (s << 8)) | (cmax & 0xff);
            }
            return;
        }
开发者ID:whztt07,项目名称:NyARToolkitCS,代码行数:72,代码来源:NyARRasterFilter_Rgb2Hsv.cs

示例14: isSupport

 public bool isSupport(INyARRaster i_in, INyARRaster i_out)
 {
     return i_in.isEqualBufferType(NyARBufferType.BYTE1D_B8G8R8_24) && i_out.isEqualBufferType(NyARBufferType.INT1D_X7H9S8V8_32);
 }
开发者ID:whztt07,项目名称:NyARToolkitCS,代码行数:4,代码来源:NyARRasterFilter_Rgb2Hsv.cs

示例15: doFilter

		    public void doFilter(INyARRaster i_input, INyARRaster i_output,NyARIntSize i_size)
		    {
			    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] = ((in_buf[bp] & 0xff) + (in_buf[bp + 1] & 0xff) + (in_buf[bp + 2] & 0xff)) / 3;
					    bp += 4;
				    }
			    }
		    }
开发者ID:flair2005,项目名称:CameraPositioner,代码行数:14,代码来源:NyARRasterFilter_Rgb2Gs_AveAdd.cs


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