本文整理汇总了C#中INyARGrayscaleRaster.isEqualBufferType方法的典型用法代码示例。如果您正苦于以下问题:C# INyARGrayscaleRaster.isEqualBufferType方法的具体用法?C# INyARGrayscaleRaster.isEqualBufferType怎么用?C# INyARGrayscaleRaster.isEqualBufferType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类INyARGrayscaleRaster
的用法示例。
在下文中一共展示了INyARGrayscaleRaster.isEqualBufferType方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: doFilter
public override void doFilter(int i_l, int i_t, int i_w, int i_h, int i_th, INyARGrayscaleRaster i_gsraster)
{
Debug.Assert(i_gsraster.isEqualBufferType(NyARBufferType.INT1D_BIN_8));
INyARRgbPixelDriver input = this._raster.getRgbPixelDriver();
int[] output = (int[])i_gsraster.getBuffer();
int th = i_th * 3;
NyARIntSize s = i_gsraster.getSize();
int skip_dst = (s.w - i_w);
int skip_src = skip_dst;
//左上から1行づつ走査していく
int pt_dst = (i_t * s.w + i_l);
int[] rgb = this.__rgb;
for (int y = 0; y <i_h; y++)
{
int x;
for (x = 0; x < i_w; x++)
{
input.getPixel(x + i_l, y + i_t, rgb);
output[pt_dst++] = (rgb[0] + rgb[1] + rgb[2]) <= th ? 0 : 1;
}
//スキップ
pt_dst += skip_dst;
}
return;
}
示例2: doFilter
public override void doFilter(int i_l, int i_t, int i_w, int i_h, int i_th, INyARGrayscaleRaster i_gsraster)
{
Debug.Assert(i_gsraster.isEqualBufferType(NyARBufferType.INT1D_BIN_8));
byte[] input = (byte[])this._raster.getBuffer();
int[] output = (int[])i_gsraster.getBuffer();
int th = i_th * 3;
NyARIntSize s = this._raster.getSize();
int skip_dst = (s.w - i_w);
int skip_src = skip_dst * 3;
int pix_count = i_w;
int pix_mod_part = pix_count - (pix_count % 8);
//左上から1行づつ走査していく
int pt_dst = (i_t * s.w + i_l);
int pt_src = pt_dst * 3;
for (int y = i_h - 1; y >= 0; y -= 1)
{
int x;
for (x = pix_count - 1; x >= pix_mod_part; x--)
{
output[pt_dst++] = ((input[pt_src + 0] & 0xff) + (input[pt_src + 1] & 0xff) + (input[pt_src + 2] & 0xff)) <= th ? 0 : 1;
pt_src += 3;
}
for (; x >= 0; x -= 8)
{
output[pt_dst++] = ((input[pt_src + 0] & 0xff) + (input[pt_src + 1] & 0xff) + (input[pt_src + 2] & 0xff)) <= th ? 0 : 1;
pt_src += 3;
output[pt_dst++] = ((input[pt_src + 0] & 0xff) + (input[pt_src + 1] & 0xff) + (input[pt_src + 2] & 0xff)) <= th ? 0 : 1;
pt_src += 3;
output[pt_dst++] = ((input[pt_src + 0] & 0xff) + (input[pt_src + 1] & 0xff) + (input[pt_src + 2] & 0xff)) <= th ? 0 : 1;
pt_src += 3;
output[pt_dst++] = ((input[pt_src + 0] & 0xff) + (input[pt_src + 1] & 0xff) + (input[pt_src + 2] & 0xff)) <= th ? 0 : 1;
pt_src += 3;
output[pt_dst++] = ((input[pt_src + 0] & 0xff) + (input[pt_src + 1] & 0xff) + (input[pt_src + 2] & 0xff)) <= th ? 0 : 1;
pt_src += 3;
output[pt_dst++] = ((input[pt_src + 0] & 0xff) + (input[pt_src + 1] & 0xff) + (input[pt_src + 2] & 0xff)) <= th ? 0 : 1;
pt_src += 3;
output[pt_dst++] = ((input[pt_src + 0] & 0xff) + (input[pt_src + 1] & 0xff) + (input[pt_src + 2] & 0xff)) <= th ? 0 : 1;
pt_src += 3;
output[pt_dst++] = ((input[pt_src + 0] & 0xff) + (input[pt_src + 1] & 0xff) + (input[pt_src + 2] & 0xff)) <= th ? 0 : 1;
pt_src += 3;
}
//スキップ
pt_src += skip_src;
pt_dst += skip_dst;
}
return;
}
示例3: doFilter
public void doFilter(int i_l, int i_t, int i_w, int i_h, int i_th, INyARGrayscaleRaster i_gsraster)
{
Debug.Assert(i_gsraster.isEqualBufferType(NyARBufferType.INT1D_BIN_8));
BitmapData bm = this._raster.lockBitmap();
byte[] work = this._work;
int[] output = (int[])i_gsraster.getBuffer();
NyARIntSize s = this._raster.getSize();
int th = i_th * 3;
int skip_dst = (s.w - i_w);
int skip_src = skip_dst * 4;
int pix_count = i_w;
int pix_mod_part = pix_count - (pix_count % 8);
//左上から1行づつ走査していく
int pt_dst = (i_t * s.w + i_l);
int pt_src = pt_dst * 4+(int)bm.Scan0;
for (int y = i_h - 1; y >= 0; y -= 1)
{
int x;
int p;
for (x = pix_count - 1; x >= pix_mod_part; x--)
{
p = Marshal.ReadInt32((IntPtr)pt_src);
output[pt_dst++] = (((p >> 16) & 0xff) + ((p >> 8) & 0xff) + (p & 0xff)) <= th ? 0 : 1;
pt_src += 4;
}
for (; x >= 0; x -= 8)
{
Marshal.Copy((IntPtr)pt_src, work, 0, 32);
output[pt_dst ] = (work[0]+work[1]+work[2]) <= th ? 0 : 1;
output[pt_dst+1] = (work[4] + work[5] + work[6]) <= th ? 0 : 1;
output[pt_dst+2] = (work[8] + work[9] + work[10]) <= th ? 0 : 1;
output[pt_dst+3] = (work[12] + work[13] + work[14]) <= th ? 0 : 1;
output[pt_dst+4] = (work[16] + work[17] + work[18]) <= th ? 0 : 1;
output[pt_dst+5] = (work[20] + work[21] + work[22]) <= th ? 0 : 1;
output[pt_dst+6] = (work[24] + work[25] + work[26]) <= th ? 0 : 1;
output[pt_dst+7] = (work[28] + work[29] + work[30]) <= th ? 0 : 1;
pt_src += 32;
pt_dst += 8;
}
//スキップ
pt_src += skip_src;
pt_dst += skip_dst;
}
this._raster.unlockBitmap();
return;
}
示例4: doFilter
public void doFilter(INyARGrayscaleRaster i_output)
{
Debug.Assert(i_output.isEqualBufferType(NyARBufferType.INT1D_GRAY_8));
NyARIntSize size = this._raster.getSize();
int[] in_ptr = (int[])this._raster.getBuffer();
switch (this._raster.getBufferType())
{
case NyARBufferType.INT1D_GRAY_8:
int[] out_ptr = (int[])i_output.getBuffer();
int width = size.w;
int idx = 0;
int idx2 = width;
int fx, fy;
int mod_p = (width - 2) - (width - 2) % 8;
for (int y = 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] = ((fx < 0 ? -fx : fx) + (fy < 0 ? -fy : fy)) >> 1;
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] = ((fx < 0 ? -fx : fx) + (fy < 0 ? -fy : fy)) >> 1;
p00 = p01; p10 = p11;
p01 = in_ptr[idx++]; p11 = in_ptr[idx2++];
fx = p11 - p00;
fy = p10 - p01;
out_ptr[idx - 2] = ((fx < 0 ? -fx : fx) + (fy < 0 ? -fy : fy)) >> 1;
p00 = p01; p10 = p11;
p01 = in_ptr[idx++]; p11 = in_ptr[idx2++];
fx = p11 - p00;
fy = p10 - p01;
out_ptr[idx - 2] = ((fx < 0 ? -fx : fx) + (fy < 0 ? -fy : fy)) >> 1;
p00 = p01; p10 = p11;
p01 = in_ptr[idx++]; p11 = in_ptr[idx2++];
fx = p11 - p00;
fy = p10 - p01;
out_ptr[idx - 2] = ((fx < 0 ? -fx : fx) + (fy < 0 ? -fy : fy)) >> 1;
p00 = p01; p10 = p11;
}
out_ptr[idx - 1] = 0;
}
for (int x = width - 1; x >= 0; x--)
{
out_ptr[idx++] = 0;
}
return;
default:
//ANY未対応
throw new NyARException();
}
}
示例5: NyARGsGaussianSmoothFilter_GS8
public NyARGsGaussianSmoothFilter_GS8(INyARGrayscaleRaster i_raster)
{
Debug.Assert(i_raster.isEqualBufferType(NyARBufferType.INT1D_GRAY_8));
this._raster = i_raster;
}