本文整理汇总了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()
示例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