00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include <AR/ar.h>
00013
00014 static ARMarkerInfo marker_infoL[AR_SQUARE_MAX];
00015 static ARMarkerInfo marker_infoR[AR_SQUARE_MAX];
00016
00017 ARMarkerInfo *arGetMarkerInfo( ARUint8 *image,
00018 ARMarkerInfo2 *marker_info2, int *marker_num )
00019 {
00020 int id, dir;
00021 double cf;
00022 int i, j;
00023
00024 for (i = j = 0; i < *marker_num; i++) {
00025 marker_infoL[j].area = marker_info2[i].area;
00026 marker_infoL[j].pos[0] = marker_info2[i].pos[0];
00027 marker_infoL[j].pos[1] = marker_info2[i].pos[1];
00028
00029 if (arGetLine(marker_info2[i].x_coord, marker_info2[i].y_coord,
00030 marker_info2[i].coord_num, marker_info2[i].vertex,
00031 marker_infoL[j].line, marker_infoL[j].vertex) < 0 ) continue;
00032
00033 arGetCode(image,
00034 marker_info2[i].x_coord, marker_info2[i].y_coord,
00035 marker_info2[i].vertex, &id, &dir, &cf );
00036
00037 marker_infoL[j].id = id;
00038 marker_infoL[j].dir = dir;
00039 marker_infoL[j].cf = cf;
00040
00041 j++;
00042 }
00043 *marker_num = j;
00044
00045 return (marker_infoL);
00046 }
00047
00048 ARMarkerInfo *arsGetMarkerInfo( ARUint8 *image,
00049 ARMarkerInfo2 *marker_info2, int *marker_num, int LorR )
00050 {
00051 ARMarkerInfo *info;
00052 int id, dir;
00053 double cf;
00054 int i, j;
00055
00056 if (LorR) info = &marker_infoL[0];
00057 else info = &marker_infoR[0];
00058
00059 for (i = j = 0; i < *marker_num; i++) {
00060 info[j].area = marker_info2[i].area;
00061 info[j].pos[0] = marker_info2[i].pos[0];
00062 info[j].pos[1] = marker_info2[i].pos[1];
00063
00064 if (arsGetLine(marker_info2[i].x_coord, marker_info2[i].y_coord,
00065 marker_info2[i].coord_num, marker_info2[i].vertex,
00066 info[j].line, info[j].vertex, LorR) < 0 ) continue;
00067
00068 arGetCode(image,
00069 marker_info2[i].x_coord, marker_info2[i].y_coord,
00070 marker_info2[i].vertex, &id, &dir, &cf );
00071
00072 info[j].id = id;
00073 info[j].dir = dir;
00074 info[j].cf = cf;
00075
00076 j++;
00077 }
00078 *marker_num = j;
00079
00080 return (info);
00081 }
00082