Go to the documentation of this file.00001 #ifdef _WIN32
00002 # include <windows.h>
00003 #endif
00004 #include <math.h>
00005 #include <stdio.h>
00006 #include <stdlib.h>
00007 #include "calib_cparam.h"
00008
00009 void initLineModel( int *line_num, int *loop_num,
00010 int line_mode[LINE_MAX],
00011 double inter_coord[LOOP_MAX][LINE_MAX][LINE_MAX][3] )
00012 {
00013 int i, j, k;
00014 char buf[256];
00015 int hno, vno;
00016 double dist1, dist2;
00017
00018 hno = 7;
00019 vno = 9;
00020 *loop_num = 5;
00021 dist1 = 40.0;
00022 dist2 = 100.0;
00023
00024 printf("Number of horizontal lines (%d): ", hno);
00025 fgets(buf, 256, stdin);
00026 sscanf( buf, "%d", &hno );
00027 printf("Number of vertical lines (%d): ", vno);
00028 fgets(buf, 256, stdin);
00029 sscanf( buf, "%d", &vno );
00030 if( hno + vno > LINE_MAX ) {
00031 printf("too many lines!!\n");
00032 exit(0);
00033 }
00034
00035 printf("Number of iteration (%d): ", *loop_num);
00036 fgets(buf, 256, stdin);
00037 sscanf( buf, "%d", loop_num );
00038 if( *loop_num > LOOP_MAX ) {
00039 printf("too many iteration!!\n");
00040 exit(0);
00041 }
00042
00043 printf("Distance among lines (%f): ", dist1);
00044 fgets(buf, 256, stdin);
00045 sscanf( buf, "%lf", &dist1 );
00046 printf("Distance to move (%f): ", dist2);
00047 fgets(buf, 256, stdin);
00048 sscanf( buf, "%lf", &dist2 );
00049
00050
00051 *line_num = hno + vno;
00052 for( i = 0; i < hno; i++ ) line_mode[i] = L_HORIZONTAL;
00053 for( i = 0; i < vno; i++ ) line_mode[i+hno] = L_VERTICAL;
00054
00055 for( k = 0; k < LOOP_MAX; k++ ) {
00056 for( i = 0; i < LINE_MAX; i++ ) {
00057 for( j = 0; j < LINE_MAX; j++ ) {
00058 inter_coord[k][j][i][0] = -10000.0;
00059 inter_coord[k][j][i][1] = -10000.0;
00060 inter_coord[k][j][i][2] = -10000.0;
00061 }
00062 }
00063 }
00064
00065 for( k = 0; k < *loop_num; k++ ) {
00066 for( j = 0; j < hno; j++ ) {
00067 for( i = 0; i < vno; i++ ) {
00068 inter_coord[k][j][i+hno][0] = dist1 * i;
00069 inter_coord[k][j][i+hno][1] = dist1 * j;
00070 inter_coord[k][j][i+hno][2] = dist2 * k;
00071 }
00072 }
00073 }
00074 }