本文整理汇总了C#中INyARGrayscaleRaster类的典型用法代码示例。如果您正苦于以下问题:C# INyARGrayscaleRaster类的具体用法?C# INyARGrayscaleRaster怎么用?C# INyARGrayscaleRaster使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
INyARGrayscaleRaster类属于命名空间,在下文中一共展示了INyARGrayscaleRaster类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: labeling
public override bool labeling(INyARGrayscaleRaster i_raster, int i_th)
{
//配列初期化
this.label_stack.clear();
//ラベルの検出
bool ret = base.labeling(i_raster, i_th);
//ソート
this.label_stack.sortByArea();
return ret;
}
开发者ID:mlakhal,项目名称:CollaborativeAugmentedRealityEnvironment,代码行数:10,代码来源:NyARSquareContourDetector_Rle.cs
示例3: CreateDriver
/**
* この関数は、i_rasterを操作するピクセルドライバインスタンスを生成します。
* @param i_raster
* @return
* @throws NyARException
*/
public static INyARGsRasterGraphics CreateDriver(INyARGrayscaleRaster i_raster)
{
switch (i_raster.getBufferType()) {
case NyARBufferType.INT1D_GRAY_8:
return new NyARGsRasterGraphics_GS_INT8(i_raster);
default:
break;
}
throw new NyARException();
}
示例4: doFilter
public void doFilter(int[] i_tone_table, INyARGrayscaleRaster i_output)
{
INyARGsPixelDriver outd = i_output.getGsPixelDriver();
INyARGsPixelDriver ind = this._raster.getGsPixelDriver();
NyARIntSize s = this._raster.getSize();
for (int y = s.h - 1; y >= 0; y--)
{
for (int x = s.w - 1; x >= 0; x--)
{
outd.setPixel(x, y, i_tone_table[ind.getPixel(x, y)]);
}
}
}
示例5: copyTo
public void copyTo(int i_left, int i_top, int i_skip, INyARGrayscaleRaster o_output)
{
Debug.Assert(this._raster.getSize().isInnerSize(i_left + o_output.getWidth() * i_skip, i_top + o_output.getHeight() * i_skip));
int[] input = (int[])this._raster.getBuffer();
switch (o_output.getBufferType())
{
case NyARBufferType.INT1D_GRAY_8:
int[] output = (int[])o_output.getBuffer();
NyARIntSize dest_size = o_output.getSize();
NyARIntSize src_size = this._raster.getSize();
int skip_src_y = (src_size.w - dest_size.w * i_skip) + src_size.w * (i_skip - 1);
int pix_count = dest_size.w;
int pix_mod_part = pix_count - (pix_count % 8);
// 左上から1行づつ走査していく
int pt_dst = 0;
int pt_src = (i_top * src_size.w + i_left);
for (int y = dest_size.h - 1; y >= 0; y -= 1)
{
int x;
for (x = pix_count - 1; x >= pix_mod_part; x--)
{
output[pt_dst++] = input[pt_src];
pt_src += i_skip;
}
for (; x >= 0; x -= 8)
{
output[pt_dst++] = input[pt_src];
pt_src += i_skip;
output[pt_dst++] = input[pt_src];
pt_src += i_skip;
output[pt_dst++] = input[pt_src];
pt_src += i_skip;
output[pt_dst++] = input[pt_src];
pt_src += i_skip;
output[pt_dst++] = input[pt_src];
pt_src += i_skip;
output[pt_dst++] = input[pt_src];
pt_src += i_skip;
output[pt_dst++] = input[pt_src];
pt_src += i_skip;
output[pt_dst++] = input[pt_src];
pt_src += i_skip;
}
// スキップ
pt_src += skip_src_y;
}
return;
default:
throw new NyARException();
}
}
示例6: createDriver
public static IRasterDriver createDriver(INyARGrayscaleRaster i_ref_raster)
{
switch (i_ref_raster.getBufferType())
{
case NyARBufferType.INT1D_GRAY_8:
case NyARBufferType.INT1D_BIN_8:
return new NyARContourPickup_BIN_GS8(i_ref_raster);
default:
if (i_ref_raster is NyARContourPickup_GsReader)
{
return new NyARContourPickup_GsReader((INyARGrayscaleRaster)i_ref_raster);
}
break;
}
throw new NyARException();
}
示例7: 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;
}
示例8: createInstance
public static INyARHistogramFromRaster createInstance(INyARGrayscaleRaster i_raster)
{
switch(i_raster.getBufferType()){
case NyARBufferType.INT1D_GRAY_8:
case NyARBufferType.INT1D_BIN_8:
return new NyARHistogramFromRaster_INTGS8(i_raster);
default:
if(i_raster is INyARGrayscaleRaster){
return new NyARHistogramFromRaster_AnyGs((INyARGrayscaleRaster)i_raster);
}
if (i_raster is INyARRgbRaster)
{
return new NyARHistogramFromRaster_AnyRgb((INyARRgbRaster)i_raster);
}
break;
}
throw new NyARException();
}
示例9: doFilter
public void doFilter(int i_hist_interval, INyARGrayscaleRaster i_output)
{
//ヒストグラムを得る
NyARHistogram hist = this._histogram;
this._histdrv.createHistogram(i_hist_interval, 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._hist[i] = (int)((sum - min) * (hist_size - 1) / ((hist_total - min)));
}
//変換
this._tone_table.doFilter(this._hist, i_output);
return;
}
示例10: createDriver
/**
* ラスタから画素ドライバを構築します。構築したラスタドライバには、i_ref_rasterをセットします。
* @param i_ref_raster
* @return
* @
*/
public static INyARGsPixelDriver createDriver(INyARGrayscaleRaster i_ref_raster)
{
INyARGsPixelDriver ret;
switch (i_ref_raster.getBufferType())
{
case NyARBufferType.INT1D_GRAY_8:
case NyARBufferType.INT1D_BIN_8:
ret = new NyARGsPixelDriver_INT1D_GRAY_8();
break;
default:
//RGBRasterインタフェイスがある場合
if (i_ref_raster is INyARRgbRaster)
{
ret = new NyARGsPixelDriver_RGBX((INyARRgbRaster)i_ref_raster);
break;
}
throw new NyARException();
}
ret.switchRaster(i_ref_raster);
return ret;
}
示例11: sigmoid
public void sigmoid(int i_x, int i_y, double i_gain, INyARGrayscaleRaster i_output)
{
for (int i = 0; i < 256; i++)
{
int v = 255 * (int)(1 / (1 + Math.Exp(i_gain * (i - i_x))) - 0.5) + i_y;
this._table[i] = v < 0 ? 0 : v > 255 ? 255 : v;
}
this._tone_filter.doFilter(this._table, i_output);
}
示例12: line
public void line(double i_a, INyARGrayscaleRaster i_output)
{
this.line(0, 0, i_a, i_output);
}
示例13: convert
public void convert(INyARGrayscaleRaster i_raster)
{
NyARIntSize s = this._ref_raster.getSize();
this.convertRect(0, 0, s.w, s.h, i_raster);
}
示例14: doFilter
public void doFilter(int i_h, INyARGrayscaleRaster i_gsraster)
{
NyARIntSize s = this._raster.getSize();
this.doFilter(0, 0, s.w, s.h, i_h, i_gsraster);
}
示例15: NyARContourPickup_GsReader
public NyARContourPickup_GsReader(INyARGrayscaleRaster i_ref_raster)
{
this._ref_raster = i_ref_raster;
}