• R/O
  • HTTP
  • SSH
  • HTTPS

nyartoolkit-and: Commit

NyARToolkit for Android v2.x, 3.x mainline.

master: NyARToolkit core.
android-1.6: for Android 1.6. obsolete version.
android-2.2: for Android 2.2. current version.


Commit MetaInfo

Revision75a57b42737e01522566c5e0e7718cd56b05533b (tree)
Time2010-02-24 14:37:23
AuthorAtsuo Igarashi <atsuoigarashi@gmai...>
CommiterAtsuo Igarashi

Log Message

Support NyARToolkit-2.5.1.

Modified for Android and NyARToolkit-2.5.1 by suga.

Signed-off-by: suga <sugai@users.sourceforge.jp>

Change Summary

Incremental Difference

--- a/.classpath
+++ b/.classpath
@@ -4,6 +4,6 @@
44 <classpathentry kind="src" path="gen"/>
55 <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
66 <classpathentry kind="lib" path="lib/MetasequoiaLib.jar"/>
7- <classpathentry kind="src" path="jogl"/>
7+ <classpathentry kind="src" path="src.utils/jogl"/>
88 <classpathentry kind="output" path="bin"/>
99 </classpath>
--- a/src/jp/android_group/artoolkit/ARToolkitDrawer.java
+++ b/src/jp/android_group/artoolkit/ARToolkitDrawer.java
@@ -8,6 +8,7 @@ import jp.nyatla.nyartoolkit.core.NyARCode;
88 import jp.nyatla.nyartoolkit.core.param.NyARParam;
99 import jp.nyatla.nyartoolkit.core.raster.rgb.NyARRgbRaster_RGB;
1010 import jp.nyatla.nyartoolkit.core.transmat.NyARTransMatResult;
11+import jp.nyatla.nyartoolkit.core.types.NyARBufferType;
1112 import jp.nyatla.nyartoolkit.detector.NyARSingleDetectMarker;
1213 import jp.nyatla.nyartoolkit.jogl.utils.NyARGLUtil;
1314 import android.graphics.Bitmap;
@@ -20,7 +21,7 @@ public class ARToolkitDrawer {
2021 private NyARRgbRaster_RGB raster = null;
2122 private NyARGLUtil ar_util = null;
2223 private NyARParam ar_param = null;
23- private NyARCode ar_code = new NyARCode(16, 16);
24+ private NyARCode ar_code = null;
2425 private NyARTransMatResult ar_transmat_result = new NyARTransMatResult();
2526
2627
@@ -43,10 +44,11 @@ public class ARToolkitDrawer {
4344 ar_util = new NyARGLUtil();
4445 ar_param = new NyARParam();
4546 ar_param.loadARParam(camePara);
47+ ar_code = new NyARCode(16, 16);
4648 ar_code.loadARPatt(patt);
4749 //TODO 本当は、ここはifの外でないと行けない。だけど、出すとOutOfMemory
4850 ar_param.changeScreenSize(w, h);
49- nya = new NyARSingleDetectMarker(ar_param, ar_code, 80.0);
51+ nya = new NyARSingleDetectMarker(ar_param, ar_code, 80.0, NyARBufferType.BYTE1D_B8G8R8_24);
5052 nya.setContinueMode(false);
5153 }
5254 Log.d("nyar", "resources have been loaded");
@@ -107,10 +109,11 @@ public class ARToolkitDrawer {
107109 }
108110
109111 createNyARTool(w, h);
110- raster = NyARRgbRaster_RGB.wrap(buf, w, h);
111112 // Marker detection
112113 try {
113114 Log.d("AR draw", "Marker detection.");
115+ raster = new NyARRgbRaster_RGB(w, h);
116+ raster.wrapBuffer(buf);
114117 is_marker_exist = nya.detectMarkerLite(raster, 100);
115118 } catch (NyARException e) {
116119 Log.e("AR draw", "marker detection failed", e);
--- a/src/jp/android_group/artoolkit/R.java
+++ /dev/null
@@ -1,39 +0,0 @@
1-/* AUTO-GENERATED FILE. DO NOT MODIFY.
2- *
3- * This class was automatically generated by the
4- * aapt tool from the resource data it found. It
5- * should not be modified by hand.
6- */
7-
8-package jp.android_group.artoolkit;
9-
10-public final class R {
11- public static final class attr {
12- }
13- public static final class drawable {
14- public static final int icon=0x7f020000;
15- }
16- public static final class id {
17- public static final int DEV1_GL_view=0x7f060001;
18- public static final int DEV1_camera_preview=0x7f060002;
19- public static final int GL_view=0x7f060000;
20- }
21- public static final class layout {
22- public static final int camera=0x7f030000;
23- public static final int devonecamera=0x7f030001;
24- }
25- public static final class raw {
26- public static final int camera_para=0x7f040000;
27- public static final int marker=0x7f040001;
28- public static final int miku_voice=0x7f040002;
29- public static final int patt=0x7f040003;
30- }
31- public static final class string {
32- public static final int app_name=0x7f050000;
33- public static final int camera_keeping=0x7f050005;
34- public static final int camera_name=0x7f050001;
35- public static final int camera_tossing=0x7f050004;
36- public static final int server_addr=0x7f050002;
37- public static final int server_port=0x7f050003;
38- }
39-}
--- a/src/jp/android_group/artoolkit/hardware/Dev1Camera.java
+++ b/src/jp/android_group/artoolkit/hardware/Dev1Camera.java
@@ -1,5 +1,7 @@
11 package jp.android_group.artoolkit.hardware;
22
3+import java.io.IOException;
4+
35 import jp.android_group.artoolkit.NyARToolkitAndroidActivity;
46 import jp.android_group.artoolkit.R;
57 import android.content.Context;
@@ -364,7 +366,11 @@ public class Dev1Camera implements CameraIF {
364366 stopPreview();
365367
366368 // this blanks the screen if the surface changed, no-op otherwise
367- mCameraDevice.setPreviewDisplay(mSurfaceHolder);
369+ try {
370+ mCameraDevice.setPreviewDisplay(mSurfaceHolder);
371+ } catch (IOException e) {
372+ Log.e("Dev1", "IOError", e);
373+ }
368374
369375
370376 // request the preview size, the hardware may not honor it,
--- a/src/jp/nyatla/nyartoolkit/processor/SingleARMarkerProcesser.java
+++ b/src/jp/nyatla/nyartoolkit/processor/SingleARMarkerProcesser.java
@@ -98,7 +98,7 @@ public abstract class SingleARMarkerProcesser
9898 this._ref_raster=i_raster;
9999 this._target_id=i_target_id;
100100 this.code_index=-1;
101- this.confidence=Double.MIN_NORMAL;
101+ this.confidence=Double.MIN_VALUE;
102102 }
103103
104104 /**
Show on old repository browser