チェンジセット 1774
- コミット日時:
- 2008/10/31 01:50:07 (2 ヶ月前)
- ファイル:
-
- as3/FLARToolKit/trunk/samples/org/tarotaro/flash/ar/FLARCubeMarkerDetectorSample.as (更新) (4 diffs)
- as3/FLARToolKit/trunk/samples/org/tarotaro/flash/ar/detector (追加)
- as3/FLARToolKit/trunk/samples/org/tarotaro/flash/ar/detector/CubeMarker.as (追加)
- as3/FLARToolKit/trunk/samples/org/tarotaro/flash/ar/detector/CubeMarkerDetectedResult.as (追加)
- as3/FLARToolKit/trunk/samples/org/tarotaro/flash/ar/detector/CubeMarkerDirection.as (追加)
- as3/FLARToolKit/trunk/samples/org/tarotaro/flash/ar/detector/CubeMarkerMatchResultTemporaryHolder.as (追加)
- as3/FLARToolKit/trunk/samples/org/tarotaro/flash/ar/detector/FLARCubeMarkerDetector.as (追加)
- as3/FLARToolKit/trunk/samples/org/tarotaro/flash/ar/layers/FLARCubeMarkerLayer.as (更新) (5 diffs)
凡例:
- 変更無し
- 追加
- 削除
- 更新
- コピー
- 移動
as3/FLARToolKit/trunk/samples/org/tarotaro/flash/ar/FLARCubeMarkerDetectorSample.as
r1755 r1774 14 14 import org.libspark.flartoolkit.core.raster.rgb.FLARRgbRaster_BitmapData; 15 15 import org.libspark.flartoolkit.core.raster.rgb.IFLARRgbRaster; 16 import org. libspark.flartoolkit.detector.CubeMarker;16 import org.tarotaro.flash.ar.detector.CubeMarker; 17 17 import org.tarotaro.flash.ar.layers.FLARCubeMarkerLayer; 18 18 import org.tarotaro.flash.ar.layers.FLARLayer; … … 44 44 var param:FLARParam = new FLARParam(); 45 45 param.loadARParam(new CParam() as ByteArray); 46 46 param.changeScreenSize(320, 240); 47 47 //パターンの設定 48 48 var cTop:FLARCode = new FLARCode(16, 16); … … 67 67 //表示部分を設定 68 68 this._capture = new Bitmap(new BitmapData(320, 240, false, 0), PixelSnapping.AUTO, true); 69 this._capture.scaleX = this._capture.scaleY = 2; 69 70 70 var raster:IFLARRgbRaster = new FLARRgbRaster_BitmapData(this._capture.bitmapData); 71 71 var webcam:Camera = Camera.getCamera(); … … 77 77 78 78 this._layer = new FLARCubeMarkerLayer(raster, param, cube); 79 this._layer.scaleX = this._layer.scaleY = 2;80 79 80 this._arSprite = new Sprite(); 81 81 82 this.addChild(this._capture); 83 this.addChild(this._layer); 84 82 this._arSprite.addChild(this._capture); 83 this._arSprite.addChild(this._layer); 84 this._arSprite.scaleX = this._arSprite.scaleY = 2; 85 this.addChild(this._arSprite); 86 85 87 this.addChild(new FPSMeter()); 86 88 as3/FLARToolKit/trunk/samples/org/tarotaro/flash/ar/layers/FLARCubeMarkerLayer.as
r1755 r1774 38 38 import org.libspark.flartoolkit.core.raster.rgb.IFLARRgbRaster; 39 39 import org.libspark.flartoolkit.core.transmat.FLARTransMatResult; 40 import org.libspark.flartoolkit.detector.CubeMarker;41 import org.libspark.flartoolkit.detector.FLARCubeMarkerDetector;42 40 import org.libspark.flartoolkit.detector.FLARMultiMarkerDetector; 43 41 import org.libspark.flartoolkit.detector.FLARMultiMarkerDetectorResult; 42 import org.libspark.flartoolkit.pv3d.FLARBaseNode; 43 import org.papervision3d.lights.PointLight3D; 44 import org.papervision3d.materials.shadematerials.FlatShadeMaterial; 45 import org.papervision3d.materials.utils.MaterialsList; 46 import org.papervision3d.materials.WireframeMaterial; 47 import org.papervision3d.objects.primitives.Cube; 48 import org.papervision3d.objects.primitives.Plane; 49 import org.papervision3d.view.BasicView; 50 import org.tarotaro.flash.ar.detector.CubeMarker; 51 import org.tarotaro.flash.ar.detector.CubeMarkerDetectedResult; 52 import org.tarotaro.flash.ar.detector.CubeMarkerDirection; 53 import org.tarotaro.flash.ar.detector.FLARCubeMarkerDetector; 44 54 45 55 /** … … 52 62 protected var _resultMat:FLARTransMatResult; 53 63 protected var _confidence:Number; 64 protected var _baseNode:FLARBaseNode; 65 private var _plane:Plane; 66 private var _cube:Cube; 67 private var _view:BasicView; 54 68 55 69 private var colors:Object = { … … 67 81 { 68 82 super(src, thresh); 69 this._detector = new FLARCubeMarkerDetector(param, cube );70 this._detector.sizeCheckEnabled = false;83 this._detector = new FLARCubeMarkerDetector(param, cube,1.0); 84 //this._detector.sizeCheckEnabled = false; 71 85 this._resultMat = new FLARTransMatResult(); 72 86 this._confidence = confidence; 87 88 this._baseNode = new FLARBaseNode(); 89 var wmat:WireframeMaterial = new WireframeMaterial(0xff0000, 1, 2); 90 wmat.doubleSided = true; 91 this._plane = new Plane(wmat, 100, 100); 92 this._baseNode.addChild(this._plane); 93 94 var light:PointLight3D = new PointLight3D(); 95 light.x = 1000; 96 light.y = 1000; 97 light.z = -1000; 98 var fmat:FlatShadeMaterial = new FlatShadeMaterial(light, 0xff22aa, 0x0); 99 this._cube = new Cube(new MaterialsList({all: fmat}), 60,60,60); 100 this._cube.z += 20; 101 this._baseNode.addChild(this._cube); 102 103 this._view = new BasicView(320, 240); 104 this._view.scene.addChild(this._baseNode); 105 this.addChild(this._view); 73 106 } 74 107 … … 78 111 g.clear(); 79 112 80 //var numDetected:int = this._detector.detectMarkerLite(this._source, this._thresh); 81 var r:Object = this._detector.detectMarkerLite(this._source, this._thresh); 82 if (r != null) { 83 //if (numDetected > 0) { 84 //trace(numDetected); 85 //for (var i:uint = 0; i < numDetected; i++) { 86 //var r:FLARMultiMarkerDetectorResult = this._detector.getResult(i); 87 trace(r.codeId,":",r.confidence); 88 //if (r.confidence <= this._confidence) { 89 //continue; 90 //} 113 var r:CubeMarkerDetectedResult = this._detector.detectMarkerLite(this._source, this._thresh); 114 if (r != null && r.confidence > this._confidence) { 115 trace(r.markerDirection, r.confidence); 116 if (r.markerDirection == CubeMarkerDirection.FRONT) { 117 this._detector.getTransmationMatrix(r, this._resultMat); 118 this._baseNode.setTransformMatrix(this._resultMat); 119 this._view.startRendering(); 120 } 91 121 var v:Array = r.square.sqvertex; 92 122 g.lineStyle(2, colors[r.markerDirection]); … … 95 125 g.lineTo(v[vi].x, v[vi].y); 96 126 } 97 //} 127 } else { 128 this._view.stopRendering(); 98 129 } 99 130 }
