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