python-3.x - 为什么 HoughLinesP 输出 3D 数组,而不是 2D 数组?

标签 python-3.x opencv numpy hough-transform opencv3.1

我正在对图像使用函数(Python、Numpy、OpenCV3),这是我的示例输出 -

[[[539 340 897 538]]

 [[533 340 877 538]]

 [[280 460 346 410]]

 [[292 462 353 411]]

 [[540 343 798 492]]]

它的大小是(5,1,4)

我试图了解该函数在什么情况下会输出类似 (5,2,4) 或 (5,3,4) 的内容。但我现在想不起我使用过的任何图像,它是一个列数为 1 的 3D 数组。

仅仅一个 2D 数组就足够了,而且可能更高效吗?

最佳答案

我询问了 OpenCV 问答并得到了以下答复 -

opencv is a c++ library, and the python wrappers are auto-generated from some scripts, so in c++ we have:

vector lines; to hold the hough results.

now unfortunately , Vec4i is a descendant of Matx , which is actually a 2d thing, so in python you get:

[ #one for the vector

[ #one for the 1st dim of Vec4i (1, pretty useless, admittedly :)

[ #one for the 2nd dim of Vec4i (4 elements)

again, i think, you'll just have to live with it.

关于python-3.x - 为什么 HoughLinesP 输出 3D 数组,而不是 2D 数组?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40362942/

相关文章:

Python session 不适用于多个请求

java - 尽管单应性内点良好,但 opencv viewTransform 仍会产生不正确的转换

c++ - OpenCV - 将曲线拟合到一组点

python - 使用 Python 3.3 在 OSX 上使用 MKL 构建 NumPy 时出错

python - 需要帮助解决 Raspberry Pi 上 matplotlib 的性能问题

python - 在多维数组中写入值数组的坐标

python - Python 3.3 中的类声明

python-3.x - 突出显示python中的文本并将其保存在word文件中

linux - 使用安装在远程服务器系统上的 OpenCV - ubuntu

python - 列表中的 bin 顺序值