fts2blocks.c
Go to the documentation of this file.00001 #include <stdio.h>
00002 #include <stdlib.h>
00003 #include <malloc.h>
00004 #include <math.h>
00005 #include <string.h>
00006 #include <unistd.h>
00007 #include <ppm.h>
00008
00009 #include "extract_features.proto"
00010
00011 #define numH 18
00012 #define numS 3
00013 #define numV 3
00014 #define numGrey 4
00015
00016 int main(int argc, char *argv[]) {
00017
00018 char *in_fname, *out_fname;
00019 char *point_pos;
00020 enum file_types ppm_type;
00021 enum ppm_error the_error;
00022
00023 switch(argc) {
00024 case 2:
00025 in_fname = argv[1];
00026 break;
00027 default:
00028 fprintf(stderr, "Usage: %s fts_file \n\n", argv[0]);
00029 exit(1);
00030 break;
00031 }
00032
00033
00034 out_fname = (char *)malloc((strlen(in_fname) + 10)*sizeof(char));
00035 if ((point_pos = strchr(in_fname, '.')) == NULL) {
00036 fprintf(stderr, "File %s has no ""."" - can't generate features filename\n\n", in_fname);
00037 exit(1);
00038 }
00039 else {
00040 strncpy(out_fname, in_fname, (int)(point_pos - in_fname));
00041 strcat(out_fname, ".fts");
00042 }
00043
00044
00045
00046 init_feature_variables(18*3*3+4);
00047
00048 fts2blocks(in_fname);
00049
00050 exit(0);
00051 }