Changeset 387 for pwntcha/trunk/src/slashdot.c
- Timestamp:
- Jan 3, 2005, 4:29:46 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pwntcha/trunk/src/slashdot.c
r386 r387 35 35 36 36 /* Main function */ 37 char * slashdot_decode(char *image) 38 { 39 struct image *img, *tmp, *tmp2; 40 41 img = load_image(image); 42 if(img == NULL) 43 return NULL; 37 char * decode_slashdot(struct image *img) 38 { 39 struct image *tmp, *tmp2; 44 40 45 41 /* Slashdot captchas have 7 characters */ … … 47 43 48 44 /* Clean image a bit */ 49 tmp = detect_lines(img);50 tmp = fil l_holes(tmp);45 tmp = filter_detect_lines(img); 46 tmp = filter_fill_holes(tmp); 51 47 52 48 /* Detect small objects to guess image orientation */ 53 tmp2 = median(tmp);54 tmp2 = equalize(tmp2);49 tmp2 = filter_median(tmp); 50 tmp2 = filter_equalize(tmp2); 55 51 count_objects(tmp2); 56 52 57 53 /* Invert rotation and find glyphs */ 58 54 tmp = rotate(tmp); 59 tmp = median(tmp);55 tmp = filter_median(tmp); 60 56 tmp = find_glyphs(tmp); 61 57 … … 72 68 int r, g, b; 73 69 74 dst = new_image(img->width, img->height);70 dst = image_new(img->width, img->height); 75 71 76 72 for(y = 0; y < img->height; y++) … … 91 87 { 92 88 gotblack = 1; 93 f lood_fill(dst, x, y, 255 - objects, 0, 0);89 filter_flood_fill(dst, x, y, 255 - objects, 0, 0); 94 90 objects++; 95 91 } … … 120 116 first = i; 121 117 last = i; 122 f lood_fill(dst, objlist[i].xmin, objlist[i].ymin, 0, 0, 255);118 filter_flood_fill(dst, objlist[i].xmin, objlist[i].ymin, 0, 0, 255); 123 119 } 124 120 } … … 154 150 } 155 151 156 dst = new_image(img->width * FACTOR, img->height * FACTOR);152 dst = image_new(img->width * FACTOR, img->height * FACTOR); 157 153 158 154 for(y = 0; y < img->height * FACTOR; y++) … … 187 183 int r, g, b; 188 184 189 dst = new_image(img->width, img->height);185 dst = image_new(img->width, img->height); 190 186 191 187 for(y = 0; y < img->height; y++) … … 222 218 glyphs[22]; 223 219 struct image *dst; 224 struct image *font = load_image(FONTNAME);220 struct image *font = image_load(FONTNAME); 225 221 int x, y, i = 0; 226 222 int r, g, b; … … 234 230 } 235 231 236 dst = new_image(img->width, img->height);232 dst = image_new(img->width, img->height); 237 233 238 234 for(y = 0; y < img->height; y++)
Note: See TracChangeset
for help on using the changeset viewer.