Python skimage.io 模块,ImageCollection() 实例源码

我们从Python开源项目中,提取了以下7个代码示例,用于说明如何使用skimage.io.ImageCollection()

项目:CityHorizon    作者:CityStreetWander    | 项目源码 | 文件源码
def extract_dataset(net_message):
    assert net_message.layer[0].type == "DenseImageData"
    source = net_message.layer[0].dense_image_data_param.source
    with open(source) as f:
        data = f.read().split()
    ims = ImageCollection(data[::2])
    labs = ImageCollection(data[1::2])
    assert len(ims) == len(labs) > 0
    return ims, labs
项目:cv4ag    作者:worldbank    | 项目源码 | 文件源码
def extract_dataset(net_message):
    assert net_message.layer[0].type == "DenseImageData"
    source = net_message.layer[0].dense_image_data_param.source
    with open(source) as f:
        data = f.read().split()
    ims = ImageCollection(data[::2])
    labs = ImageCollection(data[1::2])
    assert len(ims) == len(labs) > 0
    return ims, labs
项目:pytorch-seq2seq    作者:rowanz    | 项目源码 | 文件源码
def load_frames(folder_name, offset=0, desired_fps=3, max_frames=40):
    """
    :param folder_name: Filename with a gif
    :param offset: How many frames into the gif we want to start at
    :param desired_fps: How many fps we'll sample from the image
    :return: [T, h, w, 3] GIF
    """
    coll = ImageCollection(folder_name + '/out-*.jpg', mode='RGB')

    try:
        duration_path = folder_name + '/duration.txt'
        with open(duration_path,'r') as f:
            durs = f.read().splitlines()
            fps = 100.0/durs[0]
    except:
        # Some error occurs
        fps = 10

    # want to scale it to desired_fps
    keep_ratio = max(1., fps/desired_fps)

    frames = np.arange(offset, len(coll), keep_ratio).astype(int)[:max_frames]

    def _add_chans(img):
        if img.ndim == 3:
            return img
        return np.stack([img]*3,-1)

    imgs_concat = concatenate_images([_add_chans(coll[f]) for f in frames])
    assert imgs_concat.ndim == 4
    return imgs_concat
项目:ENet    作者:TimoSaemann    | 项目源码 | 文件源码
def extract_dataset(net_message):
    assert net_message.layer[0].type == "DenseImageData"
    source = net_message.layer[0].dense_image_data_param.source
    with open(source) as f:
        data = f.read().split()
    ims = ImageCollection(data[::2])
    labs = ImageCollection(data[1::2])
    assert len(ims) == len(labs) > 0
    return ims, labs
项目:DepthSegnet    作者:hari-sikchi    | 项目源码 | 文件源码
def extract_dataset(net_message):
    assert net_message.layer[0].type == "DenseImageData"
    source = net_message.layer[0].dense_image_data_param.source
    with open(source) as f:
        data = f.read().split()
    print data
    ims = ImageCollection(data[::2])
    labs = ImageCollection(data[1::2])
    assert len(ims) == len(labs) > 0
    return ims, labs
项目:DL8803    作者:NanditaDamaraju    | 项目源码 | 文件源码
def extract_dataset(net_message):
    assert net_message.layer[0].type == "DenseImageData"
    source = net_message.layer[0].dense_image_data_param.source
    with open(source) as f:
        data = f.read().split()
    ims = ImageCollection(data[::2])
    labs = ImageCollection(data[1::2])
    assert len(ims) == len(labs) > 0
    return ims, labs
项目:DL8803    作者:NanditaDamaraju    | 项目源码 | 文件源码
def extract_dataset(net_message):
    assert net_message.layer[0].type == "DenseImageData"
    source = net_message.layer[0].dense_image_data_param.source
    with open(source) as f:
        data = f.read().split()
    ims = ImageCollection(data[::2])
    labs = ImageCollection(data[1::2])
    assert len(ims) == len(labs) > 0
    return ims, labs