chiark / gitweb /
Use find_aa_density for colon detection
authorIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sun, 5 Jul 2009 18:11:21 +0000 (19:11 +0100)
committerIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sun, 5 Jul 2009 18:11:21 +0000 (19:11 +0100)
pctb/structure.c

index c54f89a13c35aa3a4b8bc7ef4dda73b1bc665fb3..26945ad519c34265f9d40571b01f1504a4b394bd 100644 (file)
@@ -765,10 +765,15 @@ void find_islandname(RgbImage *ri) {
       
       for (p.y=islandnamer.tl.y; p.y<=islandnamer.br.y; p.y++) {
        pattern <<= 1;
       
       for (p.y=islandnamer.tl.y; p.y<=islandnamer.br.y; p.y++) {
        pattern <<= 1;
-       switch (get_p(p)) {
-       case '*': if (runs[nruns]) { nruns++; runs[nruns]=0; }          break;
-       case 'O': runs[nruns]++;              pattern |= 1u;            break;
-       default:                              pattern |= 1UL<<31;       break;
+       double alpha= find_aa_density(ri,p, 0xCCCCAA,0x002255,0);
+       if (alpha >= 0.49) {
+          runs[nruns]++;
+          pattern |= 1u;
+       } else {
+         if (runs[nruns]) {
+           nruns++;
+           runs[nruns]=0;
+         }
        }
       }
 
        }
       }