/[opencvs]/eyes/combine_two_images_interleaved.c
ViewVC logotype

Contents of /eyes/combine_two_images_interleaved.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations)
Sat Oct 8 22:06:17 2011 UTC (6 years, 9 months ago) by hib
Branch: MAIN
CVS Tags: HEAD
File MIME type: text/plain
working on tilify.c - this will be pretty neat
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <math.h>
4
5 #include "util.h"
6 /* usage combine_two_images_interleaved xsize ysize f1 f2
7 xsize is doubled on the output
8 */
9 int main (int argc,char *argv[]) {
10 char *file1;
11 char *file2;
12 int xsize;
13 int ysize;
14 if (argc==5) {
15 xsize=atoi(argv[1]);
16 ysize=atoi(argv[2]);
17 file1=argv[3];
18 file2=argv[4];
19 }
20 else {
21 fprintf(stderr,"usage combine_two_images_interleaved xsize ysize f1 f2\n"
22 " xsize is doubled on the output\n"
23 "Where file has x|y|r|g|b text format\n");
24 exit(-1);
25 }
26 FILE *f1,*f2;
27 f1 = fopen(file1,"r");
28 f2 = fopen(file2,"r");
29 char f1buf[10001];
30 char f2buf[10001];
31 printf("# ImageMagick pixel enumeration: %d,%d,255,rgb\n",xsize*2,ysize);
32 while (fgets(f1buf,10000,f1)) {
33 char *q;
34 // fprintf(stderr,"b %s\n",basebuf);
35 q=fgets(f2buf,10000,f2);
36 int xb,yb,rb,gb,bb;
37 int xo,yo,ro,go,bo;
38 xb = fieldi(f1buf,0);
39 yb = fieldi(f1buf,1);
40 rb = fieldi(f1buf,2);
41 gb = fieldi(f1buf,3);
42 bb = fieldi(f1buf,4);
43 xo = fieldi(f2buf,0);
44 yo = fieldi(f2buf,1);
45 ro = fieldi(f2buf,2);
46 go = fieldi(f2buf,3);
47 bo = fieldi(f2buf,4);
48 if ((xb != xo)||(yb != yo)) {
49 fprintf(stderr,"error %d,%d %d,%d \n",
50 xb,yb,xo,yo);
51 continue;
52 }
53
54 int total;
55 total = rb*65536+gb*256+bb;
56 printf("%d,%d: (%d,%d,%d) #%06x rgb(%d,%d,%d)\n",
57 xb*2,yb,rb,gb,bb,total,rb,gb,bb);
58 total = ro*65536+go*256+bo;
59 printf("%d,%d: (%d,%d,%d) #%06x rgb(%d,%d,%d)\n",
60 xb*2+1,yb,ro,go,bo,total,ro,go,bo);
61 }
62 }

  ViewVC Help
Powered by ViewVC 1.1.5