Exemplo n.º 1
0
def hypatia_sans_regular(height):
    '''returns dict of images of height <height>
    for each character of the hypatia sans font
    currently supported: 0123456789+
    '''
    hypatia_templates = {}
    all_chars_uncropped = load_image(image_file_regular)
    x0, x1, y0, y1 = get_crop_dimensions(all_chars_uncropped)
    get_separators(all_chars_uncropped)
    all_chars = all_chars_uncropped[x0:x1, :, 0]
    char_height = 1 + x1 - x0
    # show_image(all_chars)
    # These hard-coded values are really dangerous, editor beware
    hypatia_templates['1'] = resize(all_chars[:, 0:120],
                                    (height, height * 120 / char_height))
    hypatia_templates['2'] = resize(all_chars[:, 140:280],
                                    (height, height * 140 / char_height))
    hypatia_templates['3'] = resize(all_chars[:, 290:430],
                                    (height, height * 140 / char_height))
    hypatia_templates['+'] = resize(all_chars[:, 440:580],
                                    (height, height * 140 / char_height))
    hypatia_templates['4'] = resize(all_chars[:, 580:730],
                                    (height, height * 150 / char_height))
    hypatia_templates['5'] = resize(all_chars[:, 730:870],
                                    (height, height * 140 / char_height))
    hypatia_templates['6'] = resize(all_chars[:, 870:1020],
                                    (height, height * 150 / char_height))
    hypatia_templates['7'] = resize(all_chars[:, 1030:1160],
                                    (height, height * 130 / char_height))
    hypatia_templates['8'] = resize(all_chars[:, 1170:1320],
                                    (height, height * 150 / char_height))
    hypatia_templates['9'] = resize(all_chars[:, 1320:1470],
                                    (height, height * 150 / char_height))
    hypatia_templates['0'] = resize(all_chars[:, 1470:1610],
                                    (height, height * 140 / char_height))

    # sk = ['1', '2', '3', '+', '4', '5', '6', '7', '8', '9', '0']
    # for key in sk:
    #     show_image(hypatia_templates[key])

    for key in hypatia_templates.keys():
        # show_image(hypatia_templates[key])
        # print hypatia_templates[key].shape
        hypatia_templates[key] = np.rot90(hypatia_templates[key], 2)
        # hypatia_templates[key] = hypatia_templates[key] - 0.5 # potential fix for '4' vs '+' issue
        # hypatia_templates[key][hypatia_templates[key] == 0] = -1 # potential fix for '4' vs '+' issue

    return hypatia_templates
Exemplo n.º 2
0
# 1080p templates for dire and radiant creeps
from get_image import load_image, show_image, save_image, get_image
import time

fat_hero = load_image('9520hp.png')
ally_1 = load_image('ally_3.png')
enemy_hero = load_image('enemy_1.png')

hero_template = fat_hero[424:429,1032:1033]
# print hero_template

ally_template = ally_1[430:436,675:676]

enemy_template = enemy_hero[493:499,1042:1043]

# print enemy_template
# show_image(enemy_hero)

# time.sleep(5)
# image = get_image()
# save_image(image, 'enemy_low_high.png')
# show_image(image)
Exemplo n.º 3
0
    '''get mask which shows the attack damage of selected unit'''
    mask = image[892:904, 1750:1805, 1] > 100
    return mask


def get_gold(image):
    res = num_mask_to_str(get_gold_mask(image))
    if res == '':
        return 0
    else:
        return eval(res)


if __name__ == '__main__':
    print "radiant creeps (4)"
    test_img = load_image("init.png")
    a = time.time()
    res = get_radiant_creeps(test_img)
    print time.time() - a
    print res
    print 'dire creeps (none)'
    a = time.time()
    res = get_dire_creeps(test_img)
    print time.time() - a
    print res
    print 'hero'
    test_img = load_image("dire_9520hp_2.png")
    a = time.time()
    res = get_hero(test_img)
    print time.time() - a
    print res
Exemplo n.º 4
0
# 1080p templates for dire and radiant creeps

from get_image import load_image, show_image

base_creep_img = load_image("creeps1080p.png")
base_creep_img_2 = load_image("creeps_1080p_dire.png")
# print base_creep_img[544:548,1299:1303,:]
# print base_creep_img[1299:1302,544:546,:]

# print base_creep_img[348,951,:]
# show_image(base_creep_img[295:296,839+1:839+79,:])
# show_image(base_creep_img[295-1:296+1,839:839+80,:])

# show_image(base_creep_img)

# cropimg = base_creep_img[250:450, 600:900,:]
# cropimg_2 = base_creep_img[300:600, 800:1400,:]
# show_image(cropimg_2)
rad_template = base_creep_img[360:366, 649:650, :]
dir_template = base_creep_img_2[102:108, 1131:1132, :]
# print dir_template.shape
# show_image(dir_template)