如何实现Hough变换? [英] How to implement the Hough Transform?

查看:180
本文介绍了如何实现Hough变换?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在文本图像上实现 Hough变换?我正在寻找伪代码(最终将在java中)。

How does one implement a Hough transform on a text image? I'm looking for pseudo-code (eventually this will be in java).

以下是一些背景信息:

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

Given an image, determine the equation for a line y = mx + b. Typically the Hough Transform is represented in polar co-ordinates such that Rho = y*sin(theta) + x*cos(theta). (I'm not really sure what the X and Y values correspond to back to the image).

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

we are only interested in the Rho and theta values and plot them. The locations with many points in the accumulator (I know some of the implementation, not the execution) is considered a line.

我不明白的问题是如何找到 rho theta 您要更新累加器。

The issue that I don't understand is how to find the rho and theta that you'd update the accumulator with.

推荐答案


Hough变换最简单的情况是
检测直线的线性变换。在图像空间中,直线可以是
,描述为y = mx + b,并且可以以图形方式绘制每对
的图像点数(x,y)

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 对应的是什么回到图像中。

So this tells you what x and y correspond to back in the image.


在霍夫变换中,一个主要的想法是考虑直线的特征
不是图像点(x1,y1),(x2,y2),...,但是
取而代之,就其参数而言,例如斜率参数m和
截距参数b。

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.

基于这一事实,直线y =
mx + b可以表示为参数空间中的点(b,m)。
然而,人们面临的问题是垂直线会产生
参数m和b的无界值。出于计算原因,
因此最好使用一对不同的参数,表示为
和(theta),用于Hough变换中的行。

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.

参数rho表示直线与
原点之间的距离,而theta是从原点到此
最近点的矢量角度。

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 对应于:他们是您在图像中尝试描述的线的极坐标和截距的表示。

This tells you what rho and theta correspond to: they are the representation in polar coordinates of slope and intercept of the line you are trying to describe in your image.

开<一个 c> C ++ hough变换的实现。

On SourceForge you can find a C++ implementation of hough transform.

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

A description from which you should be able to interpret the code which I pointed out in the previous link may be the following:


Hough t ransform算法使用一个数组,称为累加器,以
检测线的存在y = mx + b。

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

例如,线性Hough变换问题有两个未知的
参数:m和b。

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

对于每个像素及其邻域,Hough变换算法
确定是否有足够的证据证明那个像素的边缘。如果
这样,它将计算该行的参数,然后查找参数所属的累加器bin的
,并增加该bin的
值。

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

这篇关于如何实现Hough变换?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆