OSDN Git Service

Support NyARToolkit-2.5.1. 2.5.1a
authorAtsuo Igarashi <atsuoigarashi@gmail.com>
Wed, 24 Feb 2010 05:37:23 +0000 (14:37 +0900)
committerAtsuo Igarashi <atsuoigarashi@gmail.com>
Wed, 24 Feb 2010 05:37:23 +0000 (14:37 +0900)
Modified for Android and NyARToolkit-2.5.1 by suga.

Signed-off-by: suga <sugai@users.sourceforge.jp>
.classpath
src/jp/android_group/artoolkit/ARToolkitDrawer.java
src/jp/android_group/artoolkit/R.java [deleted file]
src/jp/android_group/artoolkit/hardware/Dev1Camera.java
src/jp/nyatla/nyartoolkit/processor/SingleARMarkerProcesser.java

index 25a22ca..e38079f 100644 (file)
@@ -4,6 +4,6 @@
        <classpathentry kind="src" path="gen"/>\r
        <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>\r
        <classpathentry kind="lib" path="lib/MetasequoiaLib.jar"/>\r
-       <classpathentry kind="src" path="jogl"/>\r
+       <classpathentry kind="src" path="src.utils/jogl"/>\r
        <classpathentry kind="output" path="bin"/>\r
 </classpath>\r
index 8b8e306..c2fcda3 100644 (file)
@@ -8,6 +8,7 @@ import jp.nyatla.nyartoolkit.core.NyARCode;
 import jp.nyatla.nyartoolkit.core.param.NyARParam;
 import jp.nyatla.nyartoolkit.core.raster.rgb.NyARRgbRaster_RGB;
 import jp.nyatla.nyartoolkit.core.transmat.NyARTransMatResult;
+import jp.nyatla.nyartoolkit.core.types.NyARBufferType;
 import jp.nyatla.nyartoolkit.detector.NyARSingleDetectMarker;
 import jp.nyatla.nyartoolkit.jogl.utils.NyARGLUtil;
 import android.graphics.Bitmap;
@@ -20,7 +21,7 @@ public class ARToolkitDrawer {
        private NyARRgbRaster_RGB raster = null;
        private NyARGLUtil ar_util = null;
        private NyARParam ar_param = null;
-       private NyARCode ar_code = new NyARCode(16, 16);
+       private NyARCode ar_code = null;
        private NyARTransMatResult ar_transmat_result = new NyARTransMatResult();
 
        
@@ -43,10 +44,11 @@ public class ARToolkitDrawer {
                                ar_util = new NyARGLUtil();
                                ar_param = new NyARParam();
                                ar_param.loadARParam(camePara);
+                               ar_code = new NyARCode(16, 16);
                                ar_code.loadARPatt(patt);
                                //TODO 本当は、ここはifの外でないと行けない。だけど、出すとOutOfMemory
                                ar_param.changeScreenSize(w, h);
-                               nya = new NyARSingleDetectMarker(ar_param, ar_code, 80.0);
+                               nya = new NyARSingleDetectMarker(ar_param, ar_code, 80.0, NyARBufferType.BYTE1D_B8G8R8_24);
                                nya.setContinueMode(false);
                        }
                        Log.d("nyar", "resources have been loaded");
@@ -107,10 +109,11 @@ public class ARToolkitDrawer {
                }
                
                createNyARTool(w, h);
-               raster = NyARRgbRaster_RGB.wrap(buf, w, h);
                // Marker detection 
                try {
                        Log.d("AR draw", "Marker detection.");
+                       raster = new NyARRgbRaster_RGB(w, h);
+                       raster.wrapBuffer(buf);
                        is_marker_exist = nya.detectMarkerLite(raster, 100);
                } catch (NyARException e) {
                        Log.e("AR draw", "marker detection failed", e);
diff --git a/src/jp/android_group/artoolkit/R.java b/src/jp/android_group/artoolkit/R.java
deleted file mode 100644 (file)
index 1149216..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/* AUTO-GENERATED FILE.  DO NOT MODIFY.\r
- *\r
- * This class was automatically generated by the\r
- * aapt tool from the resource data it found.  It\r
- * should not be modified by hand.\r
- */\r
-\r
-package jp.android_group.artoolkit;\r
-\r
-public final class R {\r
-    public static final class attr {\r
-    }\r
-    public static final class drawable {\r
-        public static final int icon=0x7f020000;\r
-    }\r
-    public static final class id {\r
-        public static final int DEV1_GL_view=0x7f060001;\r
-        public static final int DEV1_camera_preview=0x7f060002;\r
-        public static final int GL_view=0x7f060000;\r
-    }\r
-    public static final class layout {\r
-        public static final int camera=0x7f030000;\r
-        public static final int devonecamera=0x7f030001;\r
-    }\r
-    public static final class raw {\r
-        public static final int camera_para=0x7f040000;\r
-        public static final int marker=0x7f040001;\r
-        public static final int miku_voice=0x7f040002;\r
-        public static final int patt=0x7f040003;\r
-    }\r
-    public static final class string {\r
-        public static final int app_name=0x7f050000;\r
-        public static final int camera_keeping=0x7f050005;\r
-        public static final int camera_name=0x7f050001;\r
-        public static final int camera_tossing=0x7f050004;\r
-        public static final int server_addr=0x7f050002;\r
-        public static final int server_port=0x7f050003;\r
-    }\r
-}\r
index 644abfb..db38be0 100644 (file)
@@ -1,5 +1,7 @@
 package jp.android_group.artoolkit.hardware;
 
+import java.io.IOException;
+
 import jp.android_group.artoolkit.NyARToolkitAndroidActivity;
 import jp.android_group.artoolkit.R;
 import android.content.Context;
@@ -364,7 +366,11 @@ public class Dev1Camera implements CameraIF {
                        stopPreview();
                
                // this blanks the screen if the surface changed, no-op otherwise
-               mCameraDevice.setPreviewDisplay(mSurfaceHolder);
+               try {
+                       mCameraDevice.setPreviewDisplay(mSurfaceHolder);
+               } catch (IOException e) {
+                       Log.e("Dev1", "IOError", e);
+               }
                
 
                // request the preview size, the hardware may not honor it,
index 7341d7c..bcb699f 100644 (file)
@@ -98,7 +98,7 @@ public abstract class SingleARMarkerProcesser
                        this._ref_raster=i_raster;\r
                        this._target_id=i_target_id;\r
                        this.code_index=-1;\r
-                       this.confidence=Double.MIN_NORMAL;\r
+                       this.confidence=Double.MIN_VALUE;\r
                }\r
 \r
                /**\r