Update of /cvsroot/artoolkit/artoolkit/lib/SRC/AR
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7810
Modified Files:
arGetMarkerInfo.c arLabeling.c
Log Message:
Document and cleanup of labelling.
Index: arGetMarkerInfo.c
===================================================================
RCS file: /cvsroot/artoolkit/artoolkit/lib/SRC/AR/arGetMarkerInfo.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** arGetMarkerInfo.c 4 Nov 2004 08:51:19 -0000 1.1.1.1
--- arGetMarkerInfo.c 25 May 2006 04:08:11 -0000 1.2
***************
*** 22,37 ****
int i, j;
! for( i = j = 0; i < *marker_num; i++ ) {
marker_infoL[j].area = marker_info2[i].area;
marker_infoL[j].pos[0] = marker_info2[i].pos[0];
marker_infoL[j].pos[1] = marker_info2[i].pos[1];
! if( arGetLine(marker_info2[i].x_coord, marker_info2[i].y_coord,
marker_info2[i].coord_num, marker_info2[i].vertex,
marker_infoL[j].line, marker_infoL[j].vertex) < 0 ) continue;
! arGetCode( image,
! marker_info2[i].x_coord, marker_info2[i].y_coord,
! marker_info2[i].vertex, &id, &dir, &cf );
marker_infoL[j].id = id;
--- 22,37 ----
int i, j;
! for (i = j = 0; i < *marker_num; i++) {
marker_infoL[j].area = marker_info2[i].area;
marker_infoL[j].pos[0] = marker_info2[i].pos[0];
marker_infoL[j].pos[1] = marker_info2[i].pos[1];
! if (arGetLine(marker_info2[i].x_coord, marker_info2[i].y_coord,
marker_info2[i].coord_num, marker_info2[i].vertex,
marker_infoL[j].line, marker_infoL[j].vertex) < 0 ) continue;
! arGetCode(image,
! marker_info2[i].x_coord, marker_info2[i].y_coord,
! marker_info2[i].vertex, &id, &dir, &cf );
marker_infoL[j].id = id;
***************
*** 43,47 ****
*marker_num = j;
! return( marker_infoL );
}
--- 43,47 ----
*marker_num = j;
! return (marker_infoL);
}
***************
*** 54,72 ****
int i, j;
! if( LorR ) info = &marker_infoL[0];
! else info = &marker_infoR[0];
! for( i = j = 0; i < *marker_num; i++ ) {
info[j].area = marker_info2[i].area;
info[j].pos[0] = marker_info2[i].pos[0];
info[j].pos[1] = marker_info2[i].pos[1];
! if( arsGetLine(marker_info2[i].x_coord, marker_info2[i].y_coord,
marker_info2[i].coord_num, marker_info2[i].vertex,
info[j].line, info[j].vertex, LorR) < 0 ) continue;
! arGetCode( image,
! marker_info2[i].x_coord, marker_info2[i].y_coord,
! marker_info2[i].vertex, &id, &dir, &cf );
info[j].id = id;
--- 54,72 ----
int i, j;
! if (LorR) info = &marker_infoL[0];
! else info = &marker_infoR[0];
! for (i = j = 0; i < *marker_num; i++) {
info[j].area = marker_info2[i].area;
info[j].pos[0] = marker_info2[i].pos[0];
info[j].pos[1] = marker_info2[i].pos[1];
! if (arsGetLine(marker_info2[i].x_coord, marker_info2[i].y_coord,
marker_info2[i].coord_num, marker_info2[i].vertex,
info[j].line, info[j].vertex, LorR) < 0 ) continue;
! arGetCode(image,
! marker_info2[i].x_coord, marker_info2[i].y_coord,
! marker_info2[i].vertex, &id, &dir, &cf );
info[j].id = id;
***************
*** 78,82 ****
*marker_num = j;
! return( info );
}
--- 78,82 ----
*marker_num = j;
! return (info);
}
Index: arLabeling.c
===================================================================
RCS file: /cvsroot/artoolkit/artoolkit/lib/SRC/AR/arLabeling.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** arLabeling.c 21 Apr 2006 04:35:41 -0000 1.3
--- arLabeling.c 25 May 2006 04:08:11 -0000 1.4
***************
*** 82,87 ****
return( labeling3(image, thresh, label_num,
area, pos, clip, label_ref, 1) );
! }
! else {
return( labeling2(image, thresh, label_num,
area, pos, clip, label_ref, 1) );
--- 82,86 ----
return( labeling3(image, thresh, label_num,
area, pos, clip, label_ref, 1) );
! } else {
return( labeling2(image, thresh, label_num,
area, pos, clip, label_ref, 1) );
***************
*** 91,101 ****
void arsGetImgFeature( int *num, int **area, int **clip, double **pos, int LorR )
{
! if( LorR ) {
*num = wlabel_numL;
*area = wareaL;
*clip = wclipL;
*pos = wposL;
! }
! else {
*num = wlabel_numR;
*area = wareaR;
--- 90,99 ----
void arsGetImgFeature( int *num, int **area, int **clip, double **pos, int LorR )
{
! if (LorR) {
*num = wlabel_numL;
*area = wareaL;
*clip = wclipL;
*pos = wposL;
! } else {
*num = wlabel_numR;
*area = wareaR;
***************
*** 114,119 ****
return( labeling3(image, thresh, label_num,
area, pos, clip, label_ref, LorR) );
! }
! else {
return( labeling2(image, thresh, label_num,
area, pos, clip, label_ref, LorR) );
--- 112,116 ----
return( labeling3(image, thresh, label_num,
area, pos, clip, label_ref, LorR) );
! } else {
return( labeling2(image, thresh, label_num,
area, pos, clip, label_ref, LorR) );
***************
*** 142,147 ****
int pnt2_index; // [tp]
#endif
! if( LorR ) {
l_image = &l_imageL[0];
work = &workL[0];
--- 139,145 ----
int pnt2_index; // [tp]
#endif
+ int thresht3 = thresh * 3;
! if (LorR) {
l_image = &l_imageL[0];
work = &workL[0];
***************
*** 151,156 ****
wclip = &wclipL[0];
wpos = &wposL[0];
! }
! else {
l_image = &l_imageR[0];
work = &workR[0];
--- 149,153 ----
wclip = &wclipL[0];
wpos = &wposL[0];
! } else {
l_image = &l_imageR[0];
work = &workR[0];
***************
*** 162,177 ****
}
! thresh *= 3;
! if( arImageProcMode == AR_IMAGE_PROC_IN_HALF ) {
lxsize = arImXsize / 2;
lysize = arImYsize / 2;
! }
! else {
lxsize = arImXsize;
lysize = arImYsize;
}
! pnt1 = &l_image[0];
! pnt2 = &l_image[(lysize-1)*lxsize];
#ifndef USE_OPTIMIZATIONS
--- 159,172 ----
}
! if (arImageProcMode == AR_IMAGE_PROC_IN_HALF) {
lxsize = arImXsize / 2;
lysize = arImYsize / 2;
! } else {
lxsize = arImXsize;
lysize = arImYsize;
}
! pnt1 = &l_image[0]; // Leftmost pixel of top row of image.
! pnt2 = &l_image[(lysize - 1)*lxsize]; // Leftmost pixel of bottom row of image.
#ifndef USE_OPTIMIZATIONS
***************
*** 181,185 ****
#else
// 4x loop unrolling
! for(i = 0; i < lxsize-(lxsize%4); i+=4) {
*(pnt1++) = *(pnt2++) = 0;
*(pnt1++) = *(pnt2++) = 0;
--- 176,180 ----
#else
// 4x loop unrolling
! for (i = 0; i < lxsize - (lxsize%4); i += 4) {
*(pnt1++) = *(pnt2++) = 0;
*(pnt1++) = *(pnt2++) = 0;
***************
*** 188,193 ****
}
#endif
! pnt1 = &l_image[0];
! pnt2 = &l_image[lxsize-1];
#ifndef USE_OPTIMIZATIONS
--- 183,188 ----
}
#endif
! pnt1 = &l_image[0]; // Leftmost pixel of top row of image.
! pnt2 = &l_image[lxsize - 1]; // Rightmost pixel of top row of image.
#ifndef USE_OPTIMIZATIONS
***************
*** 199,203 ****
#else
// 4x loop unrolling
! for(i = 0; i < lysize-(lysize%4); i+=4) {
*pnt1 = *pnt2 = 0;
pnt1 += lxsize;
--- 194,198 ----
#else
// 4x loop unrolling
! for (i = 0; i < lysize - (lysize%4); i += 4) {
*pnt1 = *pnt2 = 0;
pnt1 += lxsize;
***************
*** 220,249 ****
wk_max = 0;
pnt2 = &(l_image[lxsize+1]);
! if( arImageProcMode == AR_IMAGE_PROC_IN_HALF ) {
pnt = &(image[(arImXsize*2+2)*AR_PIX_SIZE_DEFAULT]);
poff = AR_PIX_SIZE_DEFAULT*2;
! }
! else {
pnt = &(image[(arImXsize+1)*AR_PIX_SIZE_DEFAULT]);
poff = AR_PIX_SIZE_DEFAULT;
}
! for(j = 1; j < lysize-1; j++, pnt+=poff*2, pnt2+=2) {
for(i = 1; i < lxsize-1; i++, pnt+=poff, pnt2++) {
#if (AR_DEFAULT_PIXEL_FORMAT == AR_PIXEL_FORMAT_ARGB)
! if( *(pnt+1) + *(pnt+2) + *(pnt+3) <= thresh ) {
#elif (AR_DEFAULT_PIXEL_FORMAT == AR_PIXEL_FORMAT_ABGR)
! if( *(pnt+1) + *(pnt+2) + *(pnt+3) <= thresh ) {
#elif (AR_DEFAULT_PIXEL_FORMAT == AR_PIXEL_FORMAT_BGRA)
! if( *(pnt+0) + *(pnt+1) + *(pnt+2) <= thresh ) {
#elif (AR_DEFAULT_PIXEL_FORMAT == AR_PIXEL_FORMAT_BGR)
! if( *(pnt+0) + *(pnt+1) + *(pnt+2) <= thresh ) {
#elif (AR_DEFAULT_PIXEL_FORMAT == AR_PIXEL_FORMAT_RGBA)
! if( *(pnt+0) + *(pnt+1) + *(pnt+2) <= thresh ) {
#elif (AR_DEFAULT_PIXEL_FORMAT == AR_PIXEL_FORMAT_RGB)
! if( *(pnt+0) + *(pnt+1) + *(pnt+2) <= thresh ) {
#elif (AR_DEFAULT_PIXEL_FORMAT == AR_PIXEL_FORMAT_2vuy)
! if( *(pnt+1) * 3 <= thresh ) {
#elif (AR_DEFAULT_PIXEL_FORMAT == AR_PIXEL_FORMAT_yuvs)
! if( *(pnt+0) * 3 <= thresh ) {
#else
# error Unknown default pixel format defined in config.h
--- 215,243 ----
wk_max = 0;
pnt2 = &(l_image[lxsize+1]);
! if (arImageProcMode == AR_IMAGE_PROC_IN_HALF) {
pnt = &(image[(arImXsize*2+2)*AR_PIX_SIZE_DEFAULT]);
poff = AR_PIX_SIZE_DEFAULT*2;
! } else {
pnt = &(image[(arImXsize+1)*AR_PIX_SIZE_DEFAULT]);
poff = AR_PIX_SIZE_DEFAULT;
}
! for (j = 1; j < lysize - 1; j++, pnt += poff*2, pnt2 += 2) {
for(i = 1; i < lxsize-1; i++, pnt+=poff, pnt2++) {
#if (AR_DEFAULT_PIXEL_FORMAT == AR_PIXEL_FORMAT_ARGB)
! if( *(pnt+1) + *(pnt+2) + *(pnt+3) <= thresht3 ) {
#elif (AR_DEFAULT_PIXEL_FORMAT == AR_PIXEL_FORMAT_ABGR)
! if( *(pnt+1) + *(pnt+2) + *(pnt+3) <= thresht3 ) {
#elif (AR_DEFAULT_PIXEL_FORMAT == AR_PIXEL_FORMAT_BGRA)
! if( *(pnt+0) + *(pnt+1) + *(pnt+2) <= thresht3 ) {
#elif (AR_DEFAULT_PIXEL_FORMAT == AR_PIXEL_FORMAT_BGR)
! if( *(pnt+0) + *(pnt+1) + *(pnt+2) <= thresht3 ) {
#elif (AR_DEFAULT_PIXEL_FORMAT == AR_PIXEL_FORMAT_RGBA)
! if( *(pnt+0) + *(pnt+1) + *(pnt+2) <= thresht3 ) {
#elif (AR_DEFAULT_PIXEL_FORMAT == AR_PIXEL_FORMAT_RGB)
! if( *(pnt+0) + *(pnt+1) + *(pnt+2) <= thresht3 ) {
#elif (AR_DEFAULT_PIXEL_FORMAT == AR_PIXEL_FORMAT_2vuy)
! if( *(pnt+1) <= thresh ) {
#elif (AR_DEFAULT_PIXEL_FORMAT == AR_PIXEL_FORMAT_yuvs)
! if( *(pnt+0) <= thresh ) {
#else
# error Unknown default pixel format defined in config.h
***************
*** 422,426 ****
}
}
! if( arImageProcMode == AR_IMAGE_PROC_IN_HALF ) pnt += arImXsize*AR_PIX_SIZE_DEFAULT;
}
--- 416,420 ----
}
}
! if (arImageProcMode == AR_IMAGE_PROC_IN_HALF) pnt += arImXsize*AR_PIX_SIZE_DEFAULT;
}
***************
*** 463,467 ****
*pos = wpos;
*clip = wclip;
! return( l_image );
}
--- 457,461 ----
*pos = wpos;
*clip = wclip;
! return (l_image);
}
***************
*** 485,490 ****
int *wclip;
double *wpos;
- thresh *= 3;
if( arImageProcMode == AR_IMAGE_PROC_IN_HALF ) {
lxsize = arImXsize / 2;
--- 479,484 ----
int *wclip;
double *wpos;
+ int thresht3 = thresh * 3;
if( arImageProcMode == AR_IMAGE_PROC_IN_HALF ) {
lxsize = arImXsize / 2;
***************
*** 571,596 ****
for(i = 1; i < lxsize-1; i++, pnt+=poff, pnt2++, dpnt+=AR_PIX_SIZE_DEFAULT) {
#if (AR_DEFAULT_PIXEL_FORMAT == AR_PIXEL_FORMAT_ARGB)
! if( *(pnt+1) + *(pnt+2) + *(pnt+3) <= thresh ) {
*(dpnt+1) = *(dpnt+2) = *(dpnt+3) = 255;
#elif (AR_DEFAULT_PIXEL_FORMAT == AR_PIXEL_FORMAT_ABGR)
! if( *(pnt+1) + *(pnt+2) + *(pnt+3) <= thresh ) {
*(dpnt+1) = *(dpnt+2) = *(dpnt+3) = 255;
#elif (AR_DEFAULT_PIXEL_FORMAT == AR_PIXEL_FORMAT_BGRA)
! if( *(pnt+0) + *(pnt+1) + *(pnt+2) <= thresh ) {
*(dpnt+0) = *(dpnt+1) = *(dpnt+2) = 255;
#elif (AR_DEFAULT_PIXEL_FORMAT == AR_PIXEL_FORMAT_BGR)
! if( *(pnt+0) + *(pnt+1) + *(pnt+2) <= thresh ) {
*(dpnt+0) = *(dpnt+1) = *(dpnt+2) = 255;
#elif (AR_DEFAULT_PIXEL_FORMAT == AR_PIXEL_FORMAT_RGBA)
! if( *(pnt+0) + *(pnt+1) + *(pnt+2) <= thresh ) {
*(dpnt+0) = *(dpnt+1) = *(dpnt+2) = 255;
#elif (AR_DEFAULT_PIXEL_FORMAT == AR_PIXEL_FORMAT_RGB)
! if( *(pnt+0) + *(pnt+1) + *(pnt+2) <= thresh ) {
*(dpnt+0) = *(dpnt+1) = *(dpnt+2) = 255;
#elif (AR_DEFAULT_PIXEL_FORMAT == AR_PIXEL_FORMAT_2vuy)
! if( *(pnt+1) * 3 <= thresh ) {
*(dpnt+1) = 255;
#elif (AR_DEFAULT_PIXEL_FORMAT == AR_PIXEL_FORMAT_yuvs)
! if( *(pnt+0) * 3 <= thresh ) {
*(dpnt+0) = 255;
#else
--- 565,590 ----
for(i = 1; i < lxsize-1; i++, pnt+=poff, pnt2++, dpnt+=AR_PIX_SIZE_DEFAULT) {
#if (AR_DEFAULT_PIXEL_FORMAT == AR_PIXEL_FORMAT_ARGB)
! if( *(pnt+1) + *(pnt+2) + *(pnt+3) <= thresht3 ) {
*(dpnt+1) = *(dpnt+2) = *(dpnt+3) = 255;
#elif (AR_DEFAULT_PIXEL_FORMAT == AR_PIXEL_FORMAT_ABGR)
! if( *(pnt+1) + *(pnt+2) + *(pnt+3) <= thresht3 ) {
*(dpnt+1) = *(dpnt+2) = *(dpnt+3) = 255;
#elif (AR_DEFAULT_PIXEL_FORMAT == AR_PIXEL_FORMAT_BGRA)
! if( *(pnt+0) + *(pnt+1) + *(pnt+2) <= thresht3 ) {
*(dpnt+0) = *(dpnt+1) = *(dpnt+2) = 255;
#elif (AR_DEFAULT_PIXEL_FORMAT == AR_PIXEL_FORMAT_BGR)
! if( *(pnt+0) + *(pnt+1) + *(pnt+2) <= thresht3 ) {
*(dpnt+0) = *(dpnt+1) = *(dpnt+2) = 255;
#elif (AR_DEFAULT_PIXEL_FORMAT == AR_PIXEL_FORMAT_RGBA)
! if( *(pnt+0) + *(pnt+1) + *(pnt+2) <= thresht3 ) {
*(dpnt+0) = *(dpnt+1) = *(dpnt+2) = 255;
#elif (AR_DEFAULT_PIXEL_FORMAT == AR_PIXEL_FORMAT_RGB)
! if( *(pnt+0) + *(pnt+1) + *(pnt+2) <= thresht3 ) {
*(dpnt+0) = *(dpnt+1) = *(dpnt+2) = 255;
#elif (AR_DEFAULT_PIXEL_FORMAT == AR_PIXEL_FORMAT_2vuy)
! if( *(pnt+1) <= thresh ) {
*(dpnt+1) = 255;
#elif (AR_DEFAULT_PIXEL_FORMAT == AR_PIXEL_FORMAT_yuvs)
! if( *(pnt+0) <= thresh ) {
*(dpnt+0) = 255;
#else
***************
*** 717,721 ****
}
}
! if( arImageProcMode == AR_IMAGE_PROC_IN_HALF ) pnt += arImXsize*AR_PIX_SIZE_DEFAULT;
}
--- 711,715 ----
}
}
! if (arImageProcMode == AR_IMAGE_PROC_IN_HALF) pnt += arImXsize*AR_PIX_SIZE_DEFAULT;
}
|