void set_input_layer_translation(INPUT_DESC *input, int x, int y) { // The coordinate system must be adjusted to the MAE internal coordinates input->wxd = x; input->wyd = y; translation_filter_deltaX = (float)(-IMAGE_WIDTH + input->wxd); translation_filter_deltaY = (float)(-IMAGE_HEIGHT + input->wyd); move_input_window (input->name, input->wxd, input->wyd); }
NEURON_OUTPUT Move2Mouth (PARAM_LIST *pParamList) { NEURON_OUTPUT output; g_nFacePart = MOUTH; face_recog.wxd_old = face_recog.wxd; face_recog.wyd_old = face_recog.wyd; face_recog.wxd = g_nMouthX; face_recog.wyd = g_nMouthY; move_input_window (face_recog.name, face_recog.wxd, face_recog.wyd); output.ival = 0; return (output); }
NEURON_OUTPUT Move2Nose (PARAM_LIST *pParamList) { NEURON_OUTPUT output; g_nFacePart = NOSE; face_recog.wxd_old = face_recog.wxd; face_recog.wyd_old = face_recog.wyd; face_recog.wxd = g_nNoseX; face_recog.wyd = g_nNoseY; move_input_window (face_recog.name, face_recog.wxd, face_recog.wyd); output.ival = 0; return (output); }
NEURON_OUTPUT Move2Nose2 (PARAM_LIST *pParamList) { NEURON_OUTPUT output; int x_disp; int y_disp; x_disp = pParamList->next->param.ival; y_disp = pParamList->next->next->param.ival; g_nFacePart = NOSE; face_recog.wxd_old = face_recog.wxd; face_recog.wyd_old = face_recog.wyd; face_recog.wxd = g_nNoseX + x_disp; face_recog.wyd = g_nNoseY + y_disp; move_input_window (face_recog.name, face_recog.wxd, face_recog.wyd); output.ival = 0; return (output); }
int main( int argc, char ** argv ) { g_dict_list_t gdl; init_g_dict_list( &gdl ); printf("正在加载词库...\n"); FILE * fp = fopen( CIKU_FILENAME, "rb" ); if( fp == NULL ) { perror("fopen"); return 1; } char words_line[1024]; char explain_line[1024]; char * ret; char * p; int len = 0; while( !feof( fp ) ) { ret = fgets( words_line, sizeof(words_line), fp ); if( ret == NULL ) break; p = strchr(words_line, '\n'); *p = '\0'; len += strlen( words_line ); ret = fgets( explain_line, sizeof(explain_line), fp ); if( ret == NULL ) break; p = strchr(explain_line, '\n'); *p = '\0'; insert_dict_glist( &gdl, words_line, explain_line ); } printf("cha liao %d ci.\n", gdl.node_num ); printf("加载完毕.\n"); //traversal_glist( gdl.first_level ); printf("len = %d\n", len ); //return 0; show_window(); char input_buf[ winy ]; move_input_window(); int key; int input_off = 0; left_words_num = winy - 6; char left_words[ left_words_num ][MAX_WORDS_LEN]; char * explain; insert_dict_glist( &gdl, "shit", "些特" ); while( 1 ) { key = get_key( 0 ); switch( key ) { case BACKSPACE: if( input_off > 0 ) { move_left( 1 ); putchar( ' ' ); move_left( 1 ); input_off --; input_buf[ input_off ] = '\0'; bzero( left_words, sizeof(left_words) ); search_words( &gdl, input_buf, left_words, &explain ); show_left_words( input_buf, left_words ); show_explain( input_buf, explain ); fflush( NULL ); } break; case ESC: clear_screen(); move_xy( 1, 1 ); exit( 0 ); break; default: if( input_off < winx - 20 ) { if( isprint( key ) ) putchar( key ); input_buf[ input_off ++ ] = key; input_buf[ input_off ] = '\0'; bzero( left_words, sizeof(left_words) ); search_words( &gdl, input_buf, left_words, &explain ); show_left_words( input_buf, left_words ); show_explain( input_buf, explain ); fflush( NULL ); } } } return 0; }