<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _actor_from_game_image(self, name, game_image):
 """Return an actor object matching the one in the game image. Note: Health and mana are based on measured percentage of a fixed maximum rather than the actual maximum in the game. Arguments: name: must be 'player' or 'opponent' game_image: opencv image of the main game area """

        HEALTH_MAX = 100
        MANA_MAX = 40
        # get the set of tools for investigating this actor
        tools = {'player': self._player_tools,
                 'opponent': self._oppnt_tools}[name]

        # setup the arguments to be set:
        args = [name]

        # health:
        t, l, b, r = tools['health_region'].region_in(game_image)
        health_image = game_image[t:b, l:r]
        health_image = numpy.rot90(health_image)  # upright for the TankLevel
        how_full = tools['health_tank'].how_full(health_image)
        if how_full is None:
            return None  # failure
        health = int(round(HEALTH_MAX * how_full))
        args.append((health, HEALTH_MAX))
        # mana
        for color in ('r', 'g', 'b', 'y'):
            t, l, b, r = tools[color + '_region'].region_in(game_image)
            mana_image = game_image[t:b, l:r]
            how_full = tools[color + '_tank'].how_full(mana_image)
            if how_full is None:
                return None  # failure
            mana = int(round(MANA_MAX * how_full))
            args.append((mana, MANA_MAX))
        # experience and coins simply start at zero
        x_m = (0, 1000), (0, 1000)
        args.extend(x_m)
        # hammer and scroll are unused
        h_c = (0, 0), (0, 0)
        args.extend(h_c)
        # build the actor and return it
        return Actor(*args)