java – 如何实现Hough变换?

前端之家收集整理的这篇文章主要介绍了java – 如何实现Hough变换?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
如何在文本图像上实现 Hough transform?我正在寻找伪代码(最终将在java中).

以下是一些背景信息:

给定图像,确定线y = mx b的等式.通常,霍夫变换以极坐标表示,使得Rho = y * sin(θ)x * cos(θ). (我不确定X和Y值对应于图像).

我们只对Rho和theta值感兴趣并绘制它们.累加器中有多个点的位置(我知道一些实现,而不是执行)被认为是一条线.

我不明白的问题是如何找到你用更新累加器的rho和theta.

解决方法

The simplest case of Hough transform is the linear transform for
detecting straight lines. In the image space,the straight line can be
described as y = mx + b and can be graphically plotted for each pair
of image points (x,y)

所以这告诉你x和y对应于图像中的背面.

In the Hough transform,a main idea is to consider the characteristics
of the straight line not as image points (x1,y1),(x2,y2),…,but
instead,in terms of its parameters,such as the slope parameter m and
the intercept parameter b.

Based on that fact,the straight line y =
mx + b can be represented as a point (b,m) in the parameter space.
However,one faces the problem that vertical lines give rise to
unbounded values of the parameters m and b. For computational reasons,
it is therefore better to use a different pair of parameters,denoted
and (theta),for the lines in the Hough transform.

The parameter rho represents the distance between the line and the
origin,while theta is the angle of the vector from the origin to this
closest point.

这告诉你rho和theta对应的是:它们是斜率极坐标中的表示和你想要在图像中描述的线的截距.

SourceForge,你可以找到霍夫变换的C实现.

您应该能够解释我在上一个链接中指出的代码的描述可能如下:

The Hough transform algorithm uses an array,called an accumulator,to
detect the existence of a line y = mx + b.

For example,the linear Hough transform problem has two unknown
parameters: m and b.

For each pixel and its neighborhood,the Hough transform algorithm
determines if there is enough evidence of an edge at that pixel. If
so,it will calculate the parameters of that line,and then look for
the accumulator’s bin that the parameters fall into,and increase the
value of that bin.

By finding the bins with the highest values,typically by looking for local maxima in the accumulator space,the most likely lines can be extracted

猜你在找的Java相关文章