我正在对图像使用函数(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/