tools/MirrorPatt/src/main.cpp
Go to the documentation of this file.
1 
2 
3 //
4 //
5 // This tool will read ARToolKit pattern files (size 16x16) and save
6 // them mirrored in y-direction.
7 //
8 // Usage: MirrorPatt [infilename] [outfilename]
9 //
10 //
11 
12 #include <stdio.h>
13 #include <assert.h>
14 
15 
16 
17 void
18 readLine(FILE* fp, char* line)
19 {
20  *line++ = fgetc(fp);
21 
22  while(line[-1] != '\n')
23  *line++ = fgetc(fp);
24 
25  *line++ = 0;
26 }
27 
28 
29 void mirrorMarkerFile(const char* nInName, const char* nOutName, int nMarkerWidth, int nMarkerHeight)
30 {
31  FILE *finp = fopen(nInName, "r"),
32  *foutp = fopen(nOutName, "w");
33 
34  if(!finp)
35  return;
36 
37  const int strMax = 256, numPix = nMarkerWidth*nMarkerHeight;
38  char str[32][strMax+1];
39  int y,channel,rot;
40 
41  for(rot=0; rot<4; rot++)
42  {
43  for(channel=0; channel<3; channel++)
44  {
45  for(y=0; y<nMarkerHeight; y++)
46  {
47  readLine(finp, str[y]);
48  }
49 
50  for(y=0; y<nMarkerHeight; y++)
51  {
52  fprintf(foutp, "%s", str[nMarkerHeight-1-y]);
53 // fprintf(foutp, "%s", str[y]);
54  }
55  }
56 
57  readLine(finp, str[0]);
58  fprintf(foutp, "\n");
59  }
60 
61  fclose(finp);
62  fclose(finp);
63 }
64 
65 
66 int main(int argc, char** argv)
67 {
68  if(argc<3)
69  {
70  printf("ERROR: to few parameters\n");
71  return -1;
72  }
73 
74  const char *inName = argv[1],
75  *outName = argv[2];
76 
77  mirrorMarkerFile(inName, outName, 16,16);
78  return 0;
79 }
TFSIMD_FORCE_INLINE const tfScalar & y() const
void readLine(FILE *fp, char *line)
void mirrorMarkerFile(const char *nInName, const char *nOutName, int nMarkerWidth, int nMarkerHeight)
int main(int argc, char **argv)


tuw_artoolkitplus
Author(s): Markus Bader
autogenerated on Sun Sep 4 2016 03:24:33