【发布时间】:2015-01-27 14:39:37
【问题描述】:
我熟悉通过 Python 接口使用 OpenCV,但是在使用图像插值工具解决需要很高准确性的一些非标准问题时,我注意到结果中有一些意外的不准确性。下面的代码说明了我的问题。有任何想法吗?我只是想在设计精度之外使用插值器吗?
import numpy as np
import cv2
import matplotlib.pyplot as plt
# Source gradient image from 0 to 255
src = np.atleast_2d(np.linspace(0,255,10));
# Set up to interpolate from first pixel value to last pixel value
map_x_32 = np.linspace(0,9,101)
map_x_32 = np.atleast_2d(map_x_32).astype('float32')
map_y_32 = map_x_32*0
# Interpolate using OpenCV
output = cv2.remap(src, map_x_32, map_y_32, cv2.INTER_LINEAR)
# Truth
output_truth = np.atleast_2d(np.linspace(0,255,101));
interp_error = output - output_truth
plt.plot(interp_error[0])
【问题讨论】:
标签: python image opencv interpolation