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

Contents of /eyes/points.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.9 - (show annotations)
Sun Apr 21 08:22:13 2013 UTC (5 years, 6 months ago) by hib
Branch: MAIN
Changes since 1.8: +63 -7 lines
File MIME type: text/plain
working on antiques - added analyze_looking_for_best_frame.sh which automates things much better than before
but still needs a human touch.
1 #include <stdio.h>
2 #include <stdlib.h>
3
4 #define antique
5
6 #ifdef antique
7 #define WIDTH 16
8 #define HEIGHT 16
9 #endif
10
11 #ifdef salka
12 #define WIDTH 132
13 #define HEIGHT 136
14 #endif
15
16 #ifdef veronika
17 #define WIDTH 144
18 #define HEIGHT 48
19 #endif
20
21 #ifdef kelly
22 #define WIDTH 144
23 #define HEIGHT 48
24 #endif
25
26 #ifdef dad
27 #define WIDTH 18
28 #define HEIGHT 25
29 #endif
30
31 #ifdef liss
32 #define WIDTH 28
33 #define HEIGHT 21
34 #endif
35
36 #ifdef stephanie
37 #define WIDTH 32
38 #define HEIGHT 24
39 #endif
40
41
42 #ifdef moot
43 #define WIDTH 64
44 #define HEIGHT 50
45 #endif
46
47 #ifdef lovely1
48 #define WIDTH 32
49 #define HEIGHT 42
50 #endif
51
52 #ifdef cyclone
53 #define WIDTH 16
54 #define HEIGHT 16
55 #endif
56
57 #ifdef girl3
58 #define WIDTH 144
59 #define HEIGHT 48
60 #endif
61
62 int there[WIDTH][HEIGHT];
63 int there2[WIDTH][HEIGHT];
64 int *pos;
65
66 int points (){
67 int width=WIDTH;
68 int height=HEIGHT;
69 int x,y;
70 int size;
71 pos = (int *) there2;
72 for (x=0;x<width;x++) {
73 for (y=0;y<height;y++) {
74 there[x][y] = 0;
75 pos[y*width+x] = y*width+x;
76 }
77 }
78 size=width*height;
79
80 int set(int x,int y,int c,int e)
81 {
82 there[x][y]=e;
83 int cc;cc=(c);
84 if (cc==-1) {
85 for (cc=0;cc<size;cc++) {
86 if (pos[cc]== (y*width+x)) break;
87 }
88 if (cc==size) {
89 fprintf(stderr,"huh??????error\n");
90 exit(-1);
91 }
92 }
93 if (e>0) printf("%010d|%d|%d\n",e,x,y);
94 size=size-1;pos[cc]=pos[size];
95 }
96
97
98 #ifdef salka
99 set(91,47,-1,1);
100 set(108,44,-1,1);
101 set(103,64,-1,1);
102 set(96,89,-1,1);
103 srand(4336734);
104 #endif
105 #ifdef veronika
106 set(58,31,-1,1);
107 set(106,34,-1,1);
108 srand(1223857631);
109 #endif
110 #ifdef kelly
111 set(30,22,-1,1);
112 set(75,22,-1,1);
113 srand(4431287269);
114 #endif
115 #ifdef dad
116 set(10,2,-1,1);
117 set(10,3,-1,1);
118 set(10,4,-1,1);
119 set(2,15,-1,1);
120 set(12,16,-1,1);
121 set(10,7,-1,1);
122 set(13,9,-1,1);
123 set(8,9,-1,1);
124 #endif
125 #ifdef liss
126 set(2,8,-1,1);
127 set(7,3,-1,1);
128 set(11,4,-1,1);
129 set(13,7,-1,1);
130 set(15,10,-1,1);
131 #endif
132 #ifdef stephanie
133 set(12,11,-1,1);
134 set(15,11,-1,1);
135 set(14,16,-1,1);
136 #endif
137 #ifdef moot
138 set(30,20,-1,1);
139 set(25,25,-1,1);
140 set(26,31,-1,1);
141 set(12,27,-1,1);
142 set(35,23,-1,1);
143 set(13,12,-1,1);
144 set(20,4,-1,1);
145 set(32,7,-1,1);
146 #endif
147 #ifdef lovely1
148 set(20,4,-1,1);
149 set(24,3,-1,1);
150 set(22,8,-1,1);
151 set(11,28,-1,1);
152 #endif
153 #ifdef cyclone
154 set(10,4,-1,1);
155 set(10,5,-1,1);
156 set(6,7,-1,1);
157 set(2,12,-1,1);
158 #endif
159 #ifdef girl3
160 set(16,6,-1,1);
161 set(32,5,-1,1);
162 set(22,11,-1,1);
163 #endif
164
165 #ifdef antique
166 set(10,5,-1,-1);
167 set(11,5,-1,-1);
168 set(10,6,-1,-1);
169 set(11,6,-1,-1);
170 set(11,7,-1,-1);
171 {
172 int i;
173 for (i=0;i<16;i++) {
174 set(i,0,-1,-1);
175 set(i,15,-1,-1);
176 set(i,14,-1,-1);
177 }
178 for (i=1;i<14;i++) {
179 set(0,i,-1,-1);
180 set(15,i,-1,-1);
181 }
182 }
183
184 set(9,5,-1,1);
185 set(12,5,-1,1);
186 set(9,10,-1,1);
187 set(11,10,-1,1);
188 set(9,7,-1,1);
189
190 #endif
191
192
193 while (size) {
194 int c,d,e;
195 c = (rand()>>1) % (size);
196 d = pos[c];
197 x = d % width;
198 y = d / width;
199 if (there[x][y]) {
200 fprintf(stderr,"no %d %d %d %d\n as %d",c,d,x,y,there[x][y]);
201 int i;
202 for (i=0;i<size;i++) {
203 int x,y;
204 int d;
205 d = pos[c];
206 x = d % width;
207 y = d / width;
208 fprintf(stderr,"i %d posi %d x %d y %d there %d\n",i,pos[i],x,y,there[x][y]);
209 }
210 exit(1);
211 }
212 if ( (x && ((e=there[x-1][y])>0)) ||
213 ((x<width-1)&&((e=there[x+1][y])>0)) ||
214 ((y<height-1)&&((e=there[x][y+1])>0)) ||
215 ((y)&&((e=there[x][y-1])>0)) ) {
216 e++;
217 set(x,y,c,e);
218 }
219 }
220 return 0;
221 }
222
223 int main()
224 {
225 points();
226 }

  ViewVC Help
Powered by ViewVC 1.1.5