下面三个网站是我自己找到的代码,但是都没跑过。其中最后一个好像根据steger写的代码改进的,可以重点看这个。第四个网网址是Halcon里面steger算法的介绍。
https://github.com/allen52/Hessian-steger/tree/master/Hessian-steger
https://github.com/thorstenwagner/ij-ridgedetection/tree/master/src/main/java/de/biomedical_imaging/ij/steger
https://github.com/jalmar/CurveTracing/tree/master/source/stegers
https://www.mvtec.com/doc/halcon/1905/en/lines_gauss.html
我遇到的问题,如果在对每个像素点都计算Hessian矩阵,并求中心的时候,那么在光条中心提取时,怎么保证每行只得到唯一的一个中心点?
我看到的代码是每行取遇到的第一个灰度值为255的点,计算中心点坐标,如果tnx < 0.5的话,则将它作为中心点坐标,否则继续遍历该行。但是这样显然不是很正确。。。
在看了steger的代码后发现,对符合tnx < 0.5的点再对它的特征值进行判断,阈值是根据另外一段代码计算出来的。同时在Halcon里面看到下面这段话。
Pixels which exhibit a local maximum in the second directional derivative perpendicular to the line direction are marked as line points. The line points found in this manner are then linked to contours. This is done by immediately accepting line points that have a second derivative larger than High
. Points that have a second derivative smaller than Low
are rejected.
For the choice of the thresholds High
and Low
one has to keep in mind that the second directional derivative depends on the amplitude and width of the line as well as the choice of Sigma
. The value of the second derivative depends linearly on the amplitude, i.e., the larger the amplitude, the larger the response. For the width of the line there is an approximately inverse exponential dependence: The wider the line is, the smaller the response gets. This holds analogously for the dependence on Sigma
: The larger Sigma
is chosen, the smaller the second derivative will be. This means that for larger smoothing correspondingly smaller values for High
and Low
have to be chosen. Two examples help to illustrate this: If 5 pixel wide lines with an amplitude larger than 100 are to be extracted from an image with a smoothing of Sigma
= 1.5, High
should be chosen larger than 14. If, on the other hand, 10 pixel wide lines with an amplitude larger than 100 and a Sigma
= 3 are to be detected, High
should be chosen larger than 3.5. For the choice of Low
values between 0.25 High
and 0.5 High
are appropriate.
Low
(input_control)
Lower threshold for the hysteresis threshold operation.
Default value: 3
Suggested values: 0, 0.5, 1, 2, 3, 4, 5, 8, 10
Typical range of values: 0 ≤ Low ≤ 20
Recommended increment: 0.5
Restriction: Low >= 0
High
(input_control)
Upper threshold for the hysteresis threshold operation.
Default value: 8
Suggested values: 0, 0.5, 1, 2, 3, 4, 5, 8, 10, 12, 15, 18, 20, 25
Typical range of values: 0 ≤ High ≤ 35
Recommended increment: 0.5
Restriction: High >= 0 && High >= Low