本文整理汇总了Java中jp.nyatla.nyartoolkit.core.raster.rgb.INyARRgbRaster类的典型用法代码示例。如果您正苦于以下问题:Java INyARRgbRaster类的具体用法?Java INyARRgbRaster怎么用?Java INyARRgbRaster使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
INyARRgbRaster类属于jp.nyatla.nyartoolkit.core.raster.rgb包,在下文中一共展示了INyARRgbRaster类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doFilter
import jp.nyatla.nyartoolkit.core.raster.rgb.INyARRgbRaster; //导入依赖的package包/类
public void doFilter(INyARRgbRaster i_input, NyARGrayscaleRaster i_output) throws NyARRuntimeException
{
assert( i_output.isEqualBufferType(NyARBufferType.INT1D_GRAY_8));
assert (i_input.getSize().isEqualSize(i_output.getSize()) == true);
final int[] out_buf = (int[]) i_output.getBuffer();
final byte[] in_buf = (byte[]) i_input.getBuffer();
NyARIntSize size = i_output.getSize();
switch (i_input.getBufferType()) {
case NyARBufferType.BYTE1D_B8G8R8_24:
case NyARBufferType.BYTE1D_R8G8B8_24:
convert24BitRgb(in_buf, out_buf, size);
break;
default:
throw new NyARRuntimeException();
}
return;
}
示例2: LabelingTest
import jp.nyatla.nyartoolkit.core.raster.rgb.INyARRgbRaster; //导入依赖的package包/类
public LabelingTest() throws NyARRuntimeException,Exception
{
this._src_image = ImageIO.read(new File(source_file));
INyARRgbRaster ra =new NyARRgbRaster_RGB(this._src_image.getWidth(),this._src_image.getHeight());
NyARRasterImageIO.copy(this._src_image,ra);
//GS値化
NyARGrayscaleRaster gs=new NyARGrayscaleRaster(this._src_image.getWidth(),this._src_image.getHeight());
NyARRasterFilter_Rgb2Gs_RgbAve192 filter=new NyARRasterFilter_Rgb2Gs_RgbAve192(ra.getBufferType());
filter.doFilter(ra,gs);
//ラべリングの試験
Main_Labeling lv=new Main_Labeling(ra.getWidth(),ra.getHeight());
lv.current_gs=gs;
lv.current_th=230;
lv.labeling(gs,lv.current_th);
//画像をストア
this.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
});
//ペイント
}
示例3: UpdateInput
import jp.nyatla.nyartoolkit.core.raster.rgb.INyARRgbRaster; //导入依赖的package包/类
public void UpdateInput(NyARTrackerSource_Reference o_input) throws NyARRuntimeException
{
Graphics s=_src_image.getGraphics();
s.setColor(Color.white);
s.fillRect(0,0,320,240);
s.setColor(Color.black);
//s.fillRect(x, y,50,50);
s.fillRect(x2, y2,50,50);
x+=sx;y+=sy;
if(x<0 || x>200){sx*=-1;}if(y<0 || y>200){sy*=-1;}
x2+=sx2;y2+=sy2;
if(x2<0 || x2>200){sx2*=-1;}if(y2<0 || y2>200){sy2*=-1;}
INyARRgbRaster ra =new NyARRgbRaster_RGB(320,240);
NyARRasterImageIO.copy(_src_image, ra);
//GS値化
NyARGrayscaleRaster gs=new NyARGrayscaleRaster(320,240);
NyARRasterFilter_Rgb2Gs_RgbAve192 filter=new NyARRasterFilter_Rgb2Gs_RgbAve192(ra.getBufferType());
filter.doFilter(ra,gs);
//samplerへ入力
o_input.wrapBuffer(gs);
}
示例4: NyARBufferedImageRaster
import jp.nyatla.nyartoolkit.core.raster.rgb.INyARRgbRaster; //导入依赖的package包/类
public NyARBufferedImageRaster(int i_width,int i_height,int i_raster_type,boolean i_is_alloc)
{
super(i_width,i_height,i_is_alloc);
if(i_is_alloc){
this._buffered_image=createBufferedImage(this._size,i_raster_type);
INyARRgbRaster r=NyARRgbRaster.createInstance(i_width,i_height,i_raster_type,false);
callWrapBuffer(r,this._buffered_image);
this._raster=r;
}else{
this._buffered_image=null;
if(i_raster_type==NyARBufferType.OBJECT_Java_BufferedImage){
this._raster=new NyARRgbRaster_OBJECT_Java_BufferedImage(i_width,i_height);
}else{
this._raster=NyARRgbRaster.createInstance(i_width,i_height,i_raster_type,false);
}
}
}
示例5: callWrapBuffer
import jp.nyatla.nyartoolkit.core.raster.rgb.INyARRgbRaster; //导入依赖的package包/类
/**
* i_rasterにi_bmiをラップさせます。
* @param i_ref_bmi
* @return
*/
private static void callWrapBuffer(INyARRgbRaster i_raster,BufferedImage i_bmi)
{
if(i_raster.isEqualBufferType(NyARBufferType.OBJECT_Java_BufferedImage)){
i_raster.wrapBuffer(i_bmi);
return;
}
switch(i_bmi.getRaster().getDataBuffer().getDataType()){
case DataBuffer.TYPE_BYTE:
i_raster.wrapBuffer(((DataBufferByte)(i_bmi.getRaster().getDataBuffer())).getData());
break;
case DataBuffer.TYPE_INT:
i_raster.wrapBuffer(((DataBufferInt)(i_bmi.getRaster().getDataBuffer())).getData());
break;
default:
throw new NyARRuntimeException();
}
}
示例6: loadFromARToolKitFormFile
import jp.nyatla.nyartoolkit.core.raster.rgb.INyARRgbRaster; //导入依赖的package包/类
/**
* ImputStreamからARToolKit形式のマーカデータを読み込み、o_codeオブジェクトへ格納します。
* @param i_stream
* 読出し元のストリームです。
* @param o_code
* 出力先の{@link NyARCode}オブジェクトです。
* @throws NyARRuntimeException
*/
public static void loadFromARToolKitFormFile(InputStream i_stream,NyARCode o_code)
{
int width=o_code.getWidth();
int height=o_code.getHeight();
INyARRgbRaster tmp_raster=NyARRgbRaster.createInstance(width,height, NyARBufferType.INT1D_X8R8G8B8_32);
//4個の要素をラスタにセットする。
try {
StreamTokenizer st = new StreamTokenizer(new InputStreamReader(i_stream));
int[] buf=(int[])tmp_raster.getBuffer();
//GBRAで一度読みだす。
for (int h = 0; h < 4; h++){
readBlock(st,width,height,buf);
//ARCodeにセット(カラー)
o_code.getColorData(h).setRaster(tmp_raster);
o_code.getBlackWhiteData(h).setRaster(tmp_raster);
}
} catch (Exception e) {
throw new NyARRuntimeException(e);
}
tmp_raster=null;//ポイ
return;
}
示例7: createDriver
import jp.nyatla.nyartoolkit.core.raster.rgb.INyARRgbRaster; //导入依赖的package包/类
public static INyARRgb2GsFilterArtkTh createDriver(INyARRgbRaster i_raster)
{
switch (i_raster.getBufferType())
{
case NyARBufferType.BYTE1D_B8G8R8_24:
case NyARBufferType.BYTE1D_R8G8B8_24:
return new NyARRgb2GsFilterArtkTh_BYTE1D_C8C8C8_24(i_raster);
case NyARBufferType.BYTE1D_B8G8R8X8_32:
return new NyARRgb2GsFilterArtkTh_BYTE1D_B8G8R8X8_32(i_raster);
case NyARBufferType.BYTE1D_X8R8G8B8_32:
case NyARBufferType.BYTE1D_X8B8G8R8_32:
return new NyARRgb2GsFilterArtkTh_BYTE1D_X8C8C8C8_32(i_raster);
case NyARBufferType.INT1D_X8R8G8B8_32:
return new NyARRgb2GsFilterArtkTh_INT1D_X8R8G8B8_32(i_raster);
case NyARBufferType.WORD1D_R5G6B5_16LE:
return new NyARRgb2GsFilterArtkTh_WORD1D_R5G6B5_16LE(i_raster);
default:
return new NyARRgb2GsFilterArtkTh_Any(i_raster);
}
}
示例8: createRgbAveDriver
import jp.nyatla.nyartoolkit.core.raster.rgb.INyARRgbRaster; //导入依赖的package包/类
/**
* この関数は、(R*G*B)/3 でグレースケール化するフィルタを生成します。
* 最適化されている形式は以下の通りです。
* <ul>
* <li>{@link NyARBufferType#BYTE1D_B8G8R8X8_32}</li>
* </ul>
* @param i_raster
* @return
* @throws NyARRuntimeException
*/
public static INyARRgb2GsFilterRgbAve createRgbAveDriver(INyARRgbRaster i_raster)
{
switch(i_raster.getBufferType()){
case NyARBufferType.BYTE1D_B8G8R8X8_32:
return new NyARRgb2GsFilterRgbAve_BYTE1D_B8G8R8X8_32(i_raster);
case NyARBufferType.BYTE1D_B8G8R8_24:
return new NyARRgb2GsFilterRgbAve_BYTE1D_C8C8C8_24(i_raster);
case NyARBufferType.BYTE1D_X8R8G8B8_32:
case NyARBufferType.BYTE1D_X8B8G8R8_32:
return new NyARRgb2GsFilterRgbAve_BYTE1D_X8C8C8C8_32(i_raster);
case NyARBufferType.INT1D_X8R8G8B8_32:
return new NyARRgb2GsFilterRgbAve_INT1D_X8R8G8B8_32(i_raster);
default:
return new NyARRgb2GsFilterRgbAve_Any(i_raster);
}
}
示例9: convertRect
import jp.nyatla.nyartoolkit.core.raster.rgb.INyARRgbRaster; //导入依赖的package包/类
public void convertRect(int l,int t,int w,int h,INyARGrayscaleRaster o_raster)
{
int[] wk=this._wk;
final int b=t+h;
final int pix_count=w;
switch(o_raster.getBufferType()){
default:
INyARRgbRaster in_drv=this._ref_raster;
for (int y = t; y < b; y++) {
for (int x = pix_count-1; x >=0; x--){
in_drv.getPixel(x,y,wk);
o_raster.setPixel(x,y,(wk[0]+wk[1]+wk[2])/3);
}
}
return;
}
}
示例10: createInstance
import jp.nyatla.nyartoolkit.core.raster.rgb.INyARRgbRaster; //导入依赖的package包/类
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 instanceof INyARGrayscaleRaster){
return new NyARHistogramFromRaster_AnyGs((INyARGrayscaleRaster)i_raster);
}
if(i_raster instanceof INyARRgbRaster){
return new NyARHistogramFromRaster_AnyRgb((INyARRgbRaster)i_raster);
}
break;
}
throw new NyARRuntimeException();
}
示例11: createHistogram
import jp.nyatla.nyartoolkit.core.raster.rgb.INyARRgbRaster; //导入依赖的package包/类
public void createHistogram(int i_l,int i_t,int i_w,int i_h,int i_skip,NyARHistogram o_histogram)
{
o_histogram.reset();
int[] data_ptr=o_histogram.data;
INyARRgbRaster drv=this._gsr;
final int pix_count=i_w;
final int pix_mod_part=pix_count-(pix_count%8);
//左上から1行づつ走査していく
for (int y = i_h-1; y >=0 ; y-=i_skip){
for (int x = pix_count-1; x >=pix_mod_part; x--){
drv.getPixel(x,y,tmp);
data_ptr[(tmp[0]+tmp[1]+tmp[2])/3]++;
}
}
o_histogram.total_of_data=i_w*i_h/i_skip;
return;
}
示例12: copyPatt
import jp.nyatla.nyartoolkit.core.raster.rgb.INyARRgbRaster; //导入依赖的package包/类
public boolean copyPatt(double i_x1,double i_y1,double i_x2,double i_y2,double i_x3,double i_y3,double i_x4,double i_y4,int i_edge_x,int i_edge_y,int i_resolution,INyARRgbRaster i_out)
{
NyARIntSize out_size=i_out.getSize();
int xe=out_size.w*i_edge_x/50;
int ye=out_size.h*i_edge_y/50;
//サンプリング解像度で分岐
if(i_resolution==1){
if (!this._perspective_gen.getParam((xe*2+out_size.w),(ye*2+out_size.h),i_x1,i_y1,i_x2,i_y2,i_x3,i_y3,i_x4,i_y4,this.__pickFromRaster_cpara)) {
return false;
}
this.onePixel(xe+LOCAL_LT,ye+LOCAL_LT,this.__pickFromRaster_cpara,i_out);
}else{
if (!this._perspective_gen.getParam((xe*2+out_size.w)*i_resolution,(ye*2+out_size.h)*i_resolution,i_x1,i_y1,i_x2,i_y2,i_x3,i_y3,i_x4,i_y4, this.__pickFromRaster_cpara)) {
return false;
}
this.multiPixel(xe*i_resolution+LOCAL_LT,ye*i_resolution+LOCAL_LT,this.__pickFromRaster_cpara,i_resolution,i_out);
}
return true;
}
示例13: Test
import jp.nyatla.nyartoolkit.core.raster.rgb.INyARRgbRaster; //导入依赖的package包/类
/**
* テスト関数の本体です。
* 設定ファイル、サンプル画像の読み込んだのちに、1種類のマーカを登録した{@link MarkerProcessor}を生成し、
* 1回だけ画像を入力して、マーカ検出を試行します。
* @throws Exception
*/
public void Test() throws Exception
{
//AR用カメラパラメタファイルをロード
NyARParam ap = NyARParam.loadFromARParamFile(new FileInputStream(PARAM_FILE),320,240);
// 試験イメージの読み出し(320x240 BGRAのRAWデータ)
File f = new File(data_file);
FileInputStream fs = new FileInputStream(data_file);
byte[] buf = new byte[(int) f.length()];
fs.read(buf);
INyARRgbRaster ra = NyARRgbRaster.createInstance(320, 240,NyARBufferType.BYTE1D_B8G8R8X8_32,false);
ra.wrapBuffer(buf);
MarkerProcessor pr = new MarkerProcessor(ap, ra.getBufferType());
NyARCode[] codes=new NyARCode[1];
codes[0]=NyARCode.loadFromARPattFile(new FileInputStream(CARCODE_FILE),16,16);
pr.setARCodeTable(codes,16,80.0);
pr.detectMarker(ra);
return;
}
示例14: Test
import jp.nyatla.nyartoolkit.core.raster.rgb.INyARRgbRaster; //导入依赖的package包/类
/**
* テスト関数の本体です。
* 設定ファイル、サンプル画像の読み込んだのちに{@link MarkerProcessor}を生成し、
* 1回だけ画像を入力して、マーカ検出を試行します。
* @throws Exception
*/
public void Test() throws Exception
{
//AR用カメラパラメタファイルをロード
NyARParam ap = NyARParam.loadFromARParamFile(new FileInputStream(camera_file),320,240);
// 試験イメージの読み出し(320x240 BGRAのRAWデータ)
File f = new File(data_file);
FileInputStream fs = new FileInputStream(data_file);
byte[] buf = new byte[(int) f.length()];
fs.read(buf);
INyARRgbRaster ra =NyARRgbRaster.createInstance(320, 240,NyARBufferType.BYTE1D_R8G8B8_24,false);
ra.wrapBuffer(buf);
MarkerProcessor pr = new MarkerProcessor(ap, ra.getBufferType());
pr.detectMarker(ra);
return;
}
示例15: run
import jp.nyatla.nyartoolkit.core.raster.rgb.INyARRgbRaster; //导入依赖的package包/类
public void run()
{
try{
INyARRgbRaster rgb=new NyARBufferedImageRaster(this.bmp);
//create same size grayscale raster
INyARGrayscaleRaster gs=NyARGrayscaleRaster.createInstance(rgb.getSize());
((INyARRgb2GsFilterRgbAve)rgb.createInterface(INyARRgb2GsFilterRgbAve.class)).convert(gs);
final NyARNftIsetFile iset;
if(this.dpis!=null){
iset=NyARNftIsetFile.genImageSet(gs,this.dpi,dpis);
}else{
iset=NyARNftIsetFile.genImageSet(gs,this.dpi);
}
SwingUtilities.invokeLater(new Runnable() {
public void run() {
_observer.onLog(isetReport(iset));
}});
final NyARNftFsetFile fset;
fset=NyARNftFsetFile.genFeatureSet(iset,this.lv);
SwingUtilities.invokeLater(new Runnable() {
public void run() {
_observer.onLog(fsetReport(fset));
}});
final NyARNftFreakFsetFile fset3=NyARNftFreakFsetFile.genFeatureSet3(iset);
SwingUtilities.invokeLater(new Runnable() {
public void run() {
_observer.onLog(fset3Report(fset3));
_observer.onFinished(new MakeFeature.Result(iset,fset,fset3));
}});
}catch(InterruptedException e){
_observer.onLog("Canceled!");
}
return;
}