OSDN Git Service

git-svn-id: http://svn.sourceforge.jp/svnroot/nyartoolkit/NyARToolkit/trunk@723 7cac0...
authornyatla <nyatla@7cac0a50-4618-4814-88d0-24b83990f816>
Tue, 7 Dec 2010 18:46:17 +0000 (18:46 +0000)
committerAtsuo Igarashi <atsuoigarashi@ubuntu.(none)>
Tue, 5 Apr 2011 08:41:51 +0000 (17:41 +0900)
18 files changed:
lib/src.rpf/jp/nyatla/nyartoolkit/rpf/reality/nyartk/NyARReality.java
lib/src.rpf/jp/nyatla/nyartoolkit/rpf/tracker/nyartk/NyARTrackerSource_Reference.java
lib/src.rpf/jp/nyatla/nyartoolkit/rpf/tracker/nyartk/NyARVectorReader_INT1D_GRAY_8.java
lib/src.rpf/jp/nyatla/nyartoolkit/rpf/tracker/nyartk/status/NyARRectTargetStatusPool.java
lib/src.rpf/jp/nyatla/nyartoolkit/rpf/utils/LineBaseVertexDetector.java
lib/src.rpf/jp/nyatla/nyartoolkit/rpf/utils/VecLinearCoordinates.java
lib/src.rpf/jp/nyatla/nyartoolkit/rpf/utils/VecLinearCoordinatesOperator.java
lib/src/jp/nyatla/nyartoolkit/core/NyARCode.java
lib/src/jp/nyatla/nyartoolkit/core/labeling/rlelabeling/NyARRleLabelFragmentInfoPtrStack.java
lib/src/jp/nyatla/nyartoolkit/core/raster/NyARGrayscaleRaster.java
lib/src/jp/nyatla/nyartoolkit/core/rasterfilter/rgb2bin/NyARRasterFilter_ARToolkitThreshold.java
lib/src/jp/nyatla/nyartoolkit/core/rasterfilter/rgb2gs/NyARRasterFilter_Rgb2Gs_RgbAve.java
lib/src/jp/nyatla/nyartoolkit/core/squaredetect/NyARContourPickup.java
lib/src/jp/nyatla/nyartoolkit/core/transmat/rotmatrix/NyARRotVector.java
lib/src/jp/nyatla/nyartoolkit/core/types/NyARVecLinear2d.java
lib/src/jp/nyatla/nyartoolkit/detector/NyARDetectMarker.java
lib/src/jp/nyatla/nyartoolkit/processor/SingleARMarkerProcesser.java
lib/src/jp/nyatla/nyartoolkit/utils/TransformedBitmapPickup.java

index f4e2f1f..5b6e5c6 100644 (file)
@@ -466,7 +466,7 @@ public class NyARReality
         * 成功すると、trueを返します。\r
         * @throws NyARException \r
         */\r
-       public final boolean changeTargetToKnownBySerial(int i_serial,int i_dir,double i_marker_width) throws NyARException\r
+       public final boolean changeTargetToKnownBySerial(long i_serial,int i_dir,double i_marker_width) throws NyARException\r
        {\r
                NyARRealityTarget item=this.target.getItemBySerial(i_serial);\r
                if(item==null){\r
@@ -479,7 +479,7 @@ public class NyARReality
         * @param i_serial\r
         * @throws NyARException \r
         */\r
-       public final NyARRealityTarget changeTargetToDeadBySerial(int i_serial) throws NyARException\r
+       public final NyARRealityTarget changeTargetToDeadBySerial(long i_serial) throws NyARException\r
        {\r
                NyARRealityTarget item=this.target.getItemBySerial(i_serial);\r
                if(item==null){\r
index 235740d..a678c39 100644 (file)
@@ -69,7 +69,7 @@ public class NyARTrackerSource_Reference extends NyARTrackerSource
        public void syncResource() throws NyARException\r
        {\r
                //内部状態の同期\r
-               NyARGrayscaleRaster.copy(this._base_raster,0,0,this._rob_resolution,this._rb_source);\r
+               this._base_raster.copyTo(0,0,this._rob_resolution,this._rb_source);\r
                this._rfilter.doFilter(this._rb_source,this._rbraster);\r
        }\r
        /**\r
index 39c78fd..b761685 100644 (file)
@@ -31,7 +31,7 @@ import jp.nyatla.nyartoolkit.core.squaredetect.NyARContourPickup;
 import jp.nyatla.nyartoolkit.core.types.*;\r
 import jp.nyatla.nyartoolkit.core.utils.NyARMath;\r
 import jp.nyatla.nyartoolkit.rpf.utils.VecLinearCoordinates;\r
-import jp.nyatla.nyartoolkit.rpf.utils.VecLinearCoordinates.NyARVecLinearPoint;\r
+import jp.nyatla.nyartoolkit.rpf.utils.VecLinearCoordinates.VecLinearCoordinatePoint;\r
 \r
 /**\r
  * グレイスケールラスタに対する、特殊な画素アクセス手段を提供します。\r
@@ -39,7 +39,7 @@ import jp.nyatla.nyartoolkit.rpf.utils.VecLinearCoordinates.NyARVecLinearPoint;
  */\r
 public class NyARVectorReader_INT1D_GRAY_8\r
 {\r
-       private NyARVecLinearPoint[] _tmp_coord_pos;\r
+       private VecLinearCoordinatePoint[] _tmp_coord_pos;\r
        private int _rob_resolution;\r
        private NyARGrayscaleRaster _ref_base_raster;\r
        private NyARGrayscaleRaster _ref_rob_raster;\r
@@ -62,7 +62,7 @@ public class NyARVectorReader_INT1D_GRAY_8
                this._ref_base_raster=i_ref_raster;\r
                this._coord_buf = new NyARIntCoordinates((i_ref_raster.getWidth() + i_ref_raster.getHeight()) * 4);\r
                this._factor=i_ref_raster_distortion;\r
-               this._tmp_coord_pos=NyARVecLinearPoint.createArray(this._coord_buf.items.length);\r
+               this._tmp_coord_pos=VecLinearCoordinatePoint.createArray(this._coord_buf.items.length);\r
        }\r
 \r
        /**\r
@@ -376,7 +376,7 @@ public class NyARVectorReader_INT1D_GRAY_8
                return traceConture(coord, 1, s, o_coord);\r
        }\r
        //ベクトルの類似度判定式\r
-       public final static boolean checkVecCos(NyARVecLinearPoint i_current_vec,NyARVecLinearPoint i_prev_vec,double i_ave_dx,double i_ave_dy)\r
+       public final static boolean checkVecCos(VecLinearCoordinatePoint i_current_vec,VecLinearCoordinatePoint i_prev_vec,double i_ave_dx,double i_ave_dy)\r
        {\r
                double x1=i_current_vec.dx;\r
                double y1=i_current_vec.dy;\r
@@ -404,12 +404,12 @@ public class NyARVectorReader_INT1D_GRAY_8
         */\r
        public boolean traceConture(NyARIntCoordinates i_coord, int i_pos_mag,int i_cell_size, VecLinearCoordinates o_coord)\r
        {\r
-               NyARVecLinearPoint[] pos=this._tmp_coord_pos;\r
+               VecLinearCoordinatePoint[] pos=this._tmp_coord_pos;\r
                // ベクトル化\r
                int MAX_COORD = o_coord.items.length;\r
                int i_coordlen = i_coord.length;\r
                NyARIntPoint2d[] coord = i_coord.items;\r
-               NyARVecLinearPoint pos_ptr;\r
+               VecLinearCoordinatePoint pos_ptr;\r
 \r
                //0個目のライン探索\r
                int number_of_data = 0;\r
@@ -499,13 +499,13 @@ public class NyARVectorReader_INT1D_GRAY_8
         * @param i_scale_th\r
         * @return\r
         */\r
-       private final boolean leastSquaresWithNormalize(NyARVecLinearPoint[] i_points,int i_number_of_data,NyARVecLinearPoint o_dest,double i_scale_th)\r
+       private final boolean leastSquaresWithNormalize(VecLinearCoordinatePoint[] i_points,int i_number_of_data,VecLinearCoordinatePoint o_dest,double i_scale_th)\r
        {\r
                int i;\r
                int num=0;\r
                double sum_xy = 0, sum_x = 0, sum_y = 0, sum_x2 = 0;\r
                for (i=i_number_of_data-1; i>=0; i--){\r
-                       NyARVecLinearPoint ptr=i_points[i];\r
+                       VecLinearCoordinatePoint ptr=i_points[i];\r
                        //規定より小さいスケールは除外なう\r
                        if(ptr.scalar<i_scale_th)\r
                        {\r
index bb0819b..8039a1e 100644 (file)
@@ -17,7 +17,7 @@ public class NyARRectTargetStatusPool extends NyARManagedObjectPool<NyARRectTarg
        public VecLinearCoordinates _vecpos=new VecLinearCoordinates(100);\r
        public LineBaseVertexDetector _line_detect=new LineBaseVertexDetector();\r
        public VecLinearCoordinatesOperator _vecpos_op=new VecLinearCoordinatesOperator(); \r
-       public VecLinearCoordinates.NyARVecLinearPoint[] _indexbuf=new VecLinearCoordinates.NyARVecLinearPoint[4];\r
+       public VecLinearCoordinates.VecLinearCoordinatePoint[] _indexbuf=new VecLinearCoordinates.VecLinearCoordinatePoint[4];\r
        public NyARLinear[] _line=NyARLinear.createArray(4);\r
        /**\r
         * @param i_size\r
index f1a3e25..2d41540 100644 (file)
@@ -17,8 +17,8 @@ public class LineBaseVertexDetector
        /**\r
         * 頂点パターンテーブル(6用)\r
         */\r
-       private int[][] _order_table={{0,1,5,4},{0,2,5,3},{1,2,4,3}};\r
-       \r
+       private final static int[][] _order_table={{0,1,5,4},{0,2,5,3},{1,2,4,3}};\r
+       private NyARDoublePoint2d[] __wk_v=NyARDoublePoint2d.createArray(6);\r
        /**\r
         * 適当に与えられた4線分から、四角形の頂点を計算する。\r
         * @param i_line\r
@@ -30,9 +30,9 @@ public class LineBaseVertexDetector
         * @throws NyARException\r
         */\r
 \r
-       public boolean line2SquareVertex(VecLinearCoordinates.NyARVecLinearPoint[] i_line,NyARDoublePoint2d[] o_point) throws NyARException\r
+       public boolean line2SquareVertex(VecLinearCoordinates.VecLinearCoordinatePoint[] i_line,NyARDoublePoint2d[] o_point) throws NyARException\r
        {\r
-               NyARDoublePoint2d[] v=NyARDoublePoint2d.createArray(6);\r
+               NyARDoublePoint2d[] v=this.__wk_v;\r
                int number_of_vertex=0;\r
                int non_vertexid=0;\r
                int ptr=0;\r
index fa499d4..41b84f1 100644 (file)
@@ -8,28 +8,28 @@ public class VecLinearCoordinates
         * データ型です。\r
         * 輪郭ベクトルを格納します。\r
         */\r
-       public static class NyARVecLinearPoint extends NyARVecLinear2d\r
+       public static class VecLinearCoordinatePoint extends NyARVecLinear2d\r
        {\r
                /**\r
                 * ベクトルの2乗値です。輪郭の強度値にもなります。\r
                 */\r
                public double scalar;\r
-               public static NyARVecLinearPoint[] createArray(int i_length)\r
+               public static VecLinearCoordinatePoint[] createArray(int i_length)\r
                {\r
-                       NyARVecLinearPoint[] r=new NyARVecLinearPoint[i_length];\r
+                       VecLinearCoordinatePoint[] r=new VecLinearCoordinatePoint[i_length];\r
                        for(int i=0;i<i_length;i++){\r
-                               r[i]=new NyARVecLinearPoint();\r
+                               r[i]=new VecLinearCoordinatePoint();\r
                        }\r
                        return r;\r
                }\r
        }       \r
        public int length;\r
-       public NyARVecLinearPoint items[];\r
+       public VecLinearCoordinatePoint items[];\r
 \r
        public VecLinearCoordinates(int i_length)\r
        {\r
                this.length = 0;\r
-               this.items = NyARVecLinearPoint.createArray(i_length);\r
+               this.items = VecLinearCoordinatePoint.createArray(i_length);\r
        }\r
        /**\r
         * ベクトルを1,2象限に制限します。\r
@@ -37,7 +37,7 @@ public class VecLinearCoordinates
        public final void limitQuadrantTo12()\r
        {\r
                for (int i = this.length - 1; i >= 0; i--) {\r
-                       VecLinearCoordinates.NyARVecLinearPoint target1 = this.items[i];\r
+                       VecLinearCoordinates.VecLinearCoordinatePoint target1 = this.items[i];\r
                        if (target1.dy < 0) {\r
                                target1.dy *= -1;\r
                                target1.dx *= -1;\r
@@ -74,7 +74,7 @@ public class VecLinearCoordinates
        }\r
        public void getKeyCoordIndexes(int[] o_index)\r
        {\r
-               NyARVecLinearPoint[] vp = this.items;\r
+               VecLinearCoordinatePoint[] vp = this.items;\r
                assert (o_index.length <= this.length);\r
                int i;\r
                int out_len = o_index.length;\r
@@ -110,9 +110,9 @@ public class VecLinearCoordinates
                }\r
                return;\r
        }\r
-       public void getKeyCoord(NyARVecLinearPoint[] o_index)\r
+       public void getKeyCoord(VecLinearCoordinatePoint[] o_index)\r
        {\r
-               NyARVecLinearPoint[] vp = this.items;\r
+               VecLinearCoordinatePoint[] vp = this.items;\r
                assert (o_index.length <= this.length);\r
                int i;\r
                int out_len = o_index.length;\r
@@ -123,7 +123,7 @@ public class VecLinearCoordinates
                // sqdistでソートする(B->S)\r
                for (i = 0; i < out_len_1;) {\r
                        if (o_index[i].scalar < o_index[i + 1].scalar) {\r
-                               NyARVecLinearPoint t = o_index[i];\r
+                               VecLinearCoordinatePoint t = o_index[i];\r
                                o_index[i] = o_index[i + 1];\r
                                o_index[i + 1] = t;\r
                                i = 0;\r
@@ -156,7 +156,7 @@ public class VecLinearCoordinates
         */\r
        public final int getMaxCoordIndex()\r
        {\r
-               NyARVecLinearPoint[] vp = this.items;\r
+               VecLinearCoordinatePoint[] vp = this.items;\r
                int index = 0;\r
                double max_dist = vp[0].scalar;\r
                for (int i = this.length - 1; i > 0; i--) {\r
@@ -187,7 +187,7 @@ public class VecLinearCoordinates
                        }\r
                        for(i=i+1;i<len;i++){\r
                                if(this.items[i].scalar!=0){\r
-                                       NyARVecLinearPoint temp = this.items[i];\r
+                                       VecLinearCoordinatePoint temp = this.items[i];\r
                                        this.items[i]=this.items[idx];\r
                                        this.items[idx]=temp;\r
                                        idx++;\r
index 66a1575..18d71f7 100644 (file)
@@ -31,14 +31,14 @@ public class VecLinearCoordinatesOperator
         */\r
        public void margeResembleCoords(VecLinearCoordinates i_vector)\r
        {\r
-               VecLinearCoordinates.NyARVecLinearPoint[] items=i_vector.items;\r
+               VecLinearCoordinates.VecLinearCoordinatePoint[] items=i_vector.items;\r
                NyARLinear l1 = this._l1;\r
                NyARLinear l2 = this._l2;\r
                NyARDoublePoint2d p = this._p;\r
 \r
 \r
                for (int i = i_vector.length - 1; i >= 0; i--) {\r
-                       VecLinearCoordinates.NyARVecLinearPoint target1 = items[i];\r
+                       VecLinearCoordinates.VecLinearCoordinatePoint target1 = items[i];\r
                        if(target1.scalar==0){\r
                                continue;\r
                        }\r
@@ -53,7 +53,7 @@ public class VecLinearCoordinatesOperator
                        target1.x*=s_tmp;\r
                        target1.y*=s_tmp;\r
                        for (int i2 = i - 1; i2 >= 0; i2--) {\r
-                               VecLinearCoordinates.NyARVecLinearPoint target2 = items[i2];\r
+                               VecLinearCoordinates.VecLinearCoordinatePoint target2 = items[i2];\r
                                if(target2.scalar==0){\r
                                        continue;\r
                                }\r
@@ -92,7 +92,7 @@ public class VecLinearCoordinatesOperator
                //加重平均解除なう(x,y位置のみ)\r
                for(int i=0;i<i_vector.length;i++)\r
                {\r
-                       VecLinearCoordinates.NyARVecLinearPoint ptr=items[i];\r
+                       VecLinearCoordinates.VecLinearCoordinatePoint ptr=items[i];\r
                        double d=1/ptr.scalar;\r
                        ptr.x*=d;\r
                        ptr.y*=d;\r
index 0bb0798..5fc15a7 100644 (file)
@@ -38,6 +38,7 @@ import java.io.StreamTokenizer;
 import jp.nyatla.nyartoolkit.*;\r
 import jp.nyatla.nyartoolkit.core.match.*;\r
 import jp.nyatla.nyartoolkit.core.raster.*;\r
+import jp.nyatla.nyartoolkit.core.raster.rgb.INyARRgbRaster;\r
 import jp.nyatla.nyartoolkit.core.raster.rgb.NyARRgbRaster;\r
 import jp.nyatla.nyartoolkit.core.types.NyARBufferType;\r
 \r
@@ -224,7 +225,7 @@ public class NyARCode
         * 格納順は、パターンの右上が、1,2,3,4象限になる順番です。\r
         * @throws NyARException\r
         */\r
-       public void setRaster(NyARRgbRaster[] i_raster) throws NyARException\r
+       public void setRaster(INyARRgbRaster[] i_raster) throws NyARException\r
        {\r
                assert(i_raster.length!=4);\r
                //ラスタにパターンをロードする。\r
@@ -239,7 +240,7 @@ public class NyARCode
         * 基準となるラスタを指定します。ラスタの解像度は、ARマーカコードと同じである必要があります。\r
         * @throws NyARException\r
         */     \r
-       public void setRaster(NyARRgbRaster i_raster) throws NyARException\r
+       public void setRaster(INyARRgbRaster i_raster) throws NyARException\r
        {\r
                //ラスタにパターンをロードする。\r
                for(int i=0;i<4;i++){\r
index f4f96ad..6a2f9ce 100644 (file)
@@ -37,10 +37,6 @@ public class NyARRleLabelFragmentInfoPtrStack  extends NyARPointerStack<NyARRleL
                return;\r
        }\r
 \r
-       protected NyARRleLabelFragmentInfo createElement()\r
-       {\r
-               return new NyARRleLabelFragmentInfo();\r
-       }\r
        /**\r
         * エリアの大きい順にラベルをソートします。\r
         */\r
index da20e6d..2c69e79 100644 (file)
@@ -38,6 +38,7 @@ import jp.nyatla.nyartoolkit.core.types.*;
  */\r
 public class NyARGrayscaleRaster extends NyARRaster_BasicClass\r
 {\r
+       private IdoFilterImpl _impl;\r
        protected Object _buf;\r
        /**\r
         * バッファオブジェクトがアタッチされていればtrue\r
@@ -79,8 +80,7 @@ public class NyARGrayscaleRaster extends NyARRaster_BasicClass
         * @param i_is_alloc\r
         * @throws NyARException\r
         */\r
-       public NyARGrayscaleRaster(int i_width, int i_height, int i_raster_type,\r
-                       boolean i_is_alloc) throws NyARException\r
+       public NyARGrayscaleRaster(int i_width, int i_height, int i_raster_type,boolean i_is_alloc) throws NyARException\r
        {\r
                super(i_width, i_height, i_raster_type);\r
                if (!initInstance(this._size, i_raster_type, i_is_alloc)) {\r
@@ -99,6 +99,7 @@ public class NyARGrayscaleRaster extends NyARRaster_BasicClass
        {\r
                switch (i_buf_type) {\r
                case NyARBufferType.INT1D_GRAY_8:\r
+                       this._impl=new IdoFilterImpl_INT1D_GRAY_8();\r
                        this._buf = i_is_alloc ? new int[i_size.w * i_size.h] : null;\r
                        break;\r
                default:\r
@@ -136,12 +137,10 @@ public class NyARGrayscaleRaster extends NyARRaster_BasicClass
         * この関数は高速化していません。\r
         * @param i_value\r
         */\r
-       public void fill(int i_value) {\r
-               assert (this._buffer_type == NyARBufferType.INT1D_GRAY_8);\r
-               int[] buf = (int[]) this._buf;\r
-               for (int i = this._size.h * this._size.w - 1; i >= 0; i--) {\r
-                       buf[i] = i_value;\r
-               }\r
+       public void fill(int i_value)\r
+       {\r
+               assert (this.isEqualBufferType(this.getBufferType()));\r
+               this._impl.fill(this,i_value);\r
        }\r
 \r
        /**\r
@@ -156,53 +155,78 @@ public class NyARGrayscaleRaster extends NyARRaster_BasicClass
         * skip値。1なら等倍、2なら1/2倍、3なら1/3倍の偏重の画像を出力します。\r
         * @param o_output\r
         * 出力先ラスタ。このラスタの解像度は、w=(i_input.w-i_left)/i_skip,h=(i_input.h-i_height)/i_skipを満たす必要があります。\r
+        * 出力先ラスタと入力ラスタのバッファタイプは、同じである必要があります。\r
         */\r
-       public static void copy(NyARGrayscaleRaster i_input, int i_left,int i_top,int i_skip, NyARGrayscaleRaster o_output)\r
+       public void copyTo(int i_left,int i_top,int i_skip, NyARGrayscaleRaster o_output)\r
+       {\r
+               assert (this.getSize().isInnerSize(i_left + o_output.getWidth() * i_skip, i_top+ o_output.getHeight() * i_skip));               \r
+               assert (this.isEqualBufferType(o_output.getBufferType()));\r
+               this._impl.copyTo(this, i_left, i_top, i_skip, o_output);\r
+               return;\r
+       }\r
+       ////////////////////////////////////////////////////////////////////////////////\r
+       //ここからラスタドライバ\r
+       \r
+       interface IdoFilterImpl\r
+       {\r
+               public void fill(NyARGrayscaleRaster i_raster,int i_value);\r
+               public void copyTo(NyARGrayscaleRaster i_input, int i_left,int i_top,int i_skip, NyARGrayscaleRaster o_output);\r
+       }\r
+       \r
+       final class IdoFilterImpl_INT1D_GRAY_8 implements IdoFilterImpl\r
        {\r
-               assert (i_input.getSize().isInnerSize(i_left + o_output.getWidth() * i_skip, i_top+ o_output.getHeight() * i_skip));            \r
-               final int[] input = (int[]) i_input.getBuffer();\r
-               final int[] output = (int[]) o_output.getBuffer();\r
-               int pt_src, pt_dst;\r
-               NyARIntSize dest_size = o_output.getSize();\r
-               NyARIntSize src_size = i_input.getSize();\r
-               int skip_src_y = (src_size.w - dest_size.w * i_skip) + src_size.w * (i_skip - 1);\r
-               final int pix_count = dest_size.w;\r
-               final int pix_mod_part = pix_count - (pix_count % 8);\r
-               // 左上から1行づつ走査していく\r
-               pt_dst = 0;\r
-               pt_src = (i_top * src_size.w + i_left);\r
-               for (int y = dest_size.h - 1; y >= 0; y -= 1) {\r
-                       int x;\r
-                       for (x = pix_count - 1; x >= pix_mod_part; x--) {\r
-                               try{\r
-                               output[pt_dst++] = input[pt_src];\r
-                               pt_src += i_skip;\r
-                               }catch(Exception e){\r
-                                       e.printStackTrace();\r
+               public void fill(NyARGrayscaleRaster i_raster,int i_value)\r
+               {\r
+                       assert (i_raster._buffer_type == NyARBufferType.INT1D_GRAY_8);\r
+                       int[] buf = (int[]) i_raster._buf;\r
+                       for (int i = i_raster._size.h * i_raster._size.w - 1; i >= 0; i--) {\r
+                               buf[i] = i_value;\r
+                       }                       \r
+               }\r
+\r
+               public void copyTo(NyARGrayscaleRaster i_input, int i_left,int i_top,int i_skip, NyARGrayscaleRaster o_output)\r
+               {\r
+                       assert (i_input.getSize().isInnerSize(i_left + o_output.getWidth() * i_skip, i_top+ o_output.getHeight() * i_skip));            \r
+                       final int[] input = (int[]) i_input.getBuffer();\r
+                       final int[] output = (int[]) o_output.getBuffer();\r
+                       int pt_src, pt_dst;\r
+                       NyARIntSize dest_size = o_output.getSize();\r
+                       NyARIntSize src_size = i_input.getSize();\r
+                       int skip_src_y = (src_size.w - dest_size.w * i_skip) + src_size.w * (i_skip - 1);\r
+                       final int pix_count = dest_size.w;\r
+                       final int pix_mod_part = pix_count - (pix_count % 8);\r
+                       // 左上から1行づつ走査していく\r
+                       pt_dst = 0;\r
+                       pt_src = (i_top * src_size.w + i_left);\r
+                       for (int y = dest_size.h - 1; y >= 0; y -= 1) {\r
+                               int x;\r
+                               for (x = pix_count - 1; x >= pix_mod_part; x--) {\r
+                                       output[pt_dst++] = input[pt_src];\r
+                                       pt_src += i_skip;\r
                                }\r
+                               for (; x >= 0; x -= 8) {\r
+                                       output[pt_dst++] = input[pt_src];\r
+                                       pt_src += i_skip;\r
+                                       output[pt_dst++] = input[pt_src];\r
+                                       pt_src += i_skip;\r
+                                       output[pt_dst++] = input[pt_src];\r
+                                       pt_src += i_skip;\r
+                                       output[pt_dst++] = input[pt_src];\r
+                                       pt_src += i_skip;\r
+                                       output[pt_dst++] = input[pt_src];\r
+                                       pt_src += i_skip;\r
+                                       output[pt_dst++] = input[pt_src];\r
+                                       pt_src += i_skip;\r
+                                       output[pt_dst++] = input[pt_src];\r
+                                       pt_src += i_skip;\r
+                                       output[pt_dst++] = input[pt_src];\r
+                                       pt_src += i_skip;\r
+                               }\r
+                               // スキップ\r
+                               pt_src += skip_src_y;\r
                        }\r
-                       for (; x >= 0; x -= 8) {\r
-                               output[pt_dst++] = input[pt_src];\r
-                               pt_src += i_skip;\r
-                               output[pt_dst++] = input[pt_src];\r
-                               pt_src += i_skip;\r
-                               output[pt_dst++] = input[pt_src];\r
-                               pt_src += i_skip;\r
-                               output[pt_dst++] = input[pt_src];\r
-                               pt_src += i_skip;\r
-                               output[pt_dst++] = input[pt_src];\r
-                               pt_src += i_skip;\r
-                               output[pt_dst++] = input[pt_src];\r
-                               pt_src += i_skip;\r
-                               output[pt_dst++] = input[pt_src];\r
-                               pt_src += i_skip;\r
-                               output[pt_dst++] = input[pt_src];\r
-                               pt_src += i_skip;\r
-                       }\r
-                       // スキップ\r
-                       pt_src += skip_src_y;\r
+                       return;\r
                }\r
-               return;\r
-\r
-       }\r
+       }       \r
+       \r
 }\r
index 9360f61..7fc0f85 100644 (file)
@@ -162,17 +162,17 @@ public class NyARRasterFilter_ARToolkitThreshold implements INyARRasterFilter_Rg
                        for (int y = i_h-1; y >=0 ; y-=1){\r
                                int x,v;\r
                                for (x = pix_count-1; x >=pix_mod_part; x--){\r
-                                       v=input[pt_src++];output[pt_dst++]=((v& 0xff)+(v& 0xff)+(v& 0xff))<=th?0:1;\r
+                                       v=input[pt_src++];output[pt_dst++]=(((v>>16)& 0xff)+((v>>8)& 0xff)+(v& 0xff))<=th?0:1;\r
                                }\r
                                for (;x>=0;x-=8){\r
-                                       v=input[pt_src++];output[pt_dst++]=((v& 0xff)+(v& 0xff)+(v& 0xff))<=th?0:1;\r
-                                       v=input[pt_src++];output[pt_dst++]=((v& 0xff)+(v& 0xff)+(v& 0xff))<=th?0:1;\r
-                                       v=input[pt_src++];output[pt_dst++]=((v& 0xff)+(v& 0xff)+(v& 0xff))<=th?0:1;\r
-                                       v=input[pt_src++];output[pt_dst++]=((v& 0xff)+(v& 0xff)+(v& 0xff))<=th?0:1;\r
-                                       v=input[pt_src++];output[pt_dst++]=((v& 0xff)+(v& 0xff)+(v& 0xff))<=th?0:1;\r
-                                       v=input[pt_src++];output[pt_dst++]=((v& 0xff)+(v& 0xff)+(v& 0xff))<=th?0:1;\r
-                                       v=input[pt_src++];output[pt_dst++]=((v& 0xff)+(v& 0xff)+(v& 0xff))<=th?0:1;\r
-                                       v=input[pt_src++];output[pt_dst++]=((v& 0xff)+(v& 0xff)+(v& 0xff))<=th?0:1;\r
+                                       v=input[pt_src++];output[pt_dst++]=(((v>>16)& 0xff)+((v>>8)& 0xff)+(v& 0xff))<=th?0:1;\r
+                                       v=input[pt_src++];output[pt_dst++]=(((v>>16)& 0xff)+((v>>8)& 0xff)+(v& 0xff))<=th?0:1;\r
+                                       v=input[pt_src++];output[pt_dst++]=(((v>>16)& 0xff)+((v>>8)& 0xff)+(v& 0xff))<=th?0:1;\r
+                                       v=input[pt_src++];output[pt_dst++]=(((v>>16)& 0xff)+((v>>8)& 0xff)+(v& 0xff))<=th?0:1;\r
+                                       v=input[pt_src++];output[pt_dst++]=(((v>>16)& 0xff)+((v>>8)& 0xff)+(v& 0xff))<=th?0:1;\r
+                                       v=input[pt_src++];output[pt_dst++]=(((v>>16)& 0xff)+((v>>8)& 0xff)+(v& 0xff))<=th?0:1;\r
+                                       v=input[pt_src++];output[pt_dst++]=(((v>>16)& 0xff)+((v>>8)& 0xff)+(v& 0xff))<=th?0:1;\r
+                                       v=input[pt_src++];output[pt_dst++]=(((v>>16)& 0xff)+((v>>8)& 0xff)+(v& 0xff))<=th?0:1;\r
                                }\r
                                //スキップ\r
                                pt_src+=skip_src;\r
index 056380f..3025e06 100644 (file)
@@ -37,7 +37,7 @@ import jp.nyatla.nyartoolkit.core.types.*;
 \r
 /**\r
  * RGBラスタをGrayScaleに変換するフィルタを作成します。\r
- * このフィルタは、RGB値の平均値を、(R+G+B)/3で算出します。\r
+ * このフィルタは、RGB値の平均値を、(R+G+B)>>4で算出します。(スケールは、192>=n>=0になります。)\r
  *\r
  */\r
 public class NyARRasterFilter_Rgb2Gs_RgbAve implements INyARRasterFilter_Rgb2Gs\r
@@ -69,6 +69,9 @@ public class NyARRasterFilter_Rgb2Gs_RgbAve implements INyARRasterFilter_Rgb2Gs
                        case NyARBufferType.BYTE1D_B8G8R8X8_32:\r
                                this._do_filter_impl=new doThFilterImpl_BYTE1D_B8G8R8X8_32();\r
                                break;\r
+                       case NyARBufferType.INT1D_X8R8G8B8_32:\r
+                               this._do_filter_impl=new doThFilterImpl_BUFFERFORMAT_INT1D_X8R8G8B8_32();\r
+                               break;\r
                        default:\r
                                return false;\r
                        }\r
@@ -137,13 +140,108 @@ public class NyARRasterFilter_Rgb2Gs_RgbAve implements INyARRasterFilter_Rgb2Gs
                 */\r
                public void doCutFilter(INyARRaster i_input, int l,int t,int i_st,NyARGrayscaleRaster o_output) throws NyARException;\r
        }\r
+       \r
+       class doThFilterImpl_BUFFERFORMAT_INT1D_X8R8G8B8_32 implements IdoThFilterImpl\r
+       {\r
+               public void doCutFilter(INyARRaster i_input, int l,int t,int i_st,NyARGrayscaleRaster o_output) throws NyARException\r
+               {\r
+                       assert(i_input.isEqualBufferType(NyARBufferType.INT1D_X8R8G8B8_32));\r
+                       assert(i_input.getSize().isInnerSize(l+o_output.getWidth()*i_st,t+o_output.getHeight()*i_st));\r
+                       final int[] input=(int[])i_input.getBuffer();\r
+                       final int[] output=(int[])o_output.getBuffer();\r
+                       int v;\r
+                       int pt_src,pt_dst;\r
+                       NyARIntSize dest_size=o_output.getSize();                       \r
+                       NyARIntSize src_size=i_input.getSize();\r
+                       int skip_src_y=(src_size.w-dest_size.w*i_st)+src_size.w*(i_st-1);\r
+                       int skip_src_x=i_st;\r
+                       final int pix_count=dest_size.w;\r
+                       final int pix_mod_part=pix_count-(pix_count%8);                 \r
+                       //左上から1行づつ走査していく\r
+                       pt_dst=0;\r
+                       pt_src=(t*src_size.w+l);\r
+                       for (int y = dest_size.h-1; y >=0; y-=1){\r
+                               int x;\r
+                               for (x = pix_count-1; x >=pix_mod_part; x--){\r
+                                       v=input[pt_src++];output[pt_dst++]=(((v>>16)& 0xff)+((v>>8)& 0xff)+(v &0xff))>>2;\r
+                                       pt_src+=skip_src_x;\r
+                               }\r
+                               for (;x>=0;x-=8){\r
+                                       v=input[pt_src++];output[pt_dst++]=(((v>>16)& 0xff)+((v>>8)& 0xff)+(v &0xff))>>2;\r
+                                       pt_src+=skip_src_x;\r
+                                       v=input[pt_src++];output[pt_dst++]=(((v>>16)& 0xff)+((v>>8)& 0xff)+(v &0xff))>>2;\r
+                                       pt_src+=skip_src_x;\r
+                                       v=input[pt_src++];output[pt_dst++]=(((v>>16)& 0xff)+((v>>8)& 0xff)+(v &0xff))>>2;\r
+                                       pt_src+=skip_src_x;\r
+                                       v=input[pt_src++];output[pt_dst++]=(((v>>16)& 0xff)+((v>>8)& 0xff)+(v &0xff))>>2;\r
+                                       pt_src+=skip_src_x;\r
+                                       v=input[pt_src++];output[pt_dst++]=(((v>>16)& 0xff)+((v>>8)& 0xff)+(v &0xff))>>2;\r
+                                       pt_src+=skip_src_x;\r
+                                       v=input[pt_src++];output[pt_dst++]=(((v>>16)& 0xff)+((v>>8)& 0xff)+(v &0xff))>>2;\r
+                                       pt_src+=skip_src_x;\r
+                                       v=input[pt_src++];output[pt_dst++]=(((v>>16)& 0xff)+((v>>8)& 0xff)+(v &0xff))>>2;\r
+                                       pt_src+=skip_src_x;\r
+                                       v=input[pt_src++];output[pt_dst++]=(((v>>16)& 0xff)+((v>>8)& 0xff)+(v &0xff))>>2;\r
+                                       pt_src+=skip_src_x;\r
+                               }\r
+                               //スキップ\r
+                               pt_src+=skip_src_y;\r
+                       }\r
+                       return;         \r
+               }\r
+               public void doFilter(INyARRaster i_input, int[] o_output,int l,int t,int w,int h)\r
+               {\r
+                       assert(i_input.isEqualBufferType(NyARBufferType.INT1D_X8R8G8B8_32));\r
+                       NyARIntSize size=i_input.getSize();\r
+                       int[] in_buf = (int[]) i_input.getBuffer();\r
+                       int bp = (l+t*size.w);\r
+                       int v;\r
+                       final int b=t+h;\r
+                       final int row_padding_dst=(size.w-w);\r
+                       final int row_padding_src=row_padding_dst;\r
+                       final int pix_count=w;\r
+                       final int pix_mod_part=pix_count-(pix_count%8);\r
+                       int src_ptr=t*size.w+l;\r
+                       for (int y = t; y < b; y++) {\r
+                               int x=0;\r
+                               for (x = pix_count-1; x >=pix_mod_part; x--){\r
+                                       v=in_buf[src_ptr++];o_output[bp++]=(((v>>16)& 0xff)+((v>>8)& 0xff)+(v &0xff))>>2;\r
+                               }\r
+                               for (;x>=0;x-=8){\r
+                                       v=in_buf[src_ptr++];o_output[bp++]=(((v>>16)& 0xff)+((v>>8)& 0xff)+(v &0xff))>>2;\r
+                                       v=in_buf[src_ptr++];o_output[bp++]=(((v>>16)& 0xff)+((v>>8)& 0xff)+(v &0xff))>>2;\r
+                                       v=in_buf[src_ptr++];o_output[bp++]=(((v>>16)& 0xff)+((v>>8)& 0xff)+(v &0xff))>>2;\r
+                                       v=in_buf[src_ptr++];o_output[bp++]=(((v>>16)& 0xff)+((v>>8)& 0xff)+(v &0xff))>>2;\r
+                                       v=in_buf[src_ptr++];o_output[bp++]=(((v>>16)& 0xff)+((v>>8)& 0xff)+(v &0xff))>>2;\r
+                                       v=in_buf[src_ptr++];o_output[bp++]=(((v>>16)& 0xff)+((v>>8)& 0xff)+(v &0xff))>>2;\r
+                                       v=in_buf[src_ptr++];o_output[bp++]=(((v>>16)& 0xff)+((v>>8)& 0xff)+(v &0xff))>>2;\r
+                                       v=in_buf[src_ptr++];o_output[bp++]=(((v>>16)& 0xff)+((v>>8)& 0xff)+(v &0xff))>>2;\r
+                               }\r
+                               bp+=row_padding_dst;\r
+                               src_ptr+=row_padding_src;\r
+                       }\r
+                       return;                 \r
+               }\r
+       }\r
+       \r
+       \r
+       \r
+       \r
+       \r
+       \r
+       \r
+       \r
+       \r
+       \r
+       \r
+       \r
+       \r
+       \r
        class doThFilterImpl_BYTE1D_B8G8R8_24 implements IdoThFilterImpl\r
        {\r
                public void doCutFilter(INyARRaster i_input, int l,int t,int i_st,NyARGrayscaleRaster o_output) throws NyARException\r
                {\r
-                       assert(\r
-                                       i_input.isEqualBufferType(NyARBufferType.BYTE1D_B8G8R8_24)||\r
-                                       i_input.isEqualBufferType(NyARBufferType.BYTE1D_R8G8B8_24));\r
+                       assert(i_input.isEqualBufferType(NyARBufferType.BYTE1D_B8G8R8_24)||i_input.isEqualBufferType(NyARBufferType.BYTE1D_R8G8B8_24));\r
                        assert(i_input.getSize().isInnerSize(l+o_output.getWidth()*i_st,t+o_output.getHeight()*i_st));\r
                        \r
                        final byte[] input=(byte[])i_input.getBuffer();\r
@@ -161,25 +259,25 @@ public class NyARRasterFilter_Rgb2Gs_RgbAve implements INyARRasterFilter_Rgb2Gs
                        for (int y = dest_size.h-1; y >=0; y-=1){\r
                                int x;\r
                                for (x = pix_count-1; x >=pix_mod_part; x--){\r
-                                       output[pt_dst++]=((input[pt_src+0]& 0xff)+(input[pt_src+1]& 0xff)+(input[pt_src+2]& 0xff))/3;\r
+                                       output[pt_dst++]=((input[pt_src+0]& 0xff)+(input[pt_src+1]& 0xff)+(input[pt_src+2]& 0xff))>>2;\r
                                        pt_src+=skip_src_x;\r
                                }\r
                                for (;x>=0;x-=8){\r
-                                       output[pt_dst++]=((input[pt_src+0]& 0xff)+(input[pt_src+1]& 0xff)+(input[pt_src+2]& 0xff))/3;\r
+                                       output[pt_dst++]=((input[pt_src+0]& 0xff)+(input[pt_src+1]& 0xff)+(input[pt_src+2]& 0xff))>>2;\r
                                        pt_src+=skip_src_x;\r
-                                       output[pt_dst++]=((input[pt_src+0]& 0xff)+(input[pt_src+1]& 0xff)+(input[pt_src+2]& 0xff))/3;\r
+                                       output[pt_dst++]=((input[pt_src+0]& 0xff)+(input[pt_src+1]& 0xff)+(input[pt_src+2]& 0xff))>>2;\r
                                        pt_src+=skip_src_x;\r
-                                       output[pt_dst++]=((input[pt_src+0]& 0xff)+(input[pt_src+1]& 0xff)+(input[pt_src+2]& 0xff))/3;\r
+                                       output[pt_dst++]=((input[pt_src+0]& 0xff)+(input[pt_src+1]& 0xff)+(input[pt_src+2]& 0xff))>>2;\r
                                        pt_src+=skip_src_x;\r
-                                       output[pt_dst++]=((input[pt_src+0]& 0xff)+(input[pt_src+1]& 0xff)+(input[pt_src+2]& 0xff))/3;\r
+                                       output[pt_dst++]=((input[pt_src+0]& 0xff)+(input[pt_src+1]& 0xff)+(input[pt_src+2]& 0xff))>>2;\r
                                        pt_src+=skip_src_x;\r
-                                       output[pt_dst++]=((input[pt_src+0]& 0xff)+(input[pt_src+1]& 0xff)+(input[pt_src+2]& 0xff))/3;\r
+                                       output[pt_dst++]=((input[pt_src+0]& 0xff)+(input[pt_src+1]& 0xff)+(input[pt_src+2]& 0xff))>>2;\r
                                        pt_src+=skip_src_x;\r
-                                       output[pt_dst++]=((input[pt_src+0]& 0xff)+(input[pt_src+1]& 0xff)+(input[pt_src+2]& 0xff))/3;\r
+                                       output[pt_dst++]=((input[pt_src+0]& 0xff)+(input[pt_src+1]& 0xff)+(input[pt_src+2]& 0xff))>>2;\r
                                        pt_src+=skip_src_x;\r
-                                       output[pt_dst++]=((input[pt_src+0]& 0xff)+(input[pt_src+1]& 0xff)+(input[pt_src+2]& 0xff))/3;\r
+                                       output[pt_dst++]=((input[pt_src+0]& 0xff)+(input[pt_src+1]& 0xff)+(input[pt_src+2]& 0xff))>>2;\r
                                        pt_src+=skip_src_x;\r
-                                       output[pt_dst++]=((input[pt_src+0]& 0xff)+(input[pt_src+1]& 0xff)+(input[pt_src+2]& 0xff))/3;\r
+                                       output[pt_dst++]=((input[pt_src+0]& 0xff)+(input[pt_src+1]& 0xff)+(input[pt_src+2]& 0xff))>>2;\r
                                        pt_src+=skip_src_x;\r
                                }\r
                                //スキップ\r
@@ -238,7 +336,7 @@ public class NyARRasterFilter_Rgb2Gs_RgbAve implements INyARRasterFilter_Rgb2Gs
                        final int row_padding=(size.w-w)*4;\r
                        for (int y = t; y < b; y++) {\r
                                for (int x = 0; x < w; x++) {\r
-                                       o_output[y*size.w+x+l] = ((in_buf[bp] & 0xff) + (in_buf[bp + 1] & 0xff) + (in_buf[bp + 2] & 0xff)) / 3;\r
+                                       o_output[y*size.w+x+l] = ((in_buf[bp] & 0xff) + (in_buf[bp + 1] & 0xff) + (in_buf[bp + 2] & 0xff)) >>2;\r
                                        bp += 4;\r
                                }\r
                                bp+=row_padding;\r
index 0e91ef8..3a9585a 100644 (file)
@@ -217,7 +217,7 @@ public class NyARContourPickup
                                if(coord[1].x ==c && coord[1].y ==r){\r
                                        //終点に達している。\r
                                        o_coord.length=coord_num;\r
-                                       return true;\r
+                                       break;\r
                                }else{\r
                                        //終点ではない。\r
                                        coord[coord_num].x = c;\r
@@ -231,5 +231,6 @@ public class NyARContourPickup
                                return false;\r
                        }\r
                }\r
+               return true;\r
        }\r
 }\r
index 405d300..0d16b5d 100644 (file)
@@ -50,29 +50,12 @@ public class NyARRotVector
        \r
        private NyARPerspectiveProjectionMatrix _projection_mat_ref;\r
 \r
-//     private double[][] _inv_cpara_array_ref;\r
        private NyARDoubleMatrix44 _inv_cpara=new NyARDoubleMatrix44();\r
 \r
        public NyARRotVector(NyARPerspectiveProjectionMatrix i_cmat) throws NyARException\r
        {\r
-//             NyARMat mat_a = new NyARMat(3, 3);\r
-//             double[][] a_array = mat_a.getArray();\r
-//             \r
-//             a_array[0][0] =i_cmat.m00;\r
-//             a_array[0][1] =i_cmat.m01;\r
-//             a_array[0][2] =i_cmat.m02;\r
-//             a_array[1][0] =i_cmat.m10;\r
-//             a_array[1][1] =i_cmat.m11;\r
-//             a_array[1][2] =i_cmat.m12;\r
-//             a_array[2][0] =i_cmat.m20;\r
-///            a_array[2][1] =i_cmat.m21;\r
-//             a_array[2][2] =i_cmat.m22;\r
-//             \r
-//             mat_a.matrixSelfInv();\r
                this._inv_cpara.inverse(i_cmat);\r
                this._projection_mat_ref = i_cmat;\r
-//             this._inv_cpara_array_ref = mat_a.getArray();\r
-               //GCない言語のときは、ここで配列の所有権委譲してね!\r
        }\r
 \r
        /**\r
@@ -118,15 +101,11 @@ public class NyARRotVector
                final double world5 = world2 + this.v3;\r
                // </Optimize>\r
 \r
-               //final double[] camera = __checkVectorByVertex_camera;// [2][2];\r
                final NyARPerspectiveProjectionMatrix cmat= this._projection_mat_ref;\r
-               //h = cpara[2 * 4 + 0] * world0 + cpara[2 * 4 + 1] * world1 + cpara[2 * 4 + 2] * world2;\r
                h = cmat.m20 * world0 + cmat.m21 * world1 + cmat.m22 * world2;\r
                if (h == 0.0) {\r
                        throw new NyARException();\r
                }\r
-               //final double camera0 = (cpara[0 * 4 + 0] * world0 + cpara[0 * 4 + 1] * world1 + cpara[0 * 4 + 2] * world2) / h;\r
-               //final double camera1 = (cpara[1 * 4 + 0] * world0 + cpara[1 * 4 + 1] * world1 + cpara[1 * 4 + 2] * world2) / h;\r
                final double camera0 = (cmat.m00 * world0 + cmat.m01 * world1 + cmat.m02 * world2) / h;\r
                final double camera1 = (cmat.m10 * world0 + cmat.m11 * world1 + cmat.m12 * world2) / h;\r
 \r
@@ -135,8 +114,6 @@ public class NyARRotVector
                if (h == 0.0) {\r
                        throw new NyARException();\r
                }\r
-               //final double camera2 = (cpara[0 * 4 + 0] * world3 + cpara[0 * 4 + 1] * world4 + cpara[0 * 4 + 2] * world5) / h;\r
-               //final double camera3 = (cpara[1 * 4 + 0] * world3 + cpara[1 * 4 + 1] * world4 + cpara[1 * 4 + 2] * world5) / h;\r
                final double camera2 = (cmat.m00 * world3 + cmat.m01 * world4 + cmat.m02 * world5) / h;\r
                final double camera3 = (cmat.m10 * world3 + cmat.m11 * world4 + cmat.m12 * world5) / h;\r
 \r
index c7c85f3..fd3dfee 100644 (file)
@@ -105,14 +105,14 @@ public class NyARVecLinear2d
                return d>=0?d:-d;\r
        }\r
        /**\r
-        * このベクトルと、i_pos1i_pos2を結ぶ線分が作るcos値の絶対値を返します。\r
+        * このベクトルと、i_pos1-&lt;i_pos2を結ぶ線分が作るcos値の絶対値を返します。\r
         * @param i_pos1\r
         * @param i_pos2\r
         * @return\r
         */\r
        public final double getAbsVecCos(NyARDoublePoint2d i_pos1,NyARDoublePoint2d i_pos2)\r
        {\r
-               double d=getVecCos(i_pos2.x-i_pos1.x,i_pos2.y-i_pos1.y);\r
+               double d=getAbsVecCos(i_pos2.x-i_pos1.x,i_pos2.y-i_pos1.y);\r
                return d>=0?d:-d;\r
        }\r
        \r
index e99d60f..1bcf544 100644 (file)
@@ -197,7 +197,7 @@ public class NyARDetectMarker
 \r
                this._transmat = new NyARTransMat(i_ref_param);\r
                //NyARToolkitプロファイル\r
-               this._square_detect =new RleDetector(new NyARColorPatt_Perspective_O2(cw, ch,4,25,25),i_ref_code,i_number_of_code,i_ref_param);\r
+               this._square_detect =new RleDetector(new NyARColorPatt_Perspective_O2(cw, ch,4,25,i_input_raster_type),i_ref_code,i_number_of_code,i_ref_param);\r
                this._tobin_filter=new NyARRasterFilter_ARToolkitThreshold(100,i_input_raster_type);\r
 \r
                //実サイズ保存\r
index 7be6948..562421b 100644 (file)
@@ -71,19 +71,21 @@ public abstract class SingleARMarkerProcesser
                private NyARMatchPatt_Color_WITHOUT_PCA[] _match_patt;\r
                private final NyARMatchPattResult __detectMarkerLite_mr=new NyARMatchPattResult();\r
                private NyARCoord2Linear _coordline;\r
+               private int _raster_type;\r
                \r
-               public DetectSquare(NyARParam i_param) throws NyARException\r
+               public DetectSquare(NyARParam i_param,int i_raster_type) throws NyARException\r
                {\r
                        super(i_param.getScreenSize());\r
                        this._match_patt=null;\r
                        this._coordline=new NyARCoord2Linear(i_param.getScreenSize(),i_param.getDistortionFactor());\r
+                       this._raster_type=i_raster_type;\r
                        return;\r
                }\r
                public void setNyARCodeTable(NyARCode[] i_ref_code,int i_code_resolution)\r
                {\r
                        /*unmanagedで実装するときは、ここでリソース解放をすること。*/\r
                        this._deviation_data=new NyARMatchPattDeviationColorData(i_code_resolution,i_code_resolution);\r
-                       this._inst_patt=new NyARColorPatt_Perspective_O2(i_code_resolution,i_code_resolution,4,25,25);\r
+                       this._inst_patt=new NyARColorPatt_Perspective_O2(i_code_resolution,i_code_resolution,4,25,this._raster_type);\r
                        this._match_patt = new NyARMatchPatt_Color_WITHOUT_PCA[i_ref_code.length];\r
                        for(int i=0;i<i_ref_code.length;i++){\r
                                this._match_patt[i]=new NyARMatchPatt_Color_WITHOUT_PCA(i_ref_code[i]);\r
@@ -232,7 +234,7 @@ public abstract class SingleARMarkerProcesser
                this._threshold_detect=new NyARRasterThresholdAnalyzer_SlidePTile(15,i_raster_type,4);\r
                this._initialized=true;\r
                //コールバックハンドラ\r
-               this._detectmarker=new DetectSquare(i_param);\r
+               this._detectmarker=new DetectSquare(i_param,i_raster_type);\r
                this._offset=new NyARRectOffset();\r
                return;\r
        }\r
index ba0ea9e..feb8478 100644 (file)
@@ -5,6 +5,7 @@ import jp.nyatla.nyartoolkit.core.param.NyARPerspectiveProjectionMatrix;
 import jp.nyatla.nyartoolkit.core.pickup.NyARColorPatt_Perspective_O2;\r
 import jp.nyatla.nyartoolkit.core.raster.rgb.INyARRgbRaster;\r
 import jp.nyatla.nyartoolkit.core.transmat.NyARTransMatResult;\r
+import jp.nyatla.nyartoolkit.core.types.NyARBufferType;\r
 import jp.nyatla.nyartoolkit.core.types.NyARIntPoint2d;\r
 \r
 /**\r
@@ -29,7 +30,8 @@ class TransformedBitmapPickup extends NyARColorPatt_Perspective_O2
         */\r
        public TransformedBitmapPickup(NyARPerspectiveProjectionMatrix i_ref_cparam, int i_width, int i_height, int i_resolution)\r
        {\r
-               super(i_width, i_height, i_resolution, 0,0);\r
+               //ANYラスタで構築\r
+               super(i_width, i_height, i_resolution, 0,NyARBufferType.NULL_ALLZERO);\r
                this._ref_perspective = i_ref_cparam;\r
        }\r
 \r