Halcyonsobel_amp使用Sobel运算符检测边缘

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

Halcyonsobel_amp使⽤Sobel运算符检测边缘
sobel_amp 使⽤Sobel运算符检测边缘(幅度)。

sobel_amp(Image : EdgeAmplitude : FilterType, Size : )
sobel_amp计算图像的⼀阶导数,并⽤作边缘检测器。

过滤器基于以下过滤器掩码
These masks are used differently, according to the selected filter type. (In the following, a and b denote the results of convolving an image with A and B for one particular pixel.)
根据选择的滤镜类型,这些遮罩的使⽤⽅式有所不同。

(以下,a和b表⽰针对⼀个特定像素将图像与A和B卷积的结果。


Here, thin(x) is equal to x for a vertical maximum (mask A) and a horizontal maximum (mask B), respectively, and 0 otherwise. Thus, for
'thin_sum_abs' and 'thin_max_abs' the gradient image is thinned. For the filter types 'x' and 'y' if the input image is of type byte the output image is of type int1, of type int2 otherwise. For a Sobel operator with size 3x3, the corresponding filters A and B are applied directly, while for larger filter sizes the input image is first smoothed using a Gaussian filter (see gauss_image) or a binomial filter (see binomial_filter) of size Size-2. The Gaussian filter is selected for the above values of FilterType. Here, Size = 5, 7, 9, 11, or 13 must be used. The binomial filter is selected by appending '_binomial' to the above values of FilterType. Here, Size can be selected between 5 and 39. Furthermore, it is possible to select different amounts of smoothing the column and row direction by passing two values in Size. Here, the first value of Size corresponds to the mask width (smoothing in the column direction), while the second value corresponds to the mask height (smoothing in the row direction) of the binomial filter. The binomial filter can only be used for images of type byte, uint2 and real. Since smoothing reduces the edge amplitudes, in this case the edge amplitudes are multiplied by a factor of 2 to prevent information loss. Therefore,
在这⾥,thin(x)分别等于垂直最⼤值(掩码A)和⽔平最⼤值(掩码B)的x,否则等于0。

因此,对于“ thin_sum_abs”和“
thin_max_abs”,梯度图像变薄。

对于过滤器类型“ x”和“ y”,如果输⼊图像为字节类型,则输出图像为int1类型,否则为int2类型。

对于⼤⼩为3x3的Sobel运算符,将直接应⽤相应的过滤器A和B,⽽对于较⼤的过滤器,则⾸先使⽤⼤⼩为2的⾼斯过滤器(请参阅gauss_image)或⼆项式过滤器(请参见binomial_filter)对输⼊图像进⾏平滑处理。

为FilterType的上述值选择了⾼斯滤波器。

在这⾥,必须使⽤Size = 5、7、9、11或13。

通过将“ _binomial”附加到上述FilterType的值来选择⼆项式过滤器。

在此,可以在5到39之间选择⼤⼩。

此外,可以通过传递两个值来选择不同的平滑列和⾏⽅向的量。

在此,Size的第⼀个值对应于⼆项式滤波器的掩模宽度(沿列⽅向平滑),⽽第⼆个值对应于⼆项式滤波器的掩模⾼度(沿⾏⽅向平滑)。

⼆项式过滤器只能⽤于字节,uint2和实数类型的图像。

由于平滑会减⼩边缘幅度,因此在这种情况下,边缘幅度会乘以2倍,以防⽌信息丢失。

因此,
sobel_amp(I,E,FilterType,S)
for Size > 3 is conceptually equivalent to
对于Size> 3在概念上等效于
scale_image(I,F,2,0)
gauss_image(F,G,S-2)
sobel_amp(G,E,FilterType,3)
or to
scale_image(I,F,2,0)
binomial_filter(F,G,S[0]-2,S[1]-2)
sobel_amp(G,E,FilterType,3).
For sobel_amp special optimizations are implemented FilterType = 'sum_abs' that use SIMD technology. The actual application of these special optimizations is controlled by the system parameter 'mmx_enable' (see set_system). If 'mmx_enable' is set to 'true' (and the SIMD instruction set is available), the internal calculations are performed using SIMD technology. Note that SIMD technology performs best on large, compact input regions. Depending on the input region and the capabilities of the hardware the execution of sobel_amp might even take significantly more time with SIMD technology than without.
对于sobel_amp,使⽤SIMD技术实现了FilterType ='sum_abs'的特殊优化。

这些特殊优化的实际应⽤由系统参数“ mmx_enable”(请参见set_system)控制。

如果将“ mmx_enable”设置为“ true”(并且SIMD指令集可⽤),则使⽤SIMD技术执⾏内部计算。

请注意,SIMD技术在⼤型紧凑的输⼊区域上表现最佳。

根据输⼊区域和硬件功能的不同,使⽤SIMD技术执⾏sobel_amp所花费的时间甚⾄可能要⽐不使⽤SIMD 技术花费的时间多得多。

sobel_amp can be executed on OpenCL devices for the filter types 'sum_abs', 'sum_sqrt', 'x' and 'y' (as well as their binomial variants). Note that when using gaussian filtering for Size > 3, the results can vary from the CPU implementation.
sobel_amp可以在OpenCL设备上针对过滤器类型“ sum_abs”,“ sum_sqrt”,“ x”和“ y”(及其⼆项式变量)执⾏。

请注意,当对⼤⼩> 3使⽤⾼斯滤波时,结果可能因CPU实现⽽异。

Attention(注意)
Note that filter operators may return unexpected results if an image with a reduced domain is used as input. Please refer to the chapter Filters.
请注意,如果使⽤缩⼩域的图像作为输⼊,则过滤器运算符可能会返回意外结果。

请参阅过滤器⼀章。

Parameters(参数)
Image (input_object)
Input image.(预处理图⽚)
EdgeAmplitude (output_object)
Edge amplitude (gradient magnitude) image.(边缘幅度(梯度幅度)图像)
FilterType (input_control) string
Filter type. (滤波类型)
Default value: 'sum_abs' (默认值:'sum_abs')
List of values: 'sum_abs', 'sum_abs_binomial', 'sum_sqrt', 'sum_sqrt_binomial', 'thin_max_abs', 'thin_max_abs_binomial',
'thin_sum_abs', 'thin_sum_abs_binomial', 'x', 'x_binomial', 'y', 'y_binomial'
List of values (for compute devices): 'sum_abs', 'sum_sqrt', 'x', 'y', 'sum_abs_binomial', 'sum_sqrt_binomial', 'x_binomial', 'y_binomial' Size (input_control) integer(-array) → (integer)
Size of filter mask.
Default value: 3
List of values: 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39
Example (HDevelop) (例⼦)
read_image(Image,'fabrik')
sobel_amp(Image,Amp,'sum_abs',3)
threshold(Amp,Edg,128,255)
Result (输出结果)
sobel_amp returns 2 (H_MSG_TRUE) if all parameters are correct. If the input is empty the behavior can be set via
set_system('no_object_result',<Result>). If necessary, an exception is raised.
如果所有参数正确,则sobel_amp返回2(H_MSG_TRUE)。

如果输⼊为空,则可以通过set_system('no_object_result',<Result>)设置⾏为。

如有必要,将引发异常。

相关文档
最新文档