1 package jp.nyatla.nyartoolkit.dev;
\r
3 import java.awt.Frame;
\r
5 import java.io.FileInputStream;
\r
7 import jp.nyatla.nyartoolkit.core.raster.*;
\r
8 import jp.nyatla.nyartoolkit.core.raster.rgb.NyARRgbRaster_BGRA;
\r
9 import jp.nyatla.nyartoolkit.core.labeling.*;
\r
10 import jp.nyatla.nyartoolkit.core.labeling.types.*;
\r
11 import jp.nyatla.nyartoolkit.core2.rasteranalyzer.*;
\r
12 import jp.nyatla.utils.j2se.*;
\r
14 public class LabelingTest extends Frame
\r
16 private final String data_file ="../Data/320x240ABGR.raw";
\r
17 public void drawImage() throws Exception
\r
19 File f=new File(data_file);
\r
20 FileInputStream fs=new FileInputStream(data_file);
\r
21 byte[] buf=new byte[(int)f.length()];
\r
23 NyARRgbRaster_BGRA ra=NyARRgbRaster_BGRA.wrap(buf, 320, 240);
\r
24 NyARLabelingImage limage=new NyARLabelingImage(320,240);
\r
25 INyARLabeling labeling=new NyARLabeling_ARToolKit();
\r
26 // INyARLabeling labeling=new NyLineLabeling();
\r
27 INyARRasterReaderFactory rf=new NyARRasterReaderFactory_RgbTotal();
\r
28 labeling.attachDestination(limage);
\r
29 labeling.labeling(rf.createReader(ra));
\r
30 LabelingBufferdImage img=new LabelingBufferdImage(320,240,LabelingBufferdImage.COLOR_125_COLOR);
\r
31 img.setLabelingImage(limage);
\r
32 this.getGraphics().drawImage(img, 32,32,this);
\r
34 public static void main(String[] args)
\r
37 LabelingTest app=new LabelingTest();
\r
38 app.setVisible(true);
\r
39 app.setBounds(0,0,640,480);
\r
41 }catch(Exception e){
\r
42 e.printStackTrace();
\r