edges_sub_pix (Operator)
Name
edges_sub_pix — Extract sub-pixel precise edges using Deriche, Lanser, Shen, or Canny filters.
Signature
edges_sub_pix(Image : Edges : Filter, Alpha, Low, High : )
Description
edges_sub_pix detects step edges using recursively implemented filters (according to Deriche, Lanser and Shen) or the conventionally implemented “derivative of Gaussian” filter (using filter masks) proposed by Canny. Thus, the following edge operators are available:
描述
edge_sub_pix使用递归实现的滤波器(根据Deriche,Lanser和Shen)或Canny提出的传统实现的“高斯导数”滤波器(使用滤波器)检测台阶边缘。因此,可以使用以下边缘运算符:
‘deriche1’, ‘lanser1’, ‘deriche2’, ‘lanser2’, ‘shen’, ‘mshen’, ‘canny’, ‘sobel’, and ‘sobel_fast’
(parameter Filter).
The extracted edges are returned as sub-pixel precise XLD contours in Edges. For all edge operators except ‘sobel_fast’, the following attributes are defined for each edge point (see get_contour_attrib_xld for further details):
提取的边缘作为“边缘”中的亚像素精确XLD轮廓返回。对于除“ sobel_fast”以外的所有边缘运算符,为每个边缘点定义了以下属性(有关更多详细信息,请参见get_contour_attrib_xld):
‘edge_direction’:
Gives the direction of the edge (not of the XLD contour), calculated from the image gradients in horizontal and vertical direction. The angles [rad] are given with respect to the column axis of the image.
给出边缘的方向(不是XLD轮廓),该方向是根据水平和垂直方向上的图像梯度计算得出的。相对于图像的列轴给出角度[rad]。
‘angle’:
Direction of the nousing filter masksrmal vectors to the contour in radians (oriented such that the normal vectors point to the right side of the contour as the contour is traversed from start to end point; the angles are given with respect to the row axis of the image).
法向矢量到轮廓的方向(以弧度为单位)(方向应使法向矢量在从起点到终点遍历轮廓时指向轮廓的右侧;相对于图像的行轴给出角度) 。
‘response’:
Edge amplitude (gradient magnitude).
边缘幅度(梯度幅度)。
The “filter width” (i.e., the amount of smoothing) can be chosen arbitrarily for all edge operators except ‘sobel’ and ‘sobel_fast’, and can be estimated by calling info_edges for concrete values of the parameter Alpha. For all filters (Deriche, Lanser and Shen filters), the “filter width” decreases for increasing Alpha. The only exception is the Canny filter, where an increasing Alpha also causes an increase of the “filter width”. “Wide” filters exhibit a larger invariance to noise, but also a decreased ability to detect small details. Non-recursive filters, such as the Canny filter, are realized using filter masks, and thus the execution time increases for increasing filter width. In contrast, the execution time for recursive filters does not depend on the filter width. Thus, arbitrary filter widths are possible using the Deriche, Lanser and Shen filters without increasing the run time of the operator. The resulting advantage in speed compared to the Canny operator naturally increases for larger filter widths. As border treatment, the recursive operators assume that the images to be zero outside of the image, while the Canny operator repeats the gray value at the image’s border. The signal-noise-ratio of the filters is comparable for the following choices of Alpha:
对于“ sobel”和“ sobel_fast”以外的所有边缘运算符,可以任意选择“滤波器宽度”(即平滑程度),并且可以通过调用info_edges来估计参数Alpha的具体值。对于所有滤波器(Deriche,Lanser和Shen滤波器),“滤波器宽度”都会减小,以增加Alpha。唯一的例外是Canny滤波器,其中Alpha的增加也会导致“滤波器宽度”的增加。 “宽”滤波器对噪声的不变性较大,但检测小细节的能力也会下降。非递归滤波器(例如Canny滤波器)是使用滤波器掩码实现的,因此执行时间会增加以增加滤波器宽度。相反,递归滤波器的执行时间不取决于滤波器宽度。因此,使用Deriche,Lanser和Shen滤波器可以实现任意滤波器宽度,而不会增加算子的运行时间。对于更大的滤波器宽度,与Canny运算符相比,速度方面的优势自然会增加。作为边界处理,递归运算符假定图像在图像外部为零,而Canny运算符在图像边界重复灰度值。滤波器的信噪比可与以下Alpha选择相媲美:
Alpha('lanser1') = Alpha('deriche1'),
Alpha('deriche2') = Alpha('deriche1') / 2,
Alpha('lanser2') = Alpha('deriche2'),
Alpha('shen') = Alpha('deriche1') / 2,
Alpha('mshen') = Alpha('shen'),
Alpha('canny') = 1.77 / Alpha('deriche1').
The originally proposed recursive filters (‘deriche1’, ‘deriche2’, ‘shen’) return a biased estimate of the amplitude of diagonal edges. This bias is removed in the corresponding modified version of the operators (‘lanser1’, ‘lanser2’ and ‘mshen’), while maintaining the same execution speed.
最初提出的递归滤波器(“ deriche1”,“ deriche2”,“ shen”)返回对角线边缘幅度的偏差估计。在算子的相应修改版本(“ lanser1”,“ lanser2”和“ mshen”)中消除了这种偏差,同时保持了相同的执行速度。
For relatively small filter widths (11 x 11), i.e., for Alpha (‘lanser2’ = 0.5), all filters yield similar results. Only for “wider” filters differences begin to appear: the Shen filters begin to yield qualitatively inferior results. However, they are the fastest of the implemented operators that supprt arbitrary mask sizes, closely followed by the Deriche operators. The two Sobel filters, which use a fixed mask size of (3 x 3), are faster than the other filters. Of these two, the filter ‘sobel_fast’ is significantly faster than ‘sobel’.
对于相对较小的滤波器宽度(11 x 11),即对于Alpha(‘lanser2’= 0.5),所有滤波器都会产生相似的结果。仅对于“更宽”的滤波器,差异开始出现:Shen滤波器开始产生质量较差的结果。但是,它们是支持任意掩码大小的已实现算子中最快的,Deriche算子紧随其后。使用固定掩码大小(3 x 3)的两个Sobel滤波器比其他滤波器更快。在这两个滤波器中,滤波器“ sobel_fast”明显比“ sobel”更快。
edges_sub_pix links the edge points into edges by using an algorithm similar to a hysteresis threshold operation, which is also used in lines_gauss. Points with an amplitude larger than High are immediately accepted as belonging to an edge, while points with an amplitude smaller than Low are rejected. All other points are accepted as edges if they are connected to accepted edge points (see also lines_gauss and hysteresis_threshold).
edge_sub_pix使用类似于滞后阈值运算的算法将边缘点链接到边缘,该算法也用于lines_gauss。幅度大于高的点将被立即视为属于边,而幅度小于低的点将被拒绝。如果将所有其他点连接到可接受的边缘点,则将所有其他点视为边缘(另请参见lines_gauss和hysteresis_threshold)。
Because edge extractors are often unable to extract certain junctions, a mode that tries to extract these missing junctions by different means can be selected by appending ‘_junctions’ to the values of Filter that are described above. This mode is analogous to the mode for completing junctions that is available in lines_gauss.
因为边缘提取器通常无法提取某些结点,所以可以通过将’_junctions’附加到上述Filter的值中来选择尝试通过不同方式提取这些缺失结点的模式。此模式类似于lines_gauss中可用的完成结点的模式。
The edge operator ‘sobel_fast’ has the same semantics as all the other edge operators. Internally, however, it is based on significantly simplified variants of the individual processing steps (hysteresis thresholding, edge point linking, and extraction of the subpixel edge positions). Therefore, ‘sobel_fast’ in some cases may return slightly less accurate edge positions and may select different edge parts.
边缘运算符’sobel_fast’具有与所有其他边缘运算符相同的语义。但是,在内部,它基于各个处理步骤的显著简化的变体(滞后阈值,边缘点链接和亚像素边缘位置的提取)。因此,“ sobel_fast”在某些情况下可能返回的精度稍差一些,并且可能选择不同的边缘部分。
edges_sub_pix can be executed on OpenCL devices for the filter types ‘canny’ and ‘sobel_fast’. This will require up to widthheight29 bytes of pinned memory. Since allocating memory is an expensive operation, it would make sense to set the pinne
可以在OpenCL设备上为“ canny”和“ sobel_fast”滤波器类型执行edges_sub_pix。这将需要最多宽高 29个字节的固定内存。由于分配内存是一项昂贵的操作,因此设置pinne