Ejemplo n.º 1
0
def get_max_axis_x(img):
    """takes a list of all the colored pixels. Elements in the form (<pixel color>, <location>)
    returns max(x) and min(y)  i.e. (max(x),0)
    """    
    max_axis_x = None
    min_axis_y = None
    
    for i in range(max_x):
        for j in range(max_y):
            if ut.check_color(img, i, j, 0, 0, 0):
                if ut.probe_back(img, i, j, 0, 0, 0) and ut.probe_up(img, i, j, 0, 0, 0):
                    max_axis_x = i
                    min_axis_y = j
                    break
    return (max_axis_x, min_axis_y)
Ejemplo n.º 2
0
def get_max_axis_y(img):
    """takes a list of all the colored pixels. Elements in the form (<pixel color>, <location>)
    returns min(x) and max(y)  i.e. (0,max(y))
    """
    min_axis_x = None
    max_axis_y = None
    
    for i in range(max_x):
        for j in range(max_y):
            if ut.check_color(img, i, j, 0, 0, 0):
                if ut.probe_forward(img, i, j, 0, 0, 0) and ut.probe_down(img, i, j, 0, 0, 0):
                    min_axis_x = i
                    max_axis_y = j
                    break
    return (min_axis_x, max_axis_y)   
Ejemplo n.º 3
0
def get_origin(img):
    """takes a list, img, map of pixel colors. Elements in the form (<pixel color>, <location>)
    returns min(x) and min(y)  i.e. (0,0) on the graph axis
    """
    min_axis_x = None
    min_axis_y = None
    
    for i in range(max_x):
        for j in range(max_y):
            if ut.check_color(img, i, j, 0, 0, 0):
                if ut.probe_forward(img, i, j, 0, 0, 0) and ut.probe_up(img, i, j, 0, 0, 0):
                    min_axis_x = i
                    min_axis_y = j
                    break
    return (min_axis_x, min_axis_y) #excludes the perimeter