【发布时间】:2012-06-20 06:34:15
【问题描述】:
我正在开始一个计算机视觉项目,我需要计算水平和垂直 Sobel 的导数。我将 Python 与 Numpy 和 Scipy 一起使用,特别是 ndimage.filters 模块。
我看不懂返回值和输出参数的区别。
output_x = np.zeros(image.shape)
output_y = np.zeros(image.shape)
filters.sobel(image, 1, output_x)
filters.sobel(image, 0, output_y)
return_val_1 = filters.sobel(image, axis=1)
return_val_2 = filters.sobel(image, axis=0)
如果我绘制返回值图像和输出图像,我会得到不同的结果。为什么?你能帮我么?我很困惑。
【问题讨论】:
-
所以问题是:'_ni_support._get_output' 是做什么的?所以从代码here来看是输出的浅拷贝。
-
是的,看起来它们是相等的,但实际上并非如此。我想知道缺少的步骤是什么。
-
您能否更准确地了解 return_val 和输出图像之间的区别?
ret_val = filters.sobel(image, axis=1, output=output_x)是否按预期工作?
标签: python image-processing filter computer-vision scipy