使用霍夫变换进行矩形检测

发布于 2024-08-03 19:05:52 字数 357 浏览 4 评论 0原文

我正在尝试使用 Hough 变换 实现矩形检测,基于 本文

我使用Matlab对其进行了编程,但是在检测到平行对线和正交对之后,我必须检测这些对的交集。我的问题是关于霍夫空间中两条线相交的质量。

我通过求解四个方程组找到了交点。这些交点位于笛卡尔空间还是极坐标空间中?

I'm trying to implement rectangle detection using the Hough transform, based on
this paper.

I programmed it using Matlab, but after the detection of parallel pair lines and orthogonal pairs, I must detect the intersection of these pairs. My question is about the quality of the two line intersection in Hough space.

I found the intersection points by solving four equation systems. Do these intersection points lie in cartesian or polar coordinate space?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

薄凉少年不暖心 2024-08-10 19:05:52

对于那些对这篇论文感到好奇的人,它是:

基于窗口霍夫变换的矩形检测,由 Cláudio Rosito Jung 和 Rodrigo Schramm 撰写。

现在根据论文,交点表示为极坐标,显然您的实现可能有所不同(唯一的判断方法是向我们展示您的代码)。

假设您与他的符号一致,您的峰值应表示为:

Peaks

然后,您必须执行第 4.3 节中的公式 (3) 或

给出的峰值配对。 net/4uEU5.gif" rel="nofollow noreferrer">equation 3

其中 T_theta代表平行线对应的角度阈值
enter这里的图像描述是对应于相似长度的线的归一化阈值。

For those of you wondering about the paper, it's:

Rectangle Detection based on a Windowed Hough Transform by Cláudio Rosito Jung and Rodrigo Schramm.

Now according to the paper, the intersection points are expressed as polar coordinates, obviously you implementation may be different (the only way to tell is to show us your code).

Assuming you are being consistent with his notation, your peaks should be expressed as:

Peaks

You must then perform peak paring given by equation (3) in section 4.3 or

equation 3

where T_thetarepresents the angular threshold corresponding to parallel lines
and enter image description hereis the normalized threshold corresponding to lines of similar length.

第七度阳光i 2024-08-10 19:05:52

霍夫空间的准确性应取决于两个主要因素。

累加器映射到霍夫空间。要循环遍历累加器数组,需要累加器将霍夫空间划分为离散网格。

线性霍夫空间中影响准确性的第二个因素是原始图像中原点的位置。花点时间看看如果对 \rho 中的任何给定变化进行 \theta 扫描会发生什么。在原点附近,这些扫描之一所覆盖的像素远少于图像边缘附近的扫描。结果是,在图像边缘附近,您的累加器中需要更高的 \rho \theta 分辨率,才能在转换回笛卡尔坐标系时达到相同水平的精度。

当然,提高分辨率的问题是您将需要更多的计算能力和内存来提高分辨率。另外,如果您统一增加累加器分辨率,则会在原点附近不需要的地方浪费分辨率。

一些有助于解决此问题的想法。

  1. 将原点放在
    图像的中心。相对于
    使用自然的左下角或顶部
    代码中图像的左侧。
  2. 尝试使用最接近的图像
    到达一个广场。越拉长
    图像对于给定区域越多
    宣布分辨率陷阱
    变得在边缘
  3. 尝试将图像分为 4/9/16
    等等不同的累加器,每个都有
    该子图像中心的原点。
    链接需要一点开销
    每个累加器的结果加在一起
    用于矩形检测,但它应该有帮助
    使分辨率分布更均匀。
  4. 最终的解决方案是增加
    分辨率线性取决于
    距原点的距离。这可以通过使用来实现

    (x-a)^2 + (y-b)^2 = \rho^2

circle equation where
    - x,y are the current pixel
    - a,b are your chosen origin
    - \rho is the radius
once the radius is known adjust your accumulator
resolution accordingly. You will have to keep
track of the center of each \rho \theta bin.
for transforming back to Cartesian

The accuracy of the Hough space should be dependent on two main factors.

The accumulator maps onto Hough Space. To loop through the accumulator array requires that the accumulator divide the Hough Space into a discrete grid.

The second factor in accuracy in Linear Hough Space is the location of the origin in the original image. Look for a moment at what happens if you do a sweep of \theta for any given change in \rho. Near the origin, one of these sweeps will cover far less pixels than a sweep out near the edges of the image. This has the consequence that near the edges of the image you need a much higher \rho \theta resolution in your accumulator to achieve the same level of accuracy when transforming back to Cartesian.

The problem with increasing the resolution of course is that you will need more computational power and memory to increase it. Also If you uniformly increase the accumulator resolution you have wasted resolution near the origin where it is not needed.

Some ideas to help with this.

  1. place the origin right at the
    center of the image. as opposed to
    using the natural bottom left or top
    left of an image in code.
  2. try using the closest image you can
    get to a square. the more elongated an
    image is for a given area the more
    pronounced the resolution trap
    becomes at the edges
  3. Try dividing your image into 4/9/16
    etc different accumulators each with
    an origin in the center of that sub-image.
    It will require a little overhead to link
    the results of each accumulator together
    for rectangle detection, but it should help
    spread the resolution more evenly.
  4. The ultimate solution would be to increase
    the resolution linearly depending on the
    distance from the origin. this can be achieved using the

    (x-a)^2 + (y-b)^2 = \rho^2

circle equation where
    - x,y are the current pixel
    - a,b are your chosen origin
    - \rho is the radius
once the radius is known adjust your accumulator
resolution accordingly. You will have to keep
track of the center of each \rho \theta bin.
for transforming back to Cartesian
饭团 2024-08-10 19:05:52

参考论文的链接不起作用,但如果您使用标准霍夫变换,则四个交点将以笛卡尔坐标表示。事实上,使用霍夫变换检测到的四条线将使用“正常参数化”来表示:

rho = x cos(theta) + y sin(theta)

因此您将有四对(rho_i,theta_i)来标识您的四条线。检查正交性后(例如仅通过比较角度 theta_i),您可以求解四个方程组,每个方程组的形式如下:

rho_j = x cos(theta_j) + y sin(theta_j)
rho_k = x cos(theta_k) + y sin(theta_k)

其中 x 和 y 是表示交点的笛卡尔坐标的未知数。

The link to the referenced paper does not work, but if you used the standard hough transform than the four intersection points will be expressed in cartesian coordinates. In fact, the four lines detected with the hough tranform will be expressed using the "normal parametrization":

rho = x cos(theta) + y sin(theta)

so you will have four pairs (rho_i, theta_i) that identifies your four lines. After checking for orthogonality (for example just by comparing the angles theta_i) you solve four equation system each of the form:

rho_j = x cos(theta_j) + y sin(theta_j)
rho_k = x cos(theta_k) + y sin(theta_k)

where x and y are the unknowns that represents the cartesian coordinates of the intersection point.

擦肩而过的背影 2024-08-10 19:05:52

我不是数学家。我愿意接受纠正...
根据霍夫 2) ... xy 平面上的任何直线都可以描述为 p = x cos theta + y sin theta。在这个表示中,p是法向距离,theta是直线的法向角度,...在实际应用中,角度theta和距离p被量化,我们得到一个数组C(p, theta) 。
来自 CRC 标准数学表解析几何、平面部分中的极坐标...
这样的有序数字对(r, theta)称为点p的极坐标。
直线:令 p = 到 O 的直线距离,w = 从 OX 到通过 O 到直线的垂线的逆时针角度。范式:r cos(theta - w) = p
由此我得出结论,这些点位于极坐标空间中。

I am not a mathematician. I am willing to stand corrected...
From Hough 2) ... any line on the xy plane can be described as p = x cos theta + y sin theta. In this representation, p is the normal distance and theta is the normal angle of a straight line, ... In practical applications, the angles theta and distances p are quantized, and we obtain an array C(p, theta).
from CRC standard math tables Analytic Geometry, Polar Coordinates in a Plane section ...
Such an ordered pair of numbers (r, theta) are called polar coordinates of the point p.
Straight lines: let p = distance of line from O, w = counterclockwise angle from OX to the perpendicular through O to the line. Normal form: r cos(theta - w) = p.
From this I conclude that the points lie in polar coordinate space.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文