@@ -0,0 +1,1347 @@
+from unrealcv import client%0Aimport re%0A%0Aclass Color(object):%0A    ''' A utility class to parse color value '''%0A    regexp = re.compile('%5C(R=(.*),G=(.*),B=(.*),A=(.*)%5C)')%0A    def __init__(self, color_str):%0A        self.color_str = color_str%0A        match = self.regexp.match(color_str)%0A        (self.R, self.G, self.B, self.A) = %5Bint(match.group(i)) for i in range(1,5)%5D%0A%0A    def __repr__(self):%0A        return self.color_str%0A%0A    def __eq__(self, o):%0A        equal = (self.R == other.R and self.G == other.G and self.B == other.B)%0A        return equal%0A%0Adef get_color_mapping(client, object_list):%0A    ''' Get the color mapping for specified objects '''%0A    color_mapping = %7B%7D%0A    for objname in object_list:%0A        color_mapping%5Bobjname%5D = Color(client.request('vget /object/%25s/color' %25 objname))%0A    return color_mapping%0A%0Adef test_color_mapping():%0A    ''' Make sure the color for each object is identical '''%0A    client.connect()%0A    scene_objects = client.request('vget /objects').split(' ')%0A    color_mapping = get_color_mapping(client, scene_objects)%0A    colors = color_mapping.values()%0A    assert len(colors) == len(set(colors))%0A    print 'Number of objects %25d, number of unique colors %25d' %25 (len(colors), len(set(colors)))%0A    print color_mapping%0A%0A    # Make sure the colors are identical%0A%0Aif __name__ == '__main__':%0A    test_color_mapping()%0A

Add a test for object mask.