From 24b994fbdcb0bce319c993996ad0fce610395b6e Mon Sep 17 00:00:00 2001 From: nyatla Date: Mon, 15 Sep 2008 01:47:39 +0000 Subject: [PATCH] =?utf8?q?[=E6=9B=B4=E6=96=B0]NyARToolkit-trunk=20NyARRast?= =?utf8?q?erFilter=5FARToolkitThreshold=E3=80=80=E3=81=AE=E9=AB=98?= =?utf8?q?=E9=80=9F=E5=8C=96=E5=BF=98=E3=82=8C=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../NyARRasterFilter_ARToolkitThreshold.java | 39 ++++++++++++---------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/src/jp/nyatla/nyartoolkit/core/rasterfilter/rgb2bin/NyARRasterFilter_ARToolkitThreshold.java b/src/jp/nyatla/nyartoolkit/core/rasterfilter/rgb2bin/NyARRasterFilter_ARToolkitThreshold.java index 1826a55..fdfdc59 100644 --- a/src/jp/nyatla/nyartoolkit/core/rasterfilter/rgb2bin/NyARRasterFilter_ARToolkitThreshold.java +++ b/src/jp/nyatla/nyartoolkit/core/rasterfilter/rgb2bin/NyARRasterFilter_ARToolkitThreshold.java @@ -92,36 +92,37 @@ public class NyARRasterFilter_ARToolkitThreshold implements INyARRasterFilter_Rg int x; for (int y =i_size.h-1; y>=0 ; y--){ //端数分 + final int[] row_ptr=i_out[y]; for (x = size_w-1;x>=x_mod_end;x--) { w= ((i_in[bp] & 0xff) + (i_in[bp + 1] & 0xff) + (i_in[bp + 2] & 0xff)); - i_out[y][x]=w<=th?0:1; + row_ptr[x]=w<=th?0:1; bp -= 3; } //タイリング for (;x>=0;x-=8) { w=((i_in[bp] & 0xff) + (i_in[bp + 1] & 0xff) + (i_in[bp + 2] & 0xff)); - i_out[y][x]=w<=th?0:1; + row_ptr[x]=w<=th?0:1; bp -= 3; w=((i_in[bp] & 0xff) + (i_in[bp + 1] & 0xff) + (i_in[bp + 2] & 0xff)); - i_out[y][x-1]=w<=th?0:1; + row_ptr[x-1]=w<=th?0:1; bp -= 3; w=((i_in[bp] & 0xff) + (i_in[bp + 1] & 0xff) + (i_in[bp + 2] & 0xff)); - i_out[y][x-2]=w<=th?0:1; + row_ptr[x-2]=w<=th?0:1; bp -= 3; w=((i_in[bp] & 0xff) + (i_in[bp + 1] & 0xff) + (i_in[bp + 2] & 0xff)); - i_out[y][x-3]=w<=th?0:1; + row_ptr[x-3]=w<=th?0:1; bp -= 3; w=((i_in[bp] & 0xff) + (i_in[bp + 1] & 0xff) + (i_in[bp + 2] & 0xff)); - i_out[y][x-4]=w<=th?0:1; + row_ptr[x-4]=w<=th?0:1; bp -= 3; w=((i_in[bp] & 0xff) + (i_in[bp + 1] & 0xff) + (i_in[bp + 2] & 0xff)); - i_out[y][x-5]=w<=th?0:1; + row_ptr[x-5]=w<=th?0:1; bp -= 3; w=((i_in[bp] & 0xff) + (i_in[bp + 1] & 0xff) + (i_in[bp + 2] & 0xff)); - i_out[y][x-6]=w<=th?0:1; + row_ptr[x-6]=w<=th?0:1; bp -= 3; w=((i_in[bp] & 0xff) + (i_in[bp + 1] & 0xff) + (i_in[bp + 2] & 0xff)); - i_out[y][x-7]=w<=th?0:1; + row_ptr[x-7]=w<=th?0:1; bp -= 3; } } @@ -136,37 +137,39 @@ public class NyARRasterFilter_ARToolkitThreshold implements INyARRasterFilter_Rg int w; int x; for (int y =i_size.h-1; y>=0 ; y--){ + final int[] row_ptr=i_out[y]; + //端数分 for (x = size_w-1;x>=x_mod_end;x--) { w= ((i_in[bp] & 0xff) + (i_in[bp + 1] & 0xff) + (i_in[bp + 2] & 0xff)); - i_out[y][x]=w<=th?0:1; + row_ptr[x]=w<=th?0:1; bp -= 4; } //タイリング for (;x>=0;x-=8) { w= ((i_in[bp] & 0xff) + (i_in[bp + 1] & 0xff) + (i_in[bp + 2] & 0xff)); - i_out[y][x]=w<=th?0:1; + row_ptr[x]=w<=th?0:1; bp -= 4; w= ((i_in[bp] & 0xff) + (i_in[bp + 1] & 0xff) + (i_in[bp + 2] & 0xff)); - i_out[y][x-1]=w<=th?0:1; + row_ptr[x-1]=w<=th?0:1; bp -= 4; w= ((i_in[bp] & 0xff) + (i_in[bp + 1] & 0xff) + (i_in[bp + 2] & 0xff)); - i_out[y][x-2]=w<=th?0:1; + row_ptr[x-2]=w<=th?0:1; bp -= 4; w= ((i_in[bp] & 0xff) + (i_in[bp + 1] & 0xff) + (i_in[bp + 2] & 0xff)); - i_out[y][x-3]=w<=th?0:1; + row_ptr[x-3]=w<=th?0:1; bp -= 4; w= ((i_in[bp] & 0xff) + (i_in[bp + 1] & 0xff) + (i_in[bp + 2] & 0xff)); - i_out[y][x-4]=w<=th?0:1; + row_ptr[x-4]=w<=th?0:1; bp -= 4; w= ((i_in[bp] & 0xff) + (i_in[bp + 1] & 0xff) + (i_in[bp + 2] & 0xff)); - i_out[y][x-5]=w<=th?0:1; + row_ptr[x-5]=w<=th?0:1; bp -= 4; w= ((i_in[bp] & 0xff) + (i_in[bp + 1] & 0xff) + (i_in[bp + 2] & 0xff)); - i_out[y][x-6]=w<=th?0:1; + row_ptr[x-6]=w<=th?0:1; bp -= 4; w= ((i_in[bp] & 0xff) + (i_in[bp + 1] & 0xff) + (i_in[bp + 2] & 0xff)); - i_out[y][x-7]=w<=th?0:1; + row_ptr[x-7]=w<=th?0:1; bp -= 4; } } -- 2.11.0