Ignore:
Timestamp:
Jan 3, 2005, 10:48:54 PM (15 years ago)
Author:
Sam Hocevar
Message:
  • use OpenCV rather than Imlib2 if both are available.
  • cleaned up the slashdot code.
  • decode phpBB captchas.
  • added filter_contrast.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • pwntcha/trunk/src/slashdot.c

    r387 r389  
    3131/* Global stuff */
    3232struct { int xmin, ymin, xmax, ymax; } objlist[100];
    33 int objects = 0, first = -1, last = -1;
     33int objects, first, last;
    3434char *result;
    3535
     
    3737char * decode_slashdot(struct image *img)
    3838{
    39     struct image *tmp, *tmp2;
     39    struct image *tmp1, *tmp2, *tmp3, *tmp4, *tmp5, *tmp6, *tmp7;
     40
     41    /* Initialise local data */
     42    objects = 0;
     43    first = -1;
     44    last = -1;
    4045
    4146    /* Slashdot captchas have 7 characters */
     
    4348
    4449    /* Clean image a bit */
    45     tmp = filter_detect_lines(img);
    46     tmp = filter_fill_holes(tmp);
     50    tmp1 = filter_detect_lines(img);
     51    tmp2 = filter_fill_holes(tmp1);
    4752
    4853    /* Detect small objects to guess image orientation */
    49     tmp2 = filter_median(tmp);
    50     tmp2 = filter_equalize(tmp2);
    51     count_objects(tmp2);
     54    tmp3 = filter_median(tmp2);
     55    tmp4 = filter_equalize(tmp3, 200);
     56    count_objects(tmp4);
    5257
    5358    /* Invert rotation and find glyphs */
    54     tmp = rotate(tmp);
    55     tmp = filter_median(tmp);
    56     tmp = find_glyphs(tmp);
     59    tmp5 = rotate(tmp2);
     60    tmp6 = filter_median(tmp5);
     61    tmp7 = find_glyphs(tmp6);
     62
     63    /* Clean up our mess */
     64    image_free(tmp1);
     65    image_free(tmp2);
     66    image_free(tmp3);
     67    image_free(tmp4);
     68    image_free(tmp5);
     69    image_free(tmp6);
     70    image_free(tmp7);
     71
     72    /* aaaaaaa means decoding failed */
     73    if(!strcmp(result, "aaaaaaa"))
     74        result[0] = '\0';
    5775
    5876    return result;
Note: See TracChangeset for help on using the changeset viewer.