当前位置: 首页>>代码示例>>Python>>正文


Python Filter.process_frame方法代码示例

本文整理汇总了Python中filter.Filter.process_frame方法的典型用法代码示例。如果您正苦于以下问题:Python Filter.process_frame方法的具体用法?Python Filter.process_frame怎么用?Python Filter.process_frame使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在filter.Filter的用法示例。


在下文中一共展示了Filter.process_frame方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: foveation_sequence

# 需要导入模块: from filter import Filter [as 别名]
# 或者: from filter.Filter import process_frame [as 别名]
def foveation_sequence():
    frame_down_factor = 1
    mem_down_factor = 2     # relative to the frame down factor
    coarse_down_factor = 2  # for the coarse comparison

    fs = 80
    fovea_shape = (fs, fs)
    full_values = 128
    values = full_values / 2**frame_down_factor

    index = 15
    n_frames = 10
    source = KittiMultiViewSource(index, test=False, n_frames=n_frames)
    full_shape = source.frame_ten[0].shape
    frame_ten = [downsample(source.frame_ten[0], frame_down_factor),
                 downsample(source.frame_ten[1], frame_down_factor)]
    frame_shape = frame_ten[0].shape

    average_disp = source.get_average_disparity()
    average_disp = cv2.pyrUp(average_disp)[:frame_shape[0],:frame_shape[1]-values]

    filter = Filter(average_disp, frame_down_factor, mem_down_factor,
                    fovea_shape, frame_shape, values, verbose=False, memory_length=0)

    plt.figure()
    import matplotlib.cm as cm
    for i in range(0, 10, 2):
        frame = [downsample(source.frame_sequence[i][0], frame_down_factor),
                 downsample(source.frame_sequence[i][1], frame_down_factor)]
        filter_disp, fovea_corner = filter.process_frame(None, frame)

        edge = 5

        plt.subplot(5,1,i/2+1)
#        plt.subplot(5,2,i+1)
        plt.imshow(trim(frame[0], values, edge), cmap = cm.Greys_r)
#         remove_axes()

#         plt.subplot(5,2,i+2)
#         plt.imshow(trim(filter_disp, values, edge), vmin=0, vmax=full_values)
 
        fovea_corner = fovea_corner[0]
#        plot_edges(fovea_ij, (fs, fs))        
        fi, fj = fovea_corner
        fm = fs
        fn = fs
        plt.plot([fj, fj+fn, fj+fn, fj, fj], [fi, fi, fi+fm, fi+fm, fi], 'white')
        
#        plt.scatter(fovea_corner[1]-values+fs/2, fovea_corner[0]-edge+fs/2, s=100, c='green', marker='+', linewidths=2)
#        plt.scatter(fovea_corner[1]-values, fovea_corner[0]-edge, s=9, c='green', marker='+', linewidths=3)
#        plt.scatter(fovea_corner[1]-values+fs, fovea_corner[0]-edge+fs, s=9, c='green', marker='+', linewidths=3)
#        plt.scatter(fovea_corner[1]-values, fovea_corner[0]-edge+fs, s=9, c='green', marker='+', linewidths=3)
#        plt.scatter(fovea_corner[1]-values+fs, fovea_corner[0]-edge, s=9, c='green', marker='+', linewidths=3)
        
        remove_axes()
        
    plt.tight_layout(-1)
    plt.show()
开发者ID:hunse,项目名称:fast-stereo,代码行数:60,代码来源:figures.py

示例2: objective

# 需要导入模块: from filter import Filter [as 别名]
# 或者: from filter.Filter import process_frame [as 别名]
def objective(args):
    args['ksize'] = int(args['ksize'])

    filter = Filter(average_disparity, frame_down_factor, mem_down_factor,
                    fovea_shape, frame_shape, values, verbose=False)
    filter.params = dict(args)

    costs = []
    for i in range(source.n_frames):
        frame = [downsample(source.video[i][0], frame_down_factor),
                 downsample(source.video[i][1], frame_down_factor)]
        disp, fovea_corner = filter.process_frame(source.positions[i], frame)

        true_disp = downsample(source.ground_truth[i], frame_down_factor)
        costs.append(cost(disp[:,values:], true_disp, average_disparity))

    mean_cost = np.mean(costs)

    print(mean_cost, args)
    return mean_cost
开发者ID:hunse,项目名称:fast-stereo,代码行数:22,代码来源:hyperopt_filter.py


注:本文中的filter.Filter.process_frame方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。