- Timestamp:
- Jan 4, 2005, 3:59:22 AM (18 years ago)
- Location:
- pwntcha/trunk/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
pwntcha/trunk/src/common.h
r398 r402 46 46 struct image *filter_median(struct image *img); 47 47 struct image *filter_contrast(struct image *img); 48 int filter_count(struct image *img); 48 49 -
pwntcha/trunk/src/filters.c
r398 r402 330 330 } 331 331 332 int filter_count(struct image *img) 333 { 334 int histo[256]; 335 int x, y, i, count = 0; 336 int r, g, b; 337 338 for(i = 0; i < 256; i++) 339 histo[i] = 0; 340 341 for(y = 0; y < img->height; y++) 342 for(x = 0; x < img->width; x++) 343 { 344 getgray(img, x, y, &r); 345 histo[r] = 1; 346 } 347 348 for(i = 0; i < 256; i++) 349 count += histo[i]; 350 351 return count; 352 } 353 -
pwntcha/trunk/src/main.c
r401 r402 109 109 char *input = argv[optind], *result; 110 110 struct image *img; 111 int count; 111 112 112 113 img = image_load(argv[optind]); … … 118 119 } 119 120 120 dprintf("image size %ix%i\n", img->width, img->height); 121 count = filter_count(img); 122 dprintf("image size %ix%i, %i colours\n", 123 img->width, img->height, count); 121 124 122 125 if(!strcmp(mode, "test")) … … 135 138 result = decode_phpbb(img); 136 139 } 137 else if(img->height == 25 || img->height == 30) 140 else if((img->height == 25 || img->height == 30) 141 && count < 10) 138 142 { 139 143 dprintf("autodetecting scode captcha\n");
Note: See TracChangeset
for help on using the changeset viewer.