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.rasteranalyzer.*;
\r
10 import jp.nyatla.nyartoolkit.core.labeling.*;
\r
11 import jp.nyatla.nyartoolkit.core.labeling.image.NyARLabelingImage;
\r
12 import jp.nyatla.nyartoolkit.core.labeling.types.*;
\r
13 import jp.nyatla.utils.j2se.*;
\r
15 public class LabelingTest extends Frame
\r
17 private final String data_file ="../Data/320x240ABGR.raw";
\r
18 public void drawImage() throws Exception
\r
20 File f=new File(data_file);
\r
21 FileInputStream fs=new FileInputStream(data_file);
\r
22 byte[] buf=new byte[(int)f.length()];
\r
24 NyARRgbRaster_BGRA ra=NyARRgbRaster_BGRA.wrap(buf, 320, 240);
\r
25 NyARLabelingImage limage=new NyARLabelingImage(320,240);
\r
26 INyARLabeling labeling=new NyARLabeling_ARToolKit();
\r
27 // INyARLabeling labeling=new NyLineLabeling();
\r
28 INyARRasterReaderFactory rf=new NyARRasterReaderFactory_RgbTotal();
\r
29 labeling.attachDestination(limage);
\r
30 labeling.labeling(rf.createReader(ra));
\r
31 LabelingBufferdImage img=new LabelingBufferdImage(320,240,LabelingBufferdImage.COLOR_125_COLOR);
\r
32 img.setLabelingImage(limage);
\r
33 this.getGraphics().drawImage(img, 32,32,this);
\r
35 public static void main(String[] args)
\r
38 LabelingTest app=new LabelingTest();
\r
39 app.setVisible(true);
\r
40 app.setBounds(0,0,640,480);
\r
42 }catch(Exception e){
\r
43 e.printStackTrace();
\r