git-svn-id: file:///srv/caca.zoy.org/var/lib/svn/pwntcha/trunk@482 92316355-f0b4-4df1-b90c-862c8a59935fmaster
| @@ -42,9 +42,9 @@ char *decode_authimage(struct image *img) | |||||
| tmp = image_dup(img); | tmp = image_dup(img); | ||||
| filter_scale(tmp, 2.0); | filter_scale(tmp, 2.0); | ||||
| getpixel(tmp, 0, 0, &r, &g, &b); | getpixel(tmp, 0, 0, &r, &g, &b); | ||||
| filter_equalize(tmp, r * 3 / 4); | |||||
| filter_threshold(tmp, r * 3 / 4); | |||||
| filter_smooth(tmp); | filter_smooth(tmp); | ||||
| filter_equalize(tmp, 220); | |||||
| filter_threshold(tmp, 220); | |||||
| for(i = 0; i < 6; i++) | for(i = 0; i < 6; i++) | ||||
| { | { | ||||
| @@ -32,7 +32,7 @@ char *decode_clubic(struct image *img) | |||||
| strcpy(result, " "); | strcpy(result, " "); | ||||
| tmp = image_dup(img); | tmp = image_dup(img); | ||||
| filter_equalize(tmp, 200); | |||||
| filter_threshold(tmp, 200); | |||||
| find_glyphs(tmp); | find_glyphs(tmp); | ||||
| image_free(tmp); | image_free(tmp); | ||||
| @@ -72,7 +72,7 @@ void filter_fill_holes(struct image *img); | |||||
| void filter_scale(struct image *img, float ratio); | void filter_scale(struct image *img, float ratio); | ||||
| void filter_black_stuff(struct image *img); | void filter_black_stuff(struct image *img); | ||||
| void filter_detect_lines(struct image *img); | void filter_detect_lines(struct image *img); | ||||
| void filter_equalize(struct image *img, int threshold); | |||||
| void filter_threshold(struct image *img, int threshold); | |||||
| void filter_trick(struct image *img); | void filter_trick(struct image *img); | ||||
| void filter_smooth(struct image *img); | void filter_smooth(struct image *img); | ||||
| void filter_median(struct image *img); | void filter_median(struct image *img); | ||||
| @@ -201,7 +201,7 @@ void filter_detect_lines(struct image *img) | |||||
| image_free(dst); | image_free(dst); | ||||
| } | } | ||||
| void filter_equalize(struct image *img, int threshold) | |||||
| void filter_threshold(struct image *img, int threshold) | |||||
| { | { | ||||
| struct image *dst; | struct image *dst; | ||||
| int x, y; | int x, y; | ||||
| @@ -43,7 +43,7 @@ char *decode_linuxfr(struct image *img) | |||||
| stats = malloc(img->height * sizeof(int)); | stats = malloc(img->height * sizeof(int)); | ||||
| tmp = image_dup(img); | tmp = image_dup(img); | ||||
| filter_equalize(tmp, 150); | |||||
| filter_threshold(tmp, 150); | |||||
| for(y = 0; y < tmp->height; y++) | for(y = 0; y < tmp->height; y++) | ||||
| { | { | ||||
| @@ -37,7 +37,7 @@ char *decode_livejournal(struct image *img) | |||||
| filter_median(tmp); | filter_median(tmp); | ||||
| // filter_smooth(tmp); | // filter_smooth(tmp); | ||||
| // filter_contrast(tmp); | // filter_contrast(tmp); | ||||
| filter_equalize(tmp, 128); | |||||
| filter_threshold(tmp, 128); | |||||
| image_save(tmp, "foo.bmp"); | image_save(tmp, "foo.bmp"); | ||||
| find_glyphs(tmp); | find_glyphs(tmp); | ||||
| @@ -44,7 +44,7 @@ char *decode_phpbb(struct image *img) | |||||
| tmp2 = image_new(img->width, img->height); | tmp2 = image_new(img->width, img->height); | ||||
| filter_smooth(tmp1); | filter_smooth(tmp1); | ||||
| filter_equalize(tmp1, 128); | |||||
| filter_threshold(tmp1, 128); | |||||
| for(x = 0; x < img->width; x++) | for(x = 0; x < img->width; x++) | ||||
| for(y = 0; y < img->height; y++) | for(y = 0; y < img->height; y++) | ||||
| @@ -49,7 +49,7 @@ char *decode_slashdot(struct image *img) | |||||
| /* Detect small objects to guess image orientation */ | /* Detect small objects to guess image orientation */ | ||||
| tmp2 = image_dup(tmp1); | tmp2 = image_dup(tmp1); | ||||
| filter_median(tmp2); | filter_median(tmp2); | ||||
| filter_equalize(tmp2, 200); | |||||
| filter_threshold(tmp2, 200); | |||||
| count_objects(tmp2); | count_objects(tmp2); | ||||
| /* Invert rotation and find glyphs */ | /* Invert rotation and find glyphs */ | ||||
| @@ -31,7 +31,7 @@ char *decode_test(struct image *img) | |||||
| tmp = image_dup(img); | tmp = image_dup(img); | ||||
| filter_smooth(tmp); | filter_smooth(tmp); | ||||
| filter_median(tmp); | filter_median(tmp); | ||||
| filter_equalize(tmp, 130); | |||||
| filter_threshold(tmp, 130); | |||||
| filter_median(tmp); | filter_median(tmp); | ||||
| image_free(tmp); | image_free(tmp); | ||||
| @@ -46,7 +46,7 @@ char *decode_tickets(struct image *img) | |||||
| /* captcha is jpeg; threshold the image */ | /* captcha is jpeg; threshold the image */ | ||||
| tmp = image_dup(img); | tmp = image_dup(img); | ||||
| filter_equalize(tmp, 127); | |||||
| filter_threshold(tmp, 127); | |||||
| /* Guess all glyphs */ | /* Guess all glyphs */ | ||||
| curx = 50; | curx = 50; | ||||
| @@ -42,9 +42,9 @@ char *decode_vbulletin(struct image *img) | |||||
| tmp = image_dup(img); | tmp = image_dup(img); | ||||
| getpixel(tmp, 0, 0, &r, &g, &b); | getpixel(tmp, 0, 0, &r, &g, &b); | ||||
| if(r < 50) | if(r < 50) | ||||
| filter_equalize(tmp, 128); | |||||
| filter_threshold(tmp, 128); | |||||
| else | else | ||||
| filter_equalize(tmp, -128); | |||||
| filter_threshold(tmp, -128); | |||||
| /* Remove garbage around the cells */ | /* Remove garbage around the cells */ | ||||
| for(x = 0; x < tmp->width; x++) | for(x = 0; x < tmp->width; x++) | ||||
| @@ -35,7 +35,7 @@ char *decode_xanga(struct image *img) | |||||
| tmp = image_dup(img); | tmp = image_dup(img); | ||||
| image_save(tmp, "xanga1.bmp"); | image_save(tmp, "xanga1.bmp"); | ||||
| /* Clean image a bit */ | /* Clean image a bit */ | ||||
| // filter_equalize(tmp, 200); | |||||
| // filter_threshold(tmp, 200); | |||||
| filter_contrast(tmp); | filter_contrast(tmp); | ||||
| //filter_detect_lines(tmp); | //filter_detect_lines(tmp); | ||||
| image_save(tmp, "xanga2.bmp"); | image_save(tmp, "xanga2.bmp"); | ||||
| @@ -47,14 +47,14 @@ image_save(tmp, "xanga3.bmp"); | |||||
| //filter_detect_lines(tmp); | //filter_detect_lines(tmp); | ||||
| // filter_median(tmp); | // filter_median(tmp); | ||||
| //image_save(tmp, "xanga4.bmp"); | //image_save(tmp, "xanga4.bmp"); | ||||
| // filter_equalize(tmp, 128); | |||||
| // filter_threshold(tmp, 128); | |||||
| filter_contrast(tmp); | filter_contrast(tmp); | ||||
| image_save(tmp, "xanga4.bmp"); | image_save(tmp, "xanga4.bmp"); | ||||
| #if 0 | #if 0 | ||||
| /* Detect small objects to guess image orientation */ | /* Detect small objects to guess image orientation */ | ||||
| filter_median(tmp); | filter_median(tmp); | ||||
| filter_equalize(tmp, 200); | |||||
| filter_threshold(tmp, 200); | |||||
| /* Invert rotation and find glyphs */ | /* Invert rotation and find glyphs */ | ||||
| filter_median(tmp); | filter_median(tmp); | ||||